Project: JDT
Bug 48360 ArrayIndexOutOfBoundsException when using escape key [reorg]
Reported: 2003-12-09 15:32:51 | Status: resolved fixed

Using 1209, I got the following stack trace when trying to use Ctrl + C for copying and then cancelling it with the escape key. STEPS TO REPRODUCE: 1) Select a folder 2) Copy it in a folder that already contains a folder with the same name 3) You get a dialog asking if you want to override the existing file 4) Cancel it using the Esc key. 5) You get the exception. If you use the cancel button, it works fine. java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:313) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:252) at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:394) at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper.perform(RefactoringExecutionHelper.java:131) at org.eclipse.jdt.internal.ui.refactoring.reorg.ReorgCopyStarter.run(ReorgCopyStarter.java:70) at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction$JavaElementAndResourcePaster.paste(PasteAction.java:404) at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction.run(PasteAction.java:189) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:194) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:172) at org.eclipse.jface.action.Action.runWithEvent(Action.java:842) at org.eclipse.ui.actions.RetargetAction.runWithEvent(RetargetAction.java:212) at org.eclipse.ui.internal.commands.ActionHandler.execute(ActionHandler.java:40) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:341) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:673) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:711) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:410) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$0(WorkbenchKeyboard.java:372) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$1.handleEvent(WorkbenchKeyboard.java:205) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:692) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:846) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:871) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:856) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1716) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1712) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3036) at org.eclipse.swt.widgets.Tree.WM_CHAR(Tree.java:1292) at org.eclipse.swt.widgets.Control.windowProc(Control.java:2939) at org.eclipse.swt.widgets.Display.windowProc(Display.java:2819) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1368) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1973) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1537) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1513) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:242) 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:242) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:84) 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.internal.boot.OSGiBootLoader.basicRun(OSGiBootLoader.java:239) at org.eclipse.core.internal.boot.OSGiBootLoader.run(OSGiBootLoader.java:665) at org.eclipse.core.internal.boot.OSGiBootLoader.run(OSGiBootLoader.java:652) 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:299) at org.eclipse.core.launcher.Main.run(Main.java:767) at org.eclipse.core.launcher.Main.main(Main.java:601) Caused by: java.lang.ArrayIndexOutOfBoundsException: -1 at org.eclipse.jdt.internal.ui.refactoring.reorg.ReorgQueries$1.run(ReorgQueries.java:129) at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:131) at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:25) at org.eclipse.swt.widgets.Display.syncExec(Display.java:2611) at org.eclipse.jdt.internal.ui.refactoring.reorg.ReorgQueries$YesYesToAllNoNoToAllQuery.confirm(ReorgQueries.java:96) at org.eclipse.jdt.internal.corext.refactoring.reorg.OverwriteHelper.overwrite(OverwriteHelper.java:206) at org.eclipse.jdt.internal.corext.refactoring.reorg.OverwriteHelper.overwrite(OverwriteHelper.java:197) at org.eclipse.jdt.internal.corext.refactoring.reorg.OverwriteHelper.confirmFolderOverwritting(OverwriteHelper.java:131) at org.eclipse.jdt.internal.corext.refactoring.reorg.OverwriteHelper.confirmOverwritting(OverwriteHelper.java:99) at org.eclipse.jdt.internal.corext.refactoring.reorg.OverwriteHelper.confirmOverwritting(OverwriteHelper.java:93) at org.eclipse.jdt.internal.corext.refactoring.reorg.ReorgPolicyFactory$FilesFoldersAndCusReorgPolicy.confirmOverwritting(ReorgPolicyFactory.java:470) at org.eclipse.jdt.internal.corext.refactoring.reorg.ReorgPolicyFactory$FilesFoldersAndCusReorgPolicy.checkInput(ReorgPolicyFactory.java:455) at org.eclipse.jdt.internal.corext.refactoring.reorg.CopyRefactoring.checkInput(CopyRefactoring.java:101) at org.eclipse.jdt.internal.corext.refactoring.base.Refactoring.checkPreconditions(Refactoring.java:79) at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper$Operation.run(RefactoringExecutionHelper.java:69) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:302) ... 52 more

Files changed in fix:
org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/ReorgQueries.java