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

Creating a TreeView causes IndexOutOfBoundsException in MultipleSelectionModelBase

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • fx2.0
    • fx2.0
    • javafx
    • Product: javafx-2.0beta
      Platform: windows-i586
      Build-Number: 204
      Build-ID: 2011-07-12_15-48-09

      Also shows up on Mac

      The program below just creates a TreeView. It fails with the following exception. This means that basic use of TreeView is completely broken.

      java.lang.IndexOutOfBoundsException: bitIndex < 0: -1
      at java.util.BitSet.get(BitSet.java:441)
      at javafx.scene.control.MultipleSelectionModelBase.shiftSelection(MultipleSelectionModelBase.java:187)
      at javafx.scene.control.TreeView$TreeViewBitSetSelectionModel$2.handle(TreeView.java:965)
      at javafx.scene.control.TreeView$TreeViewBitSetSelectionModel$2.handle(TreeView.java:926)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:55)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:161)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:114)
      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:44)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:27)
      at javafx.event.Event.fireEvent(Event.java:156)
      at javafx.scene.control.TreeItem.fireEvent(TreeItem.java:421)
      at javafx.scene.control.TreeItem.updateChildren(TreeItem.java:490)
      at javafx.scene.control.TreeItem$2.onChanged(TreeItem.java:184)
      at com.sun.javafx.collections.ObservableListWrapper.callObservers(ObservableListWrapper.java:62)
      at com.sun.javafx.collections.ObservableListWrapper.add(ObservableListWrapper.java:81)
      at com.sun.javafx.collections.ObservableListWrapper.add(ObservableListWrapper.java:74)
      at com.oracle.javafx.authoring.panels.library.LibraryPanel.<init>(LibraryPanel.java:102)
      at com.oracle.javafx.authoring.internal.AreaPanel.getRightArea(AreaPanel.java:387)
      at com.oracle.javafx.authoring.Frame.makeFrame(Frame.java:291)
      at com.oracle.javafx.authoring.Frame.make(Frame.java:272)
      at com.oracle.javafx.authoring.DesignerTool.newProject(DesignerTool.java:230)
      at com.oracle.javafx.authoring.VTPopupBuilder$2.handle(VTPopupBuilder.java:132)
      at com.oracle.javafx.authoring.VTPopupBuilder$2.handle(VTPopupBuilder.java:126)
      at com.oracle.javafx.authoring.VTPopupBuilder$VTPopup$1.handle(VTPopupBuilder.java:335)
      at com.oracle.javafx.authoring.VTPopupBuilder$VTPopup$1.handle(VTPopupBuilder.java:330)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:59)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:161)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:114)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
      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.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:44)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:27)
      at javafx.event.Event.fireEvent(Event.java:156)
      at javafx.scene.Node.fireEvent(Node.java:5151)
      at javafx.scene.control.Button.fire(Button.java:139)
      at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:166)
      at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:272)
      at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:265)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:55)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:161)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:114)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
      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.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:44)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
      at javafx.event.Event.fireEvent(Event.java:156)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:2364)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:2187)
      at javafx.scene.Scene$MouseHandler.access$1200(Scene.java:2159)
      at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1106)
      at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:1647)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:185)
      at com.sun.glass.ui.View.handleMouseEvent(View.java:252)
      at com.sun.glass.ui.View.notifyMouse(View.java:512)
      at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
      at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
      at com.sun.glass.ui.win.WinApplication$1$1.run(WinApplication.java:49)
      at java.lang.Thread.run(Thread.java:662)

      This is the program:

      public class Foo extends Application {
          public static void main(String[] args) {
              Application.launch(Foo.class, args);
          }

          @Override
          public void start(Stage primaryStage) throws Exception {
              primaryStage.setHeight(100);
              primaryStage.setWidth(100);
              primaryStage.setVisible(true);
              StackPane stackPane = new StackPane();
              TreeView<Label> treeView = new TreeView<Label>();
              stackPane.getChildren().setAll(treeView);
              treeView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE_SELECTION);
              TreeItem<Label> root = new TreeItem<Label>(new Label("Library Panel"));
              treeView.setRoot(root);
              treeView.setShowRoot(false);
              TreeItem<Label> item = new TreeItem<Label>(new Label("Thing"));
              root.getChildren().add(item);
          }
      }

      The shiftSelection method is being called with position -1 which produces the IndexOutOfBoundsException.

            jgiles Jonathan Giles
            emcmanuswse Eamonn McManus (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: