Community
Participate
Working Groups
Build: I=20040127 I selected the following text to format it and got the exception pasted below: launch.setAttribute(ILauncherSettings.CONFIG_LOCATION, fConfigFile.isDirectory()) ? fConfigFile.getPath() : fConfigFile.getParent()); Error Jan 27, 2004 22:22:12.95 String index out of range: 5 java.lang.StringIndexOutOfBoundsException: String index out of range: 5 at java.lang.String.charAt(Unknown Source) at org.eclipse.jdt.internal.formatter.Scribe.isValidEdit (Scribe.java:488) at org.eclipse.jdt.internal.formatter.Scribe.getRootEdit (Scribe.java:413) at org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.format (CodeFormatterVisitor.java:735) at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.formatCompilationUnit (DefaultCodeFormatter.java:115) at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.format (DefaultCodeFormatter.java:82) at org.eclipse.jdt.internal.corext.util.CodeFormatterUtil.format2 (CodeFormatterUtil.java:147) at org.eclipse.jdt.internal.corext.util.CodeFormatterUtil.format (CodeFormatterUtil.java:74) at org.eclipse.jdt.internal.ui.text.java.JavaFormattingStrategy.format (JavaFormattingStrategy.java:95) at org.eclipse.jface.text.formatter.ContentFormatter2.format (ContentFormatter2.java:806) at org.eclipse.jface.text.formatter.ContentFormatter2.formatRegion (ContentFormatter2.java:635) at org.eclipse.jface.text.formatter.ContentFormatter2.format (ContentFormatter2.java:482) at org.eclipse.jface.text.source.SourceViewer.doOperation (SourceViewer.java:668) at org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer.doOperation (JavaSourceViewer.java:124) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewe r.doOperation(CompilationUnitEditor.java:187) at org.eclipse.ui.texteditor.TextOperationAction$1.run (TextOperationAction.java:122) at org.eclipse.swt.custom.BusyIndicator.showWhile (BusyIndicator.java:84) at org.eclipse.ui.texteditor.TextOperationAction.run (TextOperationAction.java:120) at org.eclipse.jface.action.Action.runWithEvent(Action.java:881) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:536) at org.eclipse.jface.action.ActionContributionItem.access$2 (ActionContributionItem.java:488) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent (ActionContributionItem.java:420) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2340) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2021) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1530) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1506) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench (Workbench.java:265) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:139) at org.eclipse.ui.internal.ide.IDEApplication.run (IDEApplication.java:47) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:221) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:101) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.core.launcher.Main.basicRun(Main.java:279) at org.eclipse.core.launcher.Main.run(Main.java:742) at org.eclipse.core.launcher.Main.main(Main.java:581)
I will investigate.
Could you please provide the whole compilation unit and let me know what you selected exactly? I need to build up a reproducable test case to be sure that the problem is fixed. Thanks.
Change milestone.
org.eclipse.pde.internal.ui.launcher.JUnitLaunchConfiguration.launch() By the way, this out of bounds exception happened to me about 30 times yesterday, using several different compilation units. This was one of them.
I am working on a fix.
I reproduced the problem. Should be fixed shortly.
Fixed and released in HEAD. Regression test added.
Verified on 200402121200.