FilteredList: null predicate should be allowed and indicate no filtering

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 8u40
    • Affects Version/s: 8u40
    • Component/s: javafx
    • Environment:

      8u40b12

      FilteredList throws IllegalArgumentException when setting null predicate (see below). At the very least it must be document (which would be the easy way out).

      On the other hand, it has a constructor without predicate that's explicitly documented to be meant for binding: in such contexts, a null is hard to avoid. And not really necessary: instead of throwing, it might default to ALWAYS (pending documentation) and log the conversion, just as f.i. IntegerProperty does.

              ObservableList<String> list = createObservableList(true);
              // needs a predicate
              FilteredList<String> filtered = list.filtered(p -> false);
              filtered.setPredicate(null);
       
      Caused by: java.lang.IllegalArgumentException: Predicate cannot be null.
      at javafx.collections.transformation.FilteredList$1.invalidated(FilteredList.java:100)
      at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:111)
      at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:146)
      at javafx.collections.transformation.FilteredList.setPredicate(FilteredList.java:127)

            Assignee:
            Vadim Pakhnushev
            Reporter:
            Jeanette Winzenburg
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: