Project: SWT
Bug 134382 TableColumn: StringIndexOutOfBoundsException
Reported: 2006-04-01 16:30:54 | Status: resolved fixed

SWT Motif CVS Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 11 at java.lang.String.substring(String.java:1441) at org.eclipse.swt.widgets.TableColumn.computeDisplayText(TableColumn.java:207) at org.eclipse.swt.widgets.TableColumn.setSortDirection(TableColumn.java:651) at org.eclipse.swt.widgets.Table.setSortColumn(Table.java:3491) -- OR -- Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String ind ex out of range: 11 at java.lang.String.substring(String.java:1441) at org.eclipse.swt.widgets.TableColumn.computeDisplayText(TableColumn.ja va:207) at org.eclipse.swt.widgets.TableColumn.updateWidth(TableColumn.java:703) at org.eclipse.swt.widgets.Table.updateColumnWidth(Table.java:3792) at org.eclipse.swt.widgets.TableColumn.setWidth(TableColumn.java:693) ---- public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new FillLayout()); final Table table = new Table(shell, SWT.VIRTUAL | SWT.FULL_SELECTION | SWT.MULTI); final int columns = 11; for (int i = 0; i < columns; i++) { TableColumn tc = new TableColumn(table, SWT.LEFT); tc.setText("Directory"); tc.setWidth(137); } table.setHeaderVisible(true); table.setLinesVisible(true); table.setSortDirection(SWT.DOWN); table.setSortColumn(table.getColumn(0)); shell.setSize(350, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/TableColumn.java bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/TreeColumn.java