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

[ListView, et al] IOOBE when clearAndSelect called in certain circumstances

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8u40
    • 8u40
    • javafx
    • None

      When I was testing RT-24810 I was able to create an IOOBE. Here's the code:

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.ComboBox;
      import javafx.scene.control.TextField;
      import javafx.scene.layout.HBox;
      import javafx.stage.Stage;

      public class JavaApplication3 extends Application {

          public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(Stage stage) throws Exception {
              
              ComboBox<String> cmb = new ComboBox<>();
              cmb.setEditable(true);
              
              TextField tf = new TextField();

               tf.textProperty().bind(cmb.getEditor().textProperty());

              HBox root = new HBox(10d);
              
              root.getChildren().addAll(cmb, tf);
              Scene scen = new Scene(root, 300, 200);
              stage.setScene(scen);
              stage.show();
          }
      }

      Steps to reproduce:
      1) Click on ComboBox arrow to show popup
      2) Press 'end' key on keyboard

      The IOOBE is simple to fix, so I would like to fix this for 8u40. Here's the stacktrace:
      Exception in thread "JavaFX Application Thread" java.lang.IndexOutOfBoundsException: bitIndex < 0: -1
      at java.util.BitSet.clear(BitSet.java:540)
      at javafx.scene.control.MultipleSelectionModelBase.clearAndSelect(MultipleSelectionModelBase.java:330)
      at javafx.scene.control.ListView$ListViewBitSetSelectionModel.clearAndSelect(ListView.java:1391)
      at com.sun.javafx.scene.control.behavior.ListViewBehavior.selectLastRow(ListViewBehavior.java:591)
      at com.sun.javafx.scene.control.behavior.ListViewBehavior.callAction(ListViewBehavior.java:173)
      at com.sun.javafx.scene.control.behavior.BehaviorBase.callActionForEvent(BehaviorBase.java:218)
      at com.sun.javafx.scene.control.behavior.ListViewBehavior.callActionForEvent(ListViewBehavior.java:213)
      at com.sun.javafx.scene.control.behavior.BehaviorBase.lambda$new$0(BehaviorBase.java:135)
      at com.sun.javafx.scene.control.behavior.BehaviorBase$$Lambda$142/20609633.handle(Unknown Source)
      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.EventUtil.fireEventImpl(EventUtil.java:74)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
      at javafx.stage.PopupWindow$PopupEventRedirector.handleKeyEvent(PopupWindow.java:987)
      at javafx.stage.PopupWindow$PopupEventRedirector.handleRedirectedEvent(PopupWindow.java:959)
      at com.sun.javafx.event.EventRedirector.dispatchCapturingEvent(EventRedirector.java:106)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchCapturingEvent(CompositeEventDispatcher.java:43)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:52)
      at com.sun.javafx.event.EventRedirector.redirectEvent(EventRedirector.java:124)
      at com.sun.javafx.event.EventRedirector.dispatchCapturingEvent(EventRedirector.java:103)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchCapturingEvent(CompositeEventDispatcher.java:43)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:52)
      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$KeyHandler.process(Scene.java:3935)
      at javafx.scene.Scene$KeyHandler.access$1800(Scene.java:3881)
      at javafx.scene.Scene.impl_processKeyEvent(Scene.java:2010)
      at javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:2472)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:197)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:147)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleKeyEvent$2(GlassViewEventHandler.java:228)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$$Lambda$283/11883254.get(Unknown Source)
      at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:404)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(GlassViewEventHandler.java:227)
      at com.sun.glass.ui.View.handleKeyEvent(View.java:546)
      at com.sun.glass.ui.View.notifyKey(View.java:956)
      at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
      at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:101)
      at com.sun.glass.ui.win.WinApplication$$Lambda$38/5081178.run(Unknown Source)
      at java.lang.Thread.run(Thread.java:745)

            jgiles Jonathan Giles
            jgiles Jonathan Giles
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: