Project: JDT
Bug 252643 [compare] NPE trying to replace a static initializer with an old version from the local history
Reported: 2008-10-29 15:34:32 | Status: verified fixed

Using eclipse.buildId=I20081028-0100 java.version=1.6.0_10 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=fr_CA Command-line arguments: -os win32 -ws win32 -arch x86 -debug -consolelog -console I got this exception trying to replace a static initializer in a test case with an old version. java.lang.NullPointerException at org.eclipse.jdt.internal.ui.compare.JavaReplaceWithEditionActionImpl.performReplace(JavaReplaceWithEditionActionImpl.java:191) at org.eclipse.jdt.internal.ui.compare.JavaReplaceWithEditionActionImpl.replace(JavaReplaceWithEditionActionImpl.java:148) at org.eclipse.jdt.internal.ui.compare.JavaReplaceWithEditionActionImpl$1.performReplace(JavaReplaceWithEditionActionImpl.java:122) at org.eclipse.team.ui.history.HistoryPageCompareEditorInput.okPressed(HistoryPageCompareEditorInput.java:216) at org.eclipse.compare.internal.CompareDialog.buttonPressed(CompareDialog.java:203) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:625) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3848) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3446) at org.eclipse.jface.window.Window.runEventLoop(Window.java:825) at org.eclipse.jface.window.Window.open(Window.java:801) at org.eclipse.compare.internal.CompareDialog.open(CompareDialog.java:195) at org.eclipse.compare.internal.CompareUIPlugin$3.run(CompareUIPlugin.java:1209) at org.eclipse.compare.internal.CompareUIPlugin.syncExec(CompareUIPlugin.java:1219) at org.eclipse.compare.internal.CompareUIPlugin.internalOpenDialog(CompareUIPlugin.java:1212) at org.eclipse.compare.internal.CompareUIPlugin.openCompareDialog(CompareUIPlugin.java:526) at org.eclipse.compare.CompareUI.openCompareDialog(CompareUI.java:211) at org.eclipse.jdt.internal.ui.compare.JavaReplaceWithEditionActionImpl.run(JavaReplaceWithEditionActionImpl.java:129) at org.eclipse.jdt.internal.ui.compare.JavaHistoryActionImpl.run(JavaHistoryActionImpl.java:327) at org.eclipse.jdt.internal.ui.compare.JavaHistoryAction.run(JavaHistoryAction.java:81) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:412) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3848) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3446) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:333) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113) 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:370) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) 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: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)

Files changed in fix:
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/compare/JavaReplaceWithEditionActionImpl.java