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

TreeView: NullPointerException when calling TreeItem.getChildren().clear();

XMLWordPrintable

      In SceneBuilder, we need to update the children list of a TreeItem, we at first clear the list by:
          TreeItem.getChildren().clear();

      this clear operation throws time to time NullPointerException:
      Change listener threw exception
      java.lang.NullPointerException
      at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:291)
      at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:48)
      at com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.callObservers(ReadOnlyUnbackedObservableList.java:74)
      at javafx.scene.control.MultipleSelectionModelBase.shiftSelection(MultipleSelectionModelBase.java:258)
      at javafx.scene.control.TreeView$TreeViewBitSetSelectionModel$2.handle(TreeView.java:1114)
      at javafx.scene.control.TreeView$TreeViewBitSetSelectionModel$2.handle(TreeView.java:1059)
      at com.sun.javafx.scene.control.WeakEventHandler.handle(WeakEventHandler.java:62)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:64)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:28)
      at javafx.event.Event.fireEvent(Event.java:171)
      at javafx.scene.control.TreeItem.fireEvent(TreeItem.java:713)
      at javafx.scene.control.TreeItem.updateChildren(TreeItem.java:805)
      at javafx.scene.control.TreeItem.access$100(TreeItem.java:197)
      at javafx.scene.control.TreeItem$2.onChanged(TreeItem.java:397)
      at com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:134)
      at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:48)
      at com.sun.javafx.collections.ObservableListWrapper.callObservers(ObservableListWrapper.java:97)
      at com.sun.javafx.collections.ObservableListWrapper.clear(ObservableListWrapper.java:184)
      at com.oracle.javafx.authoring.panels.layers.HierarchyItem.updateChildren(HierarchyItem.java:101)
      at com.oracle.javafx.authoring.panels.layers.HierarchyPanel$13.change(HierarchyPanel.java:374)
      at com.oracle.javafx.authoring.model.transactions.TransactionManager.notifyChange(TransactionManager.java:164)
      at com.oracle.javafx.authoring.model.transactions.AbstractElementChildAction.notifyObjectChange(AbstractElementChildAction.java:56)
      at com.oracle.javafx.authoring.model.transactions.Transaction.close(Transaction.java:161)
      at com.oracle.javafx.authoring.panels.layers.ItemDropTarget.drop(ItemDropTarget.java:96)
      at com.oracle.javafx.authoring.panels.layers.HierarchyDropSupport.drop(HierarchyDropSupport.java:125)
      at com.oracle.javafx.authoring.panels.layers.HierarchyPanel.drop(HierarchyPanel.java:296)
      at com.oracle.javafx.authoring.controls.TreeDragContext.finish(TreeDragContext.java:150)
      at com.oracle.javafx.authoring.controls.TreeDragContext.finish(TreeDragContext.java:136)
      at com.oracle.javafx.authoring.panels.library.LibraryDragSupport.handleMouseRelease(LibraryDragSupport.java:73)
      at com.oracle.javafx.authoring.panels.library.LibraryPanel$2.handle(LibraryPanel.java:98)
      at com.oracle.javafx.authoring.panels.library.LibraryPanel$2.handle(LibraryPanel.java:94)
      at com.sun.javafx.event.CompositeEventHandler.dispatchCapturingEvent(CompositeEventHandler.java:78)
      at com.sun.javafx.event.EventHandlerManager.dispatchCapturingEvent(EventHandlerManager.java:202)
      at com.sun.javafx.event.EventHandlerManager.dispatchCapturingEvent(EventHandlerManager.java:159)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchCapturingEvent(CompositeEventDispatcher.java:22)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:31)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
      at javafx.event.Event.fireEvent(Event.java:171)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:2895)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:2689)
      at javafx.scene.Scene$MouseHandler.access$1300(Scene.java:2655)
      at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1281)
      at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:1913)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:212)
      at com.sun.glass.ui.View.handleMouseEvent(View.java:491)
      at com.sun.glass.ui.View.notifyMouse(View.java:869)

            jgiles Jonathan Giles
            sjiang Shanliang Jiang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: