JDK-8158631 : [SortedList] ArrayIndexOutOfBoundsException on removeAll
  • Type: Bug
  • Component: javafx
  • Sub-Component: base
  • Affected Version: 8u72
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2016-06-03
  • Updated: 2016-06-03
  • Resolved: 2016-06-03
Related Reports
Duplicate :  
Description
Hi,
occasionally an ArrayIndexOutOfBoundsException is thrown by the SortedList when calling sortedList.removeAll

removeAll is definitely called only within the FX-Thread.


============= STACK TRACE =============
java.lang.ArrayIndexOutOfBoundsException: -1
 at javafx.collections.transformation.SortedList.findPosition(SortedList.java:318) ~[jfxrt.jar:?]
 at javafx.collections.transformation.SortedList.removeFromMapping(SortedList.java:359) ~[jfxrt.jar:?]
 at javafx.collections.transformation.SortedList.addRemove(SortedList.java:389) ~[jfxrt.jar:?]
 at javafx.collections.transformation.SortedList.sourceChanged(SortedList.java:105) ~[jfxrt.jar:?]
 at javafx.collections.transformation.TransformationList.lambda$getListener$15(TransformationList.java:106) ~[jfxrt.jar:?]
 at javafx.collections.WeakListChangeListener.onChanged(WeakListChangeListener.java:88) ~[jfxrt.jar:?]
 at com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:164) ~[jfxrt.jar:?]
 at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73) ~[jfxrt.jar:?]
 at javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233) ~[jfxrt.jar:?]
 at javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482) ~[jfxrt.jar:?]
 at javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541) ~[jfxrt.jar:?]
 at javafx.collections.ObservableListBase.endChange(ObservableListBase.java:205) ~[jfxrt.jar:?]
 at javafx.collections.transformation.FilteredList.sourceChanged(FilteredList.java:147) ~[jfxrt.jar:?]
 at javafx.collections.transformation.TransformationList.lambda$getListener$15(TransformationList.java:106) ~[jfxrt.jar:?]
 at javafx.collections.WeakListChangeListener.onChanged(WeakListChangeListener.java:88) ~[jfxrt.jar:?]
 at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:329) ~[jfxrt.jar:?]
 at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73) ~[jfxrt.jar:?]
 at javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233) ~[jfxrt.jar:?]
 at javafx.collections.FXCollections$UnmodifiableObservableListImpl.lambda$new$52(FXCollections.java:929) ~[jfxrt.jar:?]
 at javafx.collections.WeakListChangeListener.onChanged(WeakListChangeListener.java:88) ~[jfxrt.jar:?]
 at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:329) ~[jfxrt.jar:?]
 at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73) ~[jfxrt.jar:?]
 at javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233) ~[jfxrt.jar:?]
 at javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482) ~[jfxrt.jar:?]
 at javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541) ~[jfxrt.jar:?]
 at javafx.collections.ObservableListBase.endChange(ObservableListBase.java:205) ~[jfxrt.jar:?]
 at com.sun.javafx.collections.ObservableListWrapper.removeAll(ObservableListWrapper.java:185) ~[jfxrt.jar:?]
 at javafx.beans.binding.ListExpression.removeAll(ListExpression.java:278) ~[jfxrt.jar:?]
 at de.fhg.iwes.ui.commons.repository.AbstractReadOnlyListRepo.lambda$3(AbstractReadOnlyListRepo.java:172) ~[classes/:?]
 at de.fhg.iwes.ui.commons.helper.FxThreadHelper$1.run(FxThreadHelper.java:27) ~[classes/:?]
 at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295) ~[jfxrt.jar:?]
 at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_72]
 at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294) ~[jfxrt.jar:?]
 at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) ~[jfxrt.jar:?]
 at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) ~[jfxrt.jar:?]
 at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191) ~[jfxrt.jar:?]
 at java.lang.Thread.run(Thread.java:745) [?:1.8.0_72]
Comments
I've prepared a backport for the JDK-8134655
03-06-2016

Right, that's why it sounded familiar. I reviewed that fix pretty carefully, and I think it is a safe fix, but I would like to hear Vadim's take on it.
03-06-2016

Ok, I found it: JDK-8134655 Is there any possibility to backport this to JDK 8?
03-06-2016

I think this may be a duplicate of a recently-fixed bug, but Vadim would remember better than I.
03-06-2016