Project: JDT
Bug 64418 [refactor] Change method signature causes InvocationTargetException
Reported: 2004-05-27 14:51:37 | Status: verified fixed

Version 3.0.m9. The InvocationTargetException is at the end of this post. I have a method: public void testBigDecimalConverter(BigDecimal expected) throws ModelIOException, ParseException { CobolRecordDefinition rec = this.getTestUtil().getTmDataRecordDefinition(); CobolComp3FieldDefinition data3 = this.getTestUtil().getData3Field(rec); CobolComp3FieldDefinition data4 = this.getTestUtil().getData3Field(rec); CobolRecordBuffer buffer = new CobolRecordBuffer(rec.getLength()); byte[] bytes = buffer.getBuffer(); buffer.setComp3(expected, 0, data3.getItemLength(), data3.getScale(), data3.isSigned()); Assert.assertEquals(expected, buffer.getComp3BigDecimal(0, data3.getItemLength(), data3.getScale())); buffer.setComp3(expected, 4, data4.getItemLength(), data4.getScale(), data4.isSigned()); Assert.assertEquals(expected, buffer.getComp3BigDecimal(0, data3.getItemLength(), data3.getScale())); Assert.assertEquals(expected, buffer.getComp3BigDecimal(4, data4.getItemLength(), data4.getScale())); } I invoke Change Method Signature and add a parameter: boolean dumpBuffer. There are 3 call sites: public void testBigDecimal_88_00_Converter() throws ModelIOException, ParseException { this.testBigDecimalConverter(BigDecimal.valueOf(8800, 2)); } public void testBigDecimalConverter1() throws ModelIOException, ParseException { for (long i = 0; i < 80; i++) { this.testBigDecimalConverter(BigDecimal.valueOf(i * 100, 2)); } } public void testBigDecimalConverter2() throws ModelIOException, ParseException { for (long i = 90; i < 100; i++) { this.testBigDecimalConverter(BigDecimal.valueOf(i * 100, 2)); } } Click Preview or OK: !ENTRY org.eclipse.ltk.ui.refactoring 4 10000 May 27, 2004 11:33:05.249 !MESSAGE Internal Error !STACK 0 java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:283) at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.run(RefactoringWizardDialog2.java:282) at org.eclipse.ltk.ui.refactoring.RefactoringWizard.createChange(RefactoringWizard.java:559) at org.eclipse.ltk.ui.refactoring.RefactoringWizard.computeUserInputSuccessorPage(RefactoringWizard.java:405) at org.eclipse.ltk.ui.refactoring.UserInputWizardPage.computeSuccessorPage(UserInputWizardPage.java:74) at org.eclipse.ltk.ui.refactoring.UserInputWizardPage.getNextPage(UserInputWizardPage.java:114) at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.previewPressed(RefactoringWizardDialog2.java :429) at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.access$3(RefactoringWizardDialog2.java:427) at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2$1.widgetSelected(RefactoringWizardDialog2.ja va:562) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2716) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2382) at org.eclipse.jface.window.Window.runEventLoop(Window.java:668) at org.eclipse.jface.window.Window.open(Window.java:648) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:121) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate(RefactoringStarter.java:40) at org.eclipse.jdt.internal.ui.refactoring.UserInterfaceStarter.activate(UserInterfaceStarter.java:54) at org.eclipse.jdt.ui.actions.ModifyParametersAction$1.activate(ModifyParametersAction.java:249) at org.eclipse.jdt.ui.actions.ModifyParametersAction.startRefactoring(ModifyParametersAction.java:254) at org.eclipse.jdt.ui.actions.ModifyParametersAction.run(ModifyParametersAction.java:142) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:212) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:188) at org.eclipse.jface.action.Action.runWithEvent(Action.java:881) at org.eclipse.ui.actions.RetargetAction.runWithEvent(RetargetAction.java:212) at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:211) at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:141) at org.eclipse.ui.internal.commands.Command.execute(Command.java:132) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:469) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:887) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:928) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:546) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$2(WorkbenchKeyboard.java:494) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$1.handleEvent(WorkbenchKeyboard.java:259) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:712) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:795) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:820) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:805) at org.eclipse.swt.widgets.Control.traverse(Control.java:2704) at org.eclipse.swt.widgets.Control.translateMnemonic(Control.java:2545) at org.eclipse.swt.widgets.Composite.translateMnemonic(Composite.java:540) at org.eclipse.swt.widgets.Control.translateMnemonic(Control.java:2563) at org.eclipse.swt.widgets.Display.translateMnemonic(Display.java:3135) at org.eclipse.swt.widgets.Display.filterMessage(Display.java:726) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2378) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1363) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1334) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:253) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:97) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:307) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:256) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:127) 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:185) at org.eclipse.core.launcher.Main.run(Main.java:638) at org.eclipse.core.launcher.Main.main(Main.java:622) Caused by: java.lang.IllegalArgumentException: Node is not an existing node at org.eclipse.jdt.core.dom.rewrite.ASTRewrite.validateIsInsideAST(ASTRewrite.java:364) at org.eclipse.jdt.core.dom.rewrite.ASTRewrite.createTargetNode(ASTRewrite.java:427) at org.eclipse.jdt.core.dom.rewrite.ASTRewrite.createMoveTarget(ASTRewrite.java:469) at org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureRefactoring$OccurrenceUpdate.reshuffleEl ements(ChangeSignatureRefactoring.java:1183) at org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureRefactoring$DeclarationUpdate.updateNode (ChangeSignatureRefactoring.java:1397) at org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureRefactoring.createChangeManager(ChangeSi gnatureRefactoring.java:960) at org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureRefactoring.checkFinalConditions(ChangeS ignatureRefactoring.java:571) at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:84) at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:114) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1672) at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:58) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:101) Root exception: java.lang.IllegalArgumentException: Node is not an existing node at org.eclipse.jdt.core.dom.rewrite.ASTRewrite.validateIsInsideAST(ASTRewrite.java:364) at org.eclipse.jdt.core.dom.rewrite.ASTRewrite.createTargetNode(ASTRewrite.java:427) at org.eclipse.jdt.core.dom.rewrite.ASTRewrite.createMoveTarget(ASTRewrite.java:469) at org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureRefactoring$OccurrenceUpdate.reshuffleEl ements(ChangeSignatureRefactoring.java:1183) at org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureRefactoring$DeclarationUpdate.updateNode (ChangeSignatureRefactoring.java:1397) at org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureRefactoring.createChangeManager(ChangeSi gnatureRefactoring.java:960) at org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureRefactoring.checkFinalConditions(ChangeS ignatureRefactoring.java:571) at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:84) at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:114) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1672) at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:58) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:101)

Files changed in fix:
org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/ChangeSignatureRefactoring.java