Bug 50736 - Out of bounds exception while formatting
Summary: Out of bounds exception while formatting
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 3.0 M7   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-27 22:33 EST by Wassim Melhem CLA
Modified: 2004-02-12 15:23 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wassim Melhem CLA 2004-01-27 22:33:17 EST
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)
Comment 1 Olivier Thomann CLA 2004-01-28 11:39:06 EST
I will investigate.
Comment 2 Olivier Thomann CLA 2004-01-28 12:23:34 EST
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.
Comment 3 Olivier Thomann CLA 2004-01-28 12:27:06 EST
Change milestone.
Comment 4 Wassim Melhem CLA 2004-01-28 12:29:16 EST
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.
Comment 5 Olivier Thomann CLA 2004-01-28 12:47:15 EST
I am working on a fix.
Comment 6 Olivier Thomann CLA 2004-01-28 12:57:04 EST
I reproduced the problem. Should be fixed shortly.
Comment 7 Olivier Thomann CLA 2004-01-28 14:26:22 EST
Fixed and released in HEAD.
Regression test added.
Comment 8 Olivier Thomann CLA 2004-02-12 15:23:29 EST
Verified on 200402121200.