A DESCRIPTION OF THE PROBLEM :
An IndexOutOfBoundsException is thrown when clicking on the track above the thumb of a ScrollBar in ListView that contains only one cell.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
#1 Start the sample program
#2 Make the window smaller so that the scrollbar is visible
#3 Move the thumb of the scrollbar down
#4 Click on the track above the thumb of the scrollbar
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Scrolling is executed without exceptions
ACTUAL -
The following Exceptions are thrown:
Exception in thread "JavaFX Application Thread" java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 1
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
at java.base/java.util.Objects.checkIndex(Objects.java:359)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at javafx.scene.control.skin.VirtualFlow.updateCellSize(VirtualFlow.java:3099)
at javafx.scene.control.skin.VirtualFlow.positionCell(VirtualFlow.java:1975)
at javafx.scene.control.skin.VirtualFlow.scrollPixels(VirtualFlow.java:1650)
at javafx.scene.control.skin.VirtualFlow.tryScrollOneCell(VirtualFlow.java:1565)
at javafx.scene.control.skin.VirtualFlow.scrollTo(VirtualFlow.java:1536)
at com.sun.javafx.scene.control.VirtualScrollBar.adjustValue(VirtualScrollBar.java:142)
at com.sun.javafx.scene.control.behavior.ScrollBarBehavior.lambda$trackPress$12(ScrollBarBehavior.java:162)
at com.sun.javafx.scene.control.behavior.ScrollBarBehavior.trackPress(ScrollBarBehavior.java:173)
at javafx.scene.control.skin.ScrollBarSkin.lambda$initialize$7(ScrollBarSkin.java:411)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:232)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:189)
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 javafx.scene.control.skin.VirtualFlow.lambda$new$2(VirtualFlow.java:369)
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:3984)
at javafx.scene.Scene.processMouseEvent(Scene.java:1890)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2708)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:411)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:301)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:450)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:424)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:449)
at com.sun.glass.ui.View.handleMouseEvent(View.java:551)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:185)
at java.base/java.lang.Thread.run(Thread.java:833)
Exception in thread "JavaFX Application Thread" java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 1
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
at java.base/java.util.Objects.checkIndex(Objects.java:359)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at javafx.scene.control.skin.VirtualFlow.updateCellSize(VirtualFlow.java:3099)
at javafx.scene.control.skin.VirtualFlow.positionCell(VirtualFlow.java:1975)
at javafx.scene.control.skin.VirtualFlow.scrollPixels(VirtualFlow.java:1650)
at javafx.scene.control.skin.VirtualFlow.tryScrollOneCell(VirtualFlow.java:1565)
at javafx.scene.control.skin.VirtualFlow.scrollTo(VirtualFlow.java:1536)
at com.sun.javafx.scene.control.VirtualScrollBar.adjustValue(VirtualScrollBar.java:142)
at com.sun.javafx.scene.control.behavior.ScrollBarBehavior.lambda$trackPress$12(ScrollBarBehavior.java:162)
at com.sun.scenario.animation.shared.TimelineClipCore.visitKeyFrame(TimelineClipCore.java:239)
at com.sun.scenario.animation.shared.TimelineClipCore.playTo(TimelineClipCore.java:180)
at javafx.animation.Timeline.doPlayTo(Timeline.java:172)
at javafx.animation.AnimationAccessorImpl.playTo(AnimationAccessorImpl.java:39)
at com.sun.scenario.animation.shared.InfiniteClipEnvelope.timePulse(InfiniteClipEnvelope.java:104)
at javafx.animation.Animation.doTimePulse(Animation.java:1189)
at javafx.animation.Animation$1.lambda$timePulse$0(Animation.java:207)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at javafx.animation.Animation$1.timePulse(Animation.java:206)
at com.sun.scenario.animation.AbstractPrimaryTimer.timePulseImpl(AbstractPrimaryTimer.java:343)
at com.sun.scenario.animation.AbstractPrimaryTimer$MainLoop.run(AbstractPrimaryTimer.java:266)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:588)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:572)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:565)
at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:352)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run$$$capture(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:185)
at java.base/java.lang.Thread.run(Thread.java:833)
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ListView;
import javafx.stage.Stage;
public class ScrollBug extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) throws Exception {
ListView<String> listView = new ListView<>();
listView.getItems().add("This \n is \n a \n high \n high \n high \n high \n cell");
stage.setScene(new Scene(listView));
stage.show();
}
}
---------- END SOURCE ----------
FREQUENCY : always
An IndexOutOfBoundsException is thrown when clicking on the track above the thumb of a ScrollBar in ListView that contains only one cell.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
#1 Start the sample program
#2 Make the window smaller so that the scrollbar is visible
#3 Move the thumb of the scrollbar down
#4 Click on the track above the thumb of the scrollbar
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Scrolling is executed without exceptions
ACTUAL -
The following Exceptions are thrown:
Exception in thread "JavaFX Application Thread" java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 1
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
at java.base/java.util.Objects.checkIndex(Objects.java:359)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at javafx.scene.control.skin.VirtualFlow.updateCellSize(VirtualFlow.java:3099)
at javafx.scene.control.skin.VirtualFlow.positionCell(VirtualFlow.java:1975)
at javafx.scene.control.skin.VirtualFlow.scrollPixels(VirtualFlow.java:1650)
at javafx.scene.control.skin.VirtualFlow.tryScrollOneCell(VirtualFlow.java:1565)
at javafx.scene.control.skin.VirtualFlow.scrollTo(VirtualFlow.java:1536)
at com.sun.javafx.scene.control.VirtualScrollBar.adjustValue(VirtualScrollBar.java:142)
at com.sun.javafx.scene.control.behavior.ScrollBarBehavior.lambda$trackPress$12(ScrollBarBehavior.java:162)
at com.sun.javafx.scene.control.behavior.ScrollBarBehavior.trackPress(ScrollBarBehavior.java:173)
at javafx.scene.control.skin.ScrollBarSkin.lambda$initialize$7(ScrollBarSkin.java:411)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:232)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:189)
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 javafx.scene.control.skin.VirtualFlow.lambda$new$2(VirtualFlow.java:369)
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:3984)
at javafx.scene.Scene.processMouseEvent(Scene.java:1890)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2708)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:411)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:301)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:450)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:424)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:449)
at com.sun.glass.ui.View.handleMouseEvent(View.java:551)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:185)
at java.base/java.lang.Thread.run(Thread.java:833)
Exception in thread "JavaFX Application Thread" java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 1
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
at java.base/java.util.Objects.checkIndex(Objects.java:359)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at javafx.scene.control.skin.VirtualFlow.updateCellSize(VirtualFlow.java:3099)
at javafx.scene.control.skin.VirtualFlow.positionCell(VirtualFlow.java:1975)
at javafx.scene.control.skin.VirtualFlow.scrollPixels(VirtualFlow.java:1650)
at javafx.scene.control.skin.VirtualFlow.tryScrollOneCell(VirtualFlow.java:1565)
at javafx.scene.control.skin.VirtualFlow.scrollTo(VirtualFlow.java:1536)
at com.sun.javafx.scene.control.VirtualScrollBar.adjustValue(VirtualScrollBar.java:142)
at com.sun.javafx.scene.control.behavior.ScrollBarBehavior.lambda$trackPress$12(ScrollBarBehavior.java:162)
at com.sun.scenario.animation.shared.TimelineClipCore.visitKeyFrame(TimelineClipCore.java:239)
at com.sun.scenario.animation.shared.TimelineClipCore.playTo(TimelineClipCore.java:180)
at javafx.animation.Timeline.doPlayTo(Timeline.java:172)
at javafx.animation.AnimationAccessorImpl.playTo(AnimationAccessorImpl.java:39)
at com.sun.scenario.animation.shared.InfiniteClipEnvelope.timePulse(InfiniteClipEnvelope.java:104)
at javafx.animation.Animation.doTimePulse(Animation.java:1189)
at javafx.animation.Animation$1.lambda$timePulse$0(Animation.java:207)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at javafx.animation.Animation$1.timePulse(Animation.java:206)
at com.sun.scenario.animation.AbstractPrimaryTimer.timePulseImpl(AbstractPrimaryTimer.java:343)
at com.sun.scenario.animation.AbstractPrimaryTimer$MainLoop.run(AbstractPrimaryTimer.java:266)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:588)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:572)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:565)
at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:352)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run$$$capture(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:185)
at java.base/java.lang.Thread.run(Thread.java:833)
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ListView;
import javafx.stage.Stage;
public class ScrollBug extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) throws Exception {
ListView<String> listView = new ListView<>();
listView.getItems().add("This \n is \n a \n high \n high \n high \n high \n cell");
stage.setScene(new Scene(listView));
stage.show();
}
}
---------- END SOURCE ----------
FREQUENCY : always
- duplicates
-
JDK-8311983 ListView sometimes throws an IndexOutOfBoundsException
- Resolved
- relates to
-
JDK-8311983 ListView sometimes throws an IndexOutOfBoundsException
- Resolved