-
Bug
-
Resolution: Fixed
-
P4
-
8u40
-
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)
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)