Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8088022

[ListChangeBuilder] Simultaneous removal of multiple child nodes leads to exception

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8u25
    • javafx
    • None

      It looks to me like JavaFX is in some place using an unmodifiable list which causes trouble.

      The situation is this:
      I have a Parent with a number of child nodes. I run through the list of child nodes and collect the nodes that fulfil my criteria for removal and add them to a regular ArrayList of nodes called nodesToRemove. I then invoke

      theParentNode.getChildren().removeAll(nodesToRemove);

      and then I get the exception shown below.

      From the stack trace I have concluded that this bug is not caused by my own code. Rather, this bug seems to stem from the following code inside ListChangeBuilder (line 208:

      else if (last != null && last.from == idx + 1) {
                  last.from--;
                  last.to--;
                  last.removed.add(0, removed);
              }

      Above the variable "last" is a SubChange which contains a list of what to remove and apparently this list is not modifiable. One could think that this would be caused by me supplying an unmodifiable list to the removeAll method, but this is not the case. Here is my code:

      List<Node> removed = new ArrayList();
      for(Node child : getChildren()) {
      if(child instanceof Row) {
      [...]
      removed.add(row);
      [...]
      }
      }
      getChildren().removeAll(removed);


      STACK TRACE

      java.lang.UnsupportedOperationException
      at java.util.Collections$UnmodifiableList.add(Collections.java:1314)
      at javafx.collections.ListChangeBuilder.nextRemove(ListChangeBuilder.java:208)
      at javafx.collections.ObservableListBase.nextRemove(ObservableListBase.java:150)
      at javafx.collections.ModifiableObservableListBase.remove(ModifiableObservableListBase.java:181)
      at com.sun.javafx.collections.ObservableListWrapper.removeAll(ObservableListWrapper.java:182)
      at com.sun.javafx.collections.VetoableListDecorator.removeAll(VetoableListDecorator.java:267)
      at com.intuism.ui.form.set.CollectionEditor.removeBlankEditors(CollectionEditor.java:334)
      at com.intuism.ui.form.set.CollectionEditor$3.edited(CollectionEditor.java:156)
      at com.intuism.ui.form.field.EditListeners.fireEdited(EditListeners.java:34)
      at com.intuism.ui.form.field.EditListeners$1.changed(EditListeners.java:25)
      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:145)
      at javafx.scene.control.ChoiceBox.setValue(ChoiceBox.java:286)
      at com.wefend.observatory.friends.PhoneNumberEditor.contextualize(PhoneNumberEditor.java:129)
      at com.intuism.core.settings.context.PriorityContext.contextualizeRecursively(PriorityContext.java:255)
      at com.intuism.core.settings.context.PriorityContext.contextualizeRecursively(PriorityContext.java:266)
      at com.intuism.core.settings.context.PriorityContext.introduceContextual(PriorityContext.java:223)
      at com.intuism.core.settings.situation.NodeSettings$1.changed(NodeSettings.java:79)
      at com.intuism.core.settings.situation.NodeSettings$1.changed(NodeSettings.java:67)
      at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:182)
      at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
      at javafx.beans.property.ReadOnlyObjectWrapper$ReadOnlyPropertyImpl.fireValueChangedEvent(ReadOnlyObjectWrapper.java:176)
      at javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(ReadOnlyObjectWrapper.java:142)
      at javafx.scene.Node$ReadOnlyObjectWrapperManualFire.fireSuperValueChangedEvent(Node.java:806)
      at javafx.scene.Node.invalidatedScenes(Node.java:856)
      at javafx.scene.Node.setScenes(Node.java:894)
      at javafx.scene.Parent.scenesChanged(Parent.java:654)
      at javafx.scene.Node.invalidatedScenes(Node.java:828)
      at javafx.scene.Node.setScenes(Node.java:894)
      at javafx.scene.Parent.scenesChanged(Parent.java:654)
      at javafx.scene.Node.invalidatedScenes(Node.java:828)
      at javafx.scene.Node.setScenes(Node.java:894)
      at javafx.scene.Parent$1.onChanged(Parent.java:271)
      at com.sun.javafx.collections.TrackableObservableList.lambda$new$20(TrackableObservableList.java:45)
      at com.sun.javafx.collections.TrackableObservableList$$Lambda$56/2068910691.onChanged(Unknown Source)
      at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:329)
      at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73)
      at javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233)
      at javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
      at javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
      at javafx.collections.ObservableListBase.endChange(ObservableListBase.java:205)
      at javafx.collections.ModifiableObservableListBase.add(ModifiableObservableListBase.java:155)
      at com.sun.javafx.collections.VetoableListDecorator.add(VetoableListDecorator.java:320)
      at com.intuism.ui.form.set.CollectionEditor.readItem(CollectionEditor.java:167)
      at com.intuism.ui.form.set.CollectionEditor$4.handle(CollectionEditor.java:286)
      at com.intuism.ui.form.set.CollectionEditor$4.handle(CollectionEditor.java:281)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
      at javafx.event.Event.fireEvent(Event.java:198)
      at javafx.scene.Node.fireEvent(Node.java:8216)
      at javafx.scene.control.Button.fire(Button.java:185)
      at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
      at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
      at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
      at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
      at javafx.event.Event.fireEvent(Event.java:198)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:3724)
      at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3452)
      at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1728)
      at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2461)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:348)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:273)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:382)
      at com.sun.glass.ui.View.handleMouseEvent(View.java:553)
      at com.sun.glass.ui.View.notifyMouse(View.java:925)

            Unassigned Unassigned
            risaksen Randahl Isaksen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Imported: