Project: JDT
Bug 224399 [create on paste] IAE when pasting string into empty Package Explorer
Reported: 2008-03-27 11:34:34 | Status: verified fixed

I20080326-1950 Paste FRIDAY into PE with empty selection: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:420) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:347) 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:2455) at org.eclipse.ui.internal.progress.ProgressManager$5.run(ProgressManager.java:1217) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.ui.internal.progress.ProgressManager.runInUI(ProgressManager.java:1210) at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction$TextPaster.paste(PasteAction.java:952) at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction.run(PasteAction.java:244) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:268) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:244) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:119) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508) at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:471) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:822) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:880) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:569) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:511) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:126) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:83) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1160) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1001) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1026) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1011) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1039) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1035) at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1351) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3888) at org.eclipse.swt.widgets.Tree.WM_CHAR(Tree.java:5631) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3781) at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:5627) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4473) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2339) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3370) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2375) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2339) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2205) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:478) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:473) 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:193) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:362) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:175) 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:585) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504) at org.eclipse.equinox.launcher.Main.run(Main.java:1236) at org.eclipse.equinox.launcher.Main.main(Main.java:1212) at org.eclipse.core.launcher.Main.main(Main.java:30) Caused by: java.lang.IllegalArgumentException at org.eclipse.jdt.core.dom.rewrite.ASTRewrite.createStringPlaceholder(ASTRewrite.java:559) at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction$1.createOrFillTypeDeclaration(PasteAction.java:796) at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction$1.pasteBodyDeclsOrStatements(PasteAction.java:742) at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction$1.pasteCU(PasteAction.java:683) at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction$1.access$1(PasteAction.java:627) at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction$2.run(PasteAction.java:609) at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39) at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:709) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4658) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4615) at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction$1.run(PasteAction.java:596) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:407) ... 61 more Root exception: java.lang.IllegalArgumentException at org.eclipse.jdt.core.dom.rewrite.ASTRewrite.createStringPlaceholder(ASTRewrite.java:559) at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction$1.createOrFillTypeDeclaration(PasteAction.java:796) at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction$1.pasteBodyDeclsOrStatements(PasteAction.java:742) at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction$1.pasteCU(PasteAction.java:683) at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction$1.access$1(PasteAction.java:627) at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction$2.run(PasteAction.java:609) at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39) at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:709) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4658) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4615) at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction$1.run(PasteAction.java:596) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:407) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:347) 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:2455) at org.eclipse.ui.internal.progress.ProgressManager$5.run(ProgressManager.java:1217) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.ui.internal.progress.ProgressManager.runInUI(ProgressManager.java:1210) at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction$TextPaster.paste(PasteAction.java:952) at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction.run(PasteAction.java:244) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:268) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:244) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:119) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508) at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:471) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:822) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:880) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:569) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:511) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:126) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:83) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1160) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1001) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1026) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1011) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1039) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1035) at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1351) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3888) at org.eclipse.swt.widgets.Tree.WM_CHAR(Tree.java:5631) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3781) at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:5627) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4473) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2339) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3370) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2375) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2339) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2205) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:478) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:473) 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:193) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:362) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:175) 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:585) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504) at org.eclipse.equinox.launcher.Main.run(Main.java:1236) at org.eclipse.equinox.launcher.Main.main(Main.java:1212) at org.eclipse.core.launcher.Main.main(Main.java:30) Trying to paste: enum Day {SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY}; Results in a dialog telling my that paste is not possible. No idea why.

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