Project: JDT
Bug 205308 [clean up] IAE while saving
Reported: 2007-10-03 12:13:17 | Status: verified fixed

I20071002-1342 Got this several times today. I while editing and saving IDocument. !ENTRY org.eclipse.jdt.ui 4 10006 2007-10-03 17:48:13.354 !MESSAGE The save participant 'org.eclipse.jdt.ui.postsavelistener.cleanup' caused an exception: java.lang.IllegalArgumentException: offset or length outside of string. offset: 12333, length: -2, string size: 27222 !ENTRY org.eclipse.jdt.ui 4 2 2007-10-03 17:52:27.079 !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jdt.ui". !STACK 0 java.lang.IllegalArgumentException: offset or length outside of string. offset: 588, length: -2, string size: 27743 at org.eclipse.jdt.internal.corext.util.CodeFormatterUtil.reformat(CodeFormatterUtil.java:285) at org.eclipse.jdt.internal.corext.fix.CodeFormatFix.createCleanUp(CodeFormatFix.java:69) at org.eclipse.jdt.internal.ui.fix.CodeFormatCleanUp.createFix(CodeFormatCleanUp.java:62) at org.eclipse.jdt.internal.corext.fix.CleanUpRefactoring.calculateChange(CleanUpRefactoring.java:769) at org.eclipse.jdt.internal.corext.fix.CleanUpPostSaveListener.saved(CleanUpPostSaveListener.java:271) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider$5.run(CompilationUnitDocumentProvider.java:1502) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.notifyPostSaveListeners(CompilationUnitDocumentProvider.java:1497) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.commitWorkingCopy(CompilationUnitDocumentProvider.java:1294) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider$4.execute(CompilationUnitDocumentProvider.java:1363) at org.eclipse.ui.editors.text.TextFileDocumentProvider$DocumentProviderOperation.run(TextFileDocumentProvider.java:129) at org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation.execute(WorkspaceModifyDelegatingOperation.java:68) at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:104) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1799) at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:116) at org.eclipse.ui.internal.editors.text.WorkspaceOperationRunner.run(WorkspaceOperationRunner.java:73) at org.eclipse.ui.internal.editors.text.WorkspaceOperationRunner.run(WorkspaceOperationRunner.java:63) at org.eclipse.ui.editors.text.TextFileDocumentProvider.executeOperation(TextFileDocumentProvider.java:449) at org.eclipse.ui.editors.text.TextFileDocumentProvider.saveDocument(TextFileDocumentProvider.java:760) at org.eclipse.ui.texteditor.AbstractTextEditor.performSave(AbstractTextEditor.java:4718) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.performSave(CompilationUnitEditor.java:1216) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.doSave(CompilationUnitEditor.java:1269) at org.eclipse.ui.texteditor.AbstractTextEditor$TextEditorSavable.doSave(AbstractTextEditor.java:6783) at org.eclipse.ui.Saveable.doSave(Saveable.java:212) at org.eclipse.ui.internal.SaveableHelper.doSaveModel(SaveableHelper.java:339) at org.eclipse.ui.internal.SaveablesList$4.run(SaveablesList.java:605) at org.eclipse.ui.internal.SaveableHelper$4.run(SaveableHelper.java:266) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:369) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:313) at org.eclipse.jface.window.ApplicationWindow$1.run(ApplicationWindow.java:758) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWindow.java:755) at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2451) at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:274) at org.eclipse.ui.internal.SaveablesList.saveModels(SaveablesList.java:614) at org.eclipse.ui.internal.SaveablesList.promptForSaving(SaveablesList.java:578) at org.eclipse.ui.internal.Workbench.saveAll(Workbench.java:3492) at org.eclipse.ui.ide.IDE$1.run(IDE.java:1152) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.ui.ide.IDE.saveAllEditors(IDE.java:1140) at org.eclipse.team.internal.ccvs.ui.actions.CVSAction$6.run(CVSAction.java:573) at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:169) at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:118) at org.eclipse.swt.widgets.Display.syncExec(Display.java:4167) at org.eclipse.team.internal.ccvs.ui.actions.CVSAction.saveAllEditors(CVSAction.java:568) at org.eclipse.team.internal.ccvs.ui.actions.CVSAction.beginExecution(CVSAction.java:216) at org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction.beginExecution(WorkspaceAction.java:56) at org.eclipse.team.internal.ccvs.ui.actions.CVSAction.run(CVSAction.java:111) at org.eclipse.team.internal.ui.actions.TeamAction.runWithEvent(TeamAction.java:515) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:246) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:543) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:489) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:401) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:947) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3744) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3355) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:174) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176) 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:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:515) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:455) at org.eclipse.equinox.launcher.Main.run(Main.java:1193) at org.eclipse.equinox.launcher.Main.main(Main.java:1169)

Files changed in fix:
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/SaveParticipantTest.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/EditorUtility.java