NoSuchElementException on ColumnFilter change

Issue #704 new
Justin Raabe
created an issue

Using 8.40.12, we're getting a NoSuchElementException when doing any remove or change operations on filter.getBackingList(). It looks to be the same issue as Issue 691, where there's just an unchecked .get() in

Exception in thread "Thread-118" java.util.NoSuchElementException: No value present
at java.util.Optional.get(
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(
at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(
at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(
at javafx.collections.ObservableListBase.fireChange(
at javafx.collections.ListChangeBuilder.commit(
at javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.541)
at javafx.collections.ObservableListBase.endChange(
at com.sun.javafx.collections.ObservableListWrapper.removeAll(
at (our code which calls filter.getBackingList().removeAll(list))

The code in question:

            // Remove the FilterValue associated with the value
            FilterValue<T,R> existingFilterValue = getFilterValues().stream()
                    .filter(fv -> Objects.equals(fv.getValue(), value)).findAny().get();

Which I think could just be fixed with a .orElse(null); instead of the get();

Comments (2)

  1. Thomas Nield

    I just encountered this error a few times too. I have a strong idea what the issue is and it shouldn't be hard to fix (I'm getting a value from an Optional without checking if it is present). I'll get to this as soon as I can.

  2. Log in to comment