Community
Participate
Working Groups
Version: 3.1.0 Build id: I20050201-0800 I found the following exception in my eclipse log. No error dialog was displayed. Sorry, but i don' thave any steps to reproduce. I was probably running an external tool at the time. org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.StringIndexOutOfBoundsException: String index out of range: 1620) at org.eclipse.swt.SWT.error(SWT.java:2839) at org.eclipse.swt.SWT.error(SWT.java:2762) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:121) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:2854) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2518) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1585) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1551) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:290) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:227) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:276) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:131) 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.basicRun(Main.java:261) at org.eclipse.core.launcher.Main.run(Main.java:817) at org.eclipse.core.launcher.Main.main(Main.java:801)Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 1620 at java.lang.String.charAt(String.java:444) at java.util.regex.Pattern$Caret.match(Pattern.java:2874) at java.util.regex.Pattern$Start.match(Pattern.java:2814) at java.util.regex.Matcher.find(Matcher.java:722) at java.util.regex.Matcher.find(Matcher.java:414) at org.eclipse.ui.internal.console.ConsoleDocumentAdapter.countLines(ConsoleDocumentAdapter.java:305) at org.eclipse.ui.internal.console.ConsoleDocumentAdapter.documentAboutToBeChanged(ConsoleDocumentAdapter.java:289) at org.eclipse.jface.text.AbstractDocument.fireDocumentAboutToBeChanged(AbstractDocument.java:608) 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:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:118) ... 17 moreFailed to execute runnable (java.lang.StringIndexOutOfBoundsException: String index out of range: 1620)
This looks like bug 77130. Haven't been able to reproduce. The code looks good to me. Possibly a bug in Pattern? What VM are you using?
java version "1.4.2_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)
Test case to show it is a bug in the JDK, although there is possibly a workaround: public class Test84641 { private static Pattern pattern = Pattern.compile("^.*$", Pattern.MULTILINE); //$NON-NLS-1$ public static void main(String[] args) { Matcher matcher = pattern.matcher("\r"); while (matcher.find()) { } } }
Please check for an existing bug against the JDK.
Sun's bug number 4994840 looks like the one. (fixed in 1.5 apparently) http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4994840 This is also an issue on Apple's 1.4.2 VM (and IBM's?). Only work around suggested is to strip \r from the end of strings manually.
The test case in Eclipse is to run the following with console output on: public class CarriageReturn { public static void main(String[] args) { System.out.print("\r"); } }
fixed in ConsoleDocumentAdapter with work around suggested in jdk bug report.
Luc, please verify
*** Bug 84876 has been marked as a duplicate of this bug. ***
Verified.