Community
Participate
Working Groups
This bug occurs due to the selection not getting cleared/checked internally prior to a submethod call is made. To reproduce, simply follow this: 1. Have some items in a table, select an item (or a cell) 2. Call removeAll() on the table through an action or menu, etc. (at this point the selection is still in memory internally in the Grid) 3. Have a mouseDownListener on the table (easiest) and call table.getSelection(). 4. Exception is thrown: java.lang.IllegalArgumentException: Index out of bounds at org.eclipse.swt.SWT.error(SWT.java:3547) at org.eclipse.swt.SWT.error(SWT.java:3481) at org.eclipse.swt.SWT.error(SWT.java:3452) at org.eclipse.nebula.widgets.grid.Grid.getItem(Grid.java:1636) at org.eclipse.nebula.widgets.grid.Grid.getSelection(Grid.java:2161) Suggested fix: 1. getSelection() in Grid.java should make a check to see how many items there are in the table before trying to call getItem(...). If table item list size is zero then the selection is obviously not valid. 2. It seems removeAll() should clear selection on the table as well, however; I'm not sure if the intention is to preserve selection despite an empty table, if so, at least a check to ignore an out of bounds selection should be made prior to calling getItem() so that no exception is thrown. Workaround: Create your own clear() method between your code and the table, in that method, call table.deselectAll() prior to calling removeAll().
This still seems to be a problem
Released changes to prevent the Exception to CVS >= 20100402. Thanks Emil for the investigation and Jake for the heads up.