kasemir / org.csstudio.display.builder

Update of org.csstudio.opibuilder.*
Eclipse Public License 1.0
2 stars 10 forks source link

Table widget causes Node.processCSS() .. IndexOutOfBoundsException #245

Open kasemir opened 7 years ago

kasemir commented 7 years ago

In examples/issues/table_CSS_IndexOutOfBounds.bob, changing the 'headers' of a table at runtime can result in this type of stack trace:

Exception in thread "JavaFX Application Thread" java.lang.IndexOutOfBoundsException:
 Index: 16, Size: 16
 at java.util.ArrayList.rangeCheck(ArrayList.java:653)
 at java.util.ArrayList.get(ArrayList.java:429)
 at com.sun.javafx.collections.ObservableListWrapper.get(ObservableListWrapper.java:89)
 at com.sun.javafx.collections.VetoableListDecorator.get(VetoableListDecorator.java:306)
 at javafx.scene.Node.processCSS(Node.java:9051)

Setting a breakpoint in the ArrayList.rangeCheck shows that it's called by this code in Node.processCSS:

    List<Node> children = me.getChildren();
    for (int i=0, max=children.size(); i<max; i++) {
        children.get(i).processCSS();

Unclear how the problem arises, because i should stay below max == children.size(). Unclear what code would modify the 'children' (table rows) list while the loop is running.

The error can be avoided by removing the call to StringTable.setColumnOptions in the TableRepresentation (but then you can no longer use anything but text editors for cells).

The error can sometimes be avoided by making the table a little smaller, i.e. reducing the number of visible rows.

The table still "works", so in practice this is a nuisance message.

kasemir commented 7 years ago

Still happening.