Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 80229

Summary: AIOB exception with fixed width console
Product: [Eclipse Project] Platform Reporter: Darin Wright <darin.eclipse>
Component: DebugAssignee: Darin Wright <darin.eclipse>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: cocoakevin, dejan
Version: 3.1   
Target Milestone: 3.1 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Darin Wright CLA 2004-12-05 20:00:50 EST
With a fixed width console, and the following program, I get this exception:

org.eclipse.swt.SWTException: Failed to execute runnable 
(java.lang.ArrayIndexOutOfBoundsException: 394)
	at org.eclipse.swt.SWT.error(SWT.java:2784)
	at org.eclipse.swt.SWT.error(SWT.java(Inlined Compiled Code))
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages
(Synchronizer.java(Compiled Code))
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java
(Inlined Compiled Code))
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java
(Compiled Code))
	at org.eclipse.jdt.debug.tests.DebugSuite.run(DebugSuite.java(Compiled 
Code))
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
(RemoteTestRunner.java:431)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
(RemoteTestRunner.java:313)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main
(RemotePluginTestRunner.java:30)
	at org.eclipse.pde.internal.junit.runtime.UITestApplication$1.run
(UITestApplication.java:92)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages
(Synchronizer.java:118)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:2780)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2451)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1579)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1550)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench
(Workbench.java:282)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144)
	at org.eclipse.ui.internal.ide.IDEApplication.run
(IDEApplication.java:102)
	at org.eclipse.pde.internal.junit.runtime.UITestApplication.run
(UITestApplication.java:33)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run
(PlatformActivator.java:220)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run
(EclipseStarter.java:273)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run
(EclipseStarter.java:129)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:85)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:58)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:60)
	at java.lang.reflect.Method.invoke(Method.java:391)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
	at org.eclipse.core.launcher.Main.run(Main.java:684)
	at org.eclipse.core.launcher.Main.main(Main.java:668)
*** Stack trace of contained exception ***
java.lang.ArrayIndexOutOfBoundsException: 394
	at org.eclipse.swt.custom.DefaultLineStyler.linesChanging
(DefaultLineStyler.java(Compiled Code))
	at org.eclipse.swt.custom.DefaultLineStyler.textChanging
(DefaultLineStyler.java:499)
	at org.eclipse.swt.custom.StyledText.handleTextChanging
(StyledText.java:5240)
	at org.eclipse.swt.custom.StyledText$6.textChanging
(StyledText.java:4710)
	at 
org.eclipse.ui.internal.console.ConsoleDocumentAdapter.documentAboutToBeChanged
(ConsoleDocumentAdapter.java:299)
	at org.eclipse.jface.text.AbstractDocument.fireDocumentAboutToBeChanged
(AbstractDocument.java(Compiled Code))
	at org.eclipse.jface.text.AbstractDocument.replace
(AbstractDocument.java:1025)
	at org.eclipse.ui.internal.console.ConsoleDocument.replace
(ConsoleDocument.java:83)
	at org.eclipse.ui.internal.console.IOConsolePartitioner$1.run
(IOConsolePartitioner.java:521)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java(Inlined 
Compiled Code))
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages
(Synchronizer.java(Compiled Code))
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java
(Inlined Compiled Code))
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java
(Compiled Code))
	at org.eclipse.jdt.debug.tests.DebugSuite.run(DebugSuite.java(Compiled 
Code))
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
(RemoteTestRunner.java:431)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
(RemoteTestRunner.java:313)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main
(RemotePluginTestRunner.java:30)
	at org.eclipse.pde.internal.junit.runtime.UITestApplication$1.run
(UITestApplication.java:92)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages
(Synchronizer.java:118)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:2780)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2451)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1579)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1550)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench
(Workbench.java:282)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144)
	at org.eclipse.ui.internal.ide.IDEApplication.run
(IDEApplication.java:102)
	at org.eclipse.pde.internal.junit.runtime.UITestApplication.run
(UITestApplication.java:33)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run
(PlatformActivator.java:220)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run
(EclipseStarter.java:273)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run
(EclipseStarter.java:129)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:85)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:58)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:60)
	at java.lang.reflect.Method.invoke(Method.java:391)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
	at org.eclipse.core.launcher.Main.run(Main.java:684)
	at org.eclipse.core.launcher.Main.main(Main.java:668)
Comment 1 Darin Wright CLA 2004-12-05 20:01:35 EST
Program: use pgm agrs of 2500 or 25000


public class ConsoleVariableLineLength {
	
	public static void main(String[] args) {
		int repeat = Integer.parseInt(args[0]);
		System.out.println("---- START ----");
	    for (int i = 0; i < repeat; i++) {
	        System.out.println("---------1---------2---------3---------4---
------5---------6");
	        System.out.println("---------1---------2---------3---------4---
------5---------6---------7---------8");
	        System.out.println("---------1---------2---------3---------4---
------5---------6---------7---------8-");
	        System.out.println("---------1---------2---------3---------4---
------5---------6---------7---------8---------9");
	    }
	    System.out.println("---- END ----");
	}

}
Comment 2 Kevin Barnes CLA 2004-12-08 13:02:47 EST
Fixed in ConsoleDocumentAdapter.
There was a couple problems... The regular expression used to separate lines was wrong, repairLines(..) 
was creating some bogus regions, countLines(...) didn't work properly only partly because of the regex 
problem
Comment 3 Kevin Barnes CLA 2004-12-08 13:03:07 EST
please verify
Comment 4 Darin Swanson CLA 2004-12-08 20:38:25 EST
*** Bug 80532 has been marked as a duplicate of this bug. ***
Comment 5 Darin Wright CLA 2004-12-10 14:10:54 EST
Verified.