Project: SWT
Bug 97686 AIOOB when removing non-existent TableItem by index
Reported: 2005-05-31 15:33:37 | Status: resolved fixed

3.1RC1 - run the snippet below, you'll get the exception that follows - it's because the bounds check in Table.remove(int) should change from: if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_ITEM_NOT_REMOVED); to if (!(0 <= index && index < itemCount)) error (SWT.ERROR_ITEM_NOT_REMOVED); snippet: public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.setBounds(10,10,400,400); Table table = new Table(shell, SWT.NONE); table.setBounds(10,10,300,300); shell.open(); table.remove(0); // <---- while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } exception: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException at java.lang.System.arraycopy(Native Method) at org.eclipse.swt.widgets.Table.remove(Table.java:1823) at win32.Main.main(Main.java:20)

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java