Project: SWT
Bug 120573 [implementation] IllegalArgumentException in StyledText
Reported: 2005-12-13 09:57:13 | Status: resolved fixed

I get IllegalArgumentExceptions from StyledText. I got a couple of them while running org.eclipse.ui.tests.multieditor.MultiEditorTest (see Test Exception). I used CTRL+SHIFT+T(x2) to go to the java file, and received one in the error log (see Error Log Exception). Test Exception: org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.IllegalArgumentException: Index out of bounds) at org.eclipse.swt.SWT.error(SWT.java:3283) at org.eclipse.swt.SWT.error(SWT.java:3206) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:126) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3037) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2751) at org.eclipse.ui.tests.util.UITestCase.processEvents(UITestCase.java:222) at org.eclipse.ui.tests.util.UITestCase.doTearDown(UITestCase.java:214) at org.eclipse.ui.tests.util.UITestCase.tearDown(UITestCase.java:203) at junit.framework.TestCase.runBare(TestCase.java:130) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:57) at org.eclipse.pde.internal.junit.runtime.UITestApplication$1.run(UITestApplication.java:105) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3037) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2751) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1762) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1726) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:397) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:106) at org.eclipse.pde.internal.junit.runtime.UITestApplication.run(UITestApplication.java:45) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:109) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:379) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:338) at org.eclipse.core.launcher.Main.basicRun(Main.java:282) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952) Caused by: java.lang.IllegalArgumentException: Index out of bounds at org.eclipse.swt.SWT.error(SWT.java:3267) at org.eclipse.swt.SWT.error(SWT.java:3206) at org.eclipse.swt.SWT.error(SWT.java:3177) at org.eclipse.swt.custom.StyledText.getOffsetAtLine(StyledText.java:3712) at org.eclipse.jface.internal.text.MigrationHelper.getBottomIndex(MigrationHelper.java:208) at org.eclipse.jface.text.source.AnnotationRulerColumn.getExclusiveBottomIndexEndOffset(AnnotationRulerColumn.java:548) at org.eclipse.jface.text.source.AnnotationRulerColumn.doPaint1(AnnotationRulerColumn.java:692) at org.eclipse.jface.text.source.AnnotationRulerColumn.doubleBufferPaint(AnnotationRulerColumn.java:511) at org.eclipse.jface.text.source.AnnotationRulerColumn.redraw(AnnotationRulerColumn.java:788) at org.eclipse.jface.text.source.AnnotationRulerColumn$6.run(AnnotationRulerColumn.java:775) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123) ... 43 more Error Log Exception: Error 2005-12-13 09:51:28.483 Unable to create editor ID org.eclipse.jdt.ui.CompilationUnitEditor: Index out of bounds java.lang.IllegalArgumentException: Index out of bounds at org.eclipse.swt.SWT.error(SWT.java:3267) at org.eclipse.swt.SWT.error(SWT.java:3206) at org.eclipse.swt.SWT.error(SWT.java:3177) at org.eclipse.swt.custom.StyledText.getOffsetAtLine(StyledText.java:3712) at org.eclipse.jface.internal.text.MigrationHelper.getBottomIndex(MigrationHelper.java:208) at org.eclipse.jface.text.source.AnnotationPainter.getExclusiveBottomIndexEndOffset(AnnotationPainter.java:1124) at org.eclipse.jface.text.source.AnnotationPainter.computeClippingRegion(AnnotationPainter.java:1252) at org.eclipse.jface.text.source.AnnotationPainter.handleDrawRequest(AnnotationPainter.java:1159) at org.eclipse.jface.text.source.AnnotationPainter.enablePainting(AnnotationPainter.java:355) at org.eclipse.jface.text.source.AnnotationPainter.updatePainting(AnnotationPainter.java:790) at org.eclipse.jface.text.source.AnnotationPainter.paint(AnnotationPainter.java:1434) at org.eclipse.ui.texteditor.SourceViewerDecorationSupport.updateAnnotationPainter(SourceViewerDecorationSupport.java:865) at org.eclipse.ui.texteditor.SourceViewerDecorationSupport.updateTextDecorations(SourceViewerDecorationSupport.java:345) at org.eclipse.ui.texteditor.SourceViewerDecorationSupport.install(SourceViewerDecorationSupport.java:303) at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.createPartControl(AbstractDecoratedTextEditor.java:343) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.createPartControl(JavaEditor.java:2641) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.createPartControl(CompilationUnitEditor.java:1660) at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:598) at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:374) at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:552) at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:285) at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:140) at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:264) at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65) at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:394) at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1140) at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1093) at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1312) at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1278) at org.eclipse.ui.internal.PartStack.add(PartStack.java:453) at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:101) at org.eclipse.ui.internal.PartStack.add(PartStack.java:440) at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:110) at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:60) at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:214) at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:204) at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:764) at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:671) at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:634) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2381) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2316) at org.eclipse.ui.internal.WorkbenchPage.access$10(WorkbenchPage.java:2308) at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.java:2294) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2289) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2274) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:266) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:143) at org.eclipse.jdt.internal.ui.actions.OpenTypeAction.run(OpenTypeAction.java:65) at org.eclipse.jdt.internal.ui.actions.OpenTypeAction.run(OpenTypeAction.java:78) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251) at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:223) at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:117) at org.eclipse.core.commands.Command.execute(Command.java:306) at org.eclipse.core.commands.ParameterizedCommand.execute(ParameterizedCommand.java:401) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:461) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:786) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:833) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:555) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:498) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:118) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:888) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:775) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:797) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:783) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:889) at org.eclipse.swt.widgets.Widget.XKeyPress(Widget.java:1117) at org.eclipse.swt.widgets.Composite.XKeyPress(Composite.java:1300) at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1063) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3640) at org.eclipse.swt.internal.motif.OS._XtDispatchEvent(Native Method) at org.eclipse.swt.internal.motif.OS.XtDispatchEvent(OS.java:3854) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2744) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1762) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1726) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:397) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:106) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:109) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:379) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:338) at org.eclipse.core.launcher.Main.basicRun(Main.java:282) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952) Session Data: eclipse.buildId=I20051213-0010 java.version=1.4.2_09 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=solaris, ARCH=sparc, WS=motif, NL=en_CA Command-line arguments: -os solaris -ws motif -arch sparc PW

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java