dooApp/FXForm2

ConcurrentModificationException in FXForm2

Closed this issue · 3 comments

Hello, rarely I'm getting the following exception.

Exception in thread "JavaFX Application Thread" java.util.ConcurrentModificationException
    at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:719)
    at java.util.LinkedHashMap$LinkedKeyIterator.next(LinkedHashMap.java:742)
    at com.dooapp.fxform.adapter.DefaultAdapterProvider.getAdapter(DefaultAdapterProvider.java:127)
    at com.dooapp.fxform.adapter.DefaultAdapterProvider.getAdapter(DefaultAdapterProvider.java:110)
    at com.dooapp.fxform.controller.PropertyEditorController$1.changed(PropertyEditorController.java:62)
    at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:361)
    at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
    at javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:105)
    at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112)
    at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:146)
    at javafx.beans.property.ObjectProperty.setValue(ObjectProperty.java:69)
    at com.dooapp.fxform.controller.PropertyEditorController.lambda$updateView$0(PropertyEditorController.java:107)
    at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
    at java.lang.Thread.run(Thread.java:745)

It looks like you are retrieving an adapter in the JavaFX Thread while another thread is modifying the underlying adapter collection (i.e. you are probably registering adapters from a background thread).

To fix this in the short term, you can register your adapters from the JavaFX thread so that you don't run into multi-threading issues.

I will have a look to make the adapter collection thread proof in the future.

Deployed in 8.2.0-SNAPSHOT

Fixed in 8.1.3