java.lang.IndexOutOfBoundsException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • FULL PRODUCT VERSION : java version "1.8.0_102" Java(TM) SE Runtime Environment (build 1.8.0_102-b14) Java HotSpot(TM) Client VM (build 25.102-b14, mixed mode) ADDITIONAL OS VERSION INFORMATION : Microsoft Windows [version 10.0.10586] A DESCRIPTION OF THE PROBLEM : Call of TreeItem getchildren() during column sort cause Exception. tree.getSelectionModel().getSelectedItems().addListener((ListChangeListener.Change<? extends TreeItem<Map<String, Object>>> c) -> { while (c.next()) { if (c.wasAdded()) { System.out.println("bug : " + c.getAddedSubList()); c.getAddedSubList().forEach((item) -> System.out.println("bug origin: " + item.getChildren())); } } }); add a listchangelistener to the selecteditems and call getchildren on a treeitem in the listener STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : With the application provided select Europe and sort region column ERROR MESSAGES/STACK TRACES THAT OCCUR : Exception in thread "JavaFX Application Thread" java.lang.IndexOutOfBoundsException at com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.subList(ReadOnlyUnbackedObservableList.java:136) at javafx.collections.ListChangeListener$Change.getAddedSubList(ListChangeListener.java:242) at tableview.TreeTableViewDragAndDropDemo1.lambda$start$1(TreeTableViewDragAndDropDemo1.java:38) REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- public class TreeTableViewSelectedItemsDemo extends Application { private TreeItem<Map<String, Object>> root; private TreeTableView<Map<String, Object>> tree; @Override public void start(Stage primaryStage) throws Exception { VBox outer = new VBox(); root = new TreeItem<>(); tree = new TreeTableView<>(root); tree.setShowRoot(false); tree.setRowFactory(this::rowFactory); addColumn("Region", "region"); addColumn("Type", "type"); addColumn("Pop.", "population"); setupData(); tree.getSelectionModel().getSelectedItems().addListener((ListChangeListener.Change<? extends TreeItem<Map<String, Object>>> c) -> { while (c.next()) { if (c.wasAdded()) { System.out.println("bug : " + c.getAddedSubList()); c.getAddedSubList().forEach((item) -> System.out.println("bug origin: " + item.getChildren())); } } }); outer.getChildren().addAll(tree); Scene scene = new Scene(outer, 640, 480); primaryStage.setScene(scene); primaryStage.show(); } private TreeTableRow<Map<String, Object>> rowFactory(TreeTableView<Map<String, Object>> view) { TreeTableRow<Map<String, Object>> row = new TreeTableRow<>(); return row; } private void setupData() { TreeItem<Map<String, Object>> europe = createItem(root, "Europe", "continent", 742500000L); TreeItem<Map<String, Object>> austria = createItem(europe, "Austria", "country", 847400L); createItem(austria, "Tyrol", "state", 728537L); createItem(europe, "Russia ", "country", 144031000); createItem(europe, "Germany ", "country", 81276000); createItem(europe, "Turkey ", "country", 78214000); createItem(europe, "France ", "country", 67063000); createItem(europe, "Italy ", "country", 60963000); createItem(europe, "Spain ", "country", 46335000); createItem(europe, "Ukraine ", "country", 42850000); createItem(europe, "Poland ", "country", 38494000); createItem(europe, "Romania ", "country", 19822000); createItem(europe, "Kazakhstan ", "country", 17543000); createItem(europe, "Netherlands ", "country", 16933000); createItem(europe, "Belgium ", "country", 11259000); createItem(europe, "Greece ", "country", 10769000); createItem(europe, "Portugal ", "country", 10311000); createItem(europe, "Hungary ", "country", 9835000); createItem(europe, "Sweden ", "country", 9794000); createItem(europe, "Azerbaijan ", "country", 9651000); createItem(europe, "Belarus ", "country", 9481000); createItem(europe, "Switzerland ", "country", 8265000); createItem(europe, "Bulgaria ", "country", 7185000); createItem(europe, "Serbia ", "country", 7103000); createItem(europe, "Denmark ", "country", 5673000); createItem(europe, "Finland ", "country", 5475000); createItem(europe, "Slovakia ", "country", 5426000); createItem(europe, "Norway ", "country", 5194000); createItem(europe, "Ireland ", "country", 4630000); createItem(europe, "Croatia ", "country", 4230000); createItem(europe, "Bosnia and Georgia ", "country", 3707000); createItem(europe, "Moldova ", "country", 3564000); createItem(europe, "Armenia ", "country", 3010000); createItem(europe, "Lithuania ", "country", 2906000); createItem(europe, "Albania ", "country", 2887000); createItem(europe, "Macedonia ", "country", 2071000); createItem(europe, "Slovenia ", "country", 2065000); createItem(europe, "Latvia ", "country", 1979000); createItem(europe, "Kosovo ", "country", 1867000); createItem(europe, "Estonia ", "country", 1315000); createItem(europe, "Cyprus ", "country", 876000); createItem(europe, "Montenegro ", "country", 620000); createItem(europe, "Luxembourg ", "country", 570000); createItem(europe, "Transnistria ", "country", 505153); createItem(europe, "Malta ", "country", 425000); createItem(europe, "Iceland ", "country", 331000); createItem(europe, "Jersey (UK) ", "country", 103000); createItem(europe, "Andorra ", "country", 78000); createItem(europe, "Guernsey (UK) ", "country", 66000); createItem(europe, "Liechtenstein ", "country", 37000); createItem(europe, "Monaco ", "country", 37000); TreeItem<Map<String, Object>> america = createItem(root, "America", "continent", 953700000L); createItem(america, "USA", "country", 318900000L); createItem(america, "Mexico", "country", 122300000L); } private TreeItem<Map<String, Object>> createItem(TreeItem<Map<String, Object>> parent, String region, String type, long population) { TreeItem<Map<String, Object>> item = new TreeItem<>(); Map<String, Object> value = new HashMap<>(); value.put("region", region); value.put("type", type); value.put("population", population); item.setValue(value); parent.getChildren().add(item); item.setExpanded(true); return item; } protected void addColumn(String label, String dataIndex) { TreeTableColumn<Map<String, Object>, String> column = new TreeTableColumn<>(label); column.setPrefWidth(150); column.setCellValueFactory( (TreeTableColumn.CellDataFeatures<Map<String, Object>, String> param) -> { ObservableValue<String> result = new ReadOnlyStringWrapper(""); if (param.getValue().getValue() != null) { result = new ReadOnlyStringWrapper("" + param.getValue().getValue().get(dataIndex)); } return result; } ); tree.getColumns().add(column); } public static void main(String[] args) { launch(args); } } ---------- END SOURCE ----------
    via by Webbug Group,
  • JavaFx8 Tableview updating ObservableList
    via by Unknown author,
  • ComboBox selectionModel error
    via Stack Overflow by Rolandas Janulis
    ,
  • removing items from combo boxe in java 8
    via Stack Overflow by Ionterac
    ,
  • 1. open hello.HTMLEditor 2. enter some text (at least 3 lines) 3. Select all --> "Paragraph" --> "Heading " Used javafx build "329" (Sanity testing, non-jigsaw mode) ----- HelloHTMLEditor ----- java -ea -DproxyHost=www-proxy.us.oracle.com -DproxyPort=80 -cp D:\ws\jdk9\ea109\jdk-9/lib/jfxrt.jar;dist/Hello.jar hello.HelloHTMLEditor Exception in thread "JavaFX Application Thread" java.lang.IndexOutOfBoundsException at com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.subList(ReadOnlyUnbackedObservableList.java:136) at javafx.collections.ListChangeListener$Change.getAddedSubList(ListChangeListener.java:242) at com.sun.javafx.scene.control.behavior.ListViewBehavior.lambda$new$55(ListViewBehavior.java:281) at javafx.collections.WeakListChangeListener.onChanged(WeakListChangeListener.java:88) at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:329) at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73) at com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.callObservers(ReadOnlyUnbackedObservableList.java:75) at javafx.scene.control.MultipleSelectionModelBase.clearAndSelect(MultipleSelectionModelBase.java:422) at javafx.scene.control.ListView$ListViewBitSetSelectionModel.clearAndSelect(ListView.java:1403) at com.sun.javafx.scene.control.behavior.CellBehaviorBase.simpleSelect(CellBehaviorBase.java:281) at com.sun.javafx.scene.control.behavior.CellBehaviorBase.doSelect(CellBehaviorBase.java:245) at com.sun.javafx.scene.control.behavior.CellBehaviorBase.mousePressed(CellBehaviorBase.java:175) at com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274) 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.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:3894) at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3622) at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1883) at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2631) at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:353) at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:275) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:389) at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:388) at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:388) at com.sun.glass.ui.View.handleMouseEvent(View.java:555) 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:189) at java.lang.Thread.run(Thread.java:804)
    via by Guru Hb,
    • java.lang.IndexOutOfBoundsException at com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.subList(ReadOnlyUnbackedObservableList.java:136) at javafx.collections.ListChangeListener$Change.getAddedSubList(ListChangeListener.java:242) at tableview.TreeTableViewDragAndDropDemo1.lambda$start$1(TreeTableViewDragAndDropDemo1.java:38)

    Users with the same issue

    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor2 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,