Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 275123

Summary: NPE when quickly closing compare editor for local revision
Product: [Eclipse Project] Platform Reporter: Tomasz Zarna <tomasz.zarna>
Component: TeamAssignee: Tomasz Zarna <tomasz.zarna>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: pawel.pogorzelski1
Version: 3.5Flags: pawel.pogorzelski1: review+
Target Milestone: 3.6 M1   
Hardware: PC   
OS: Windows XP   
Whiteboard: hasPatch
Attachments:
Description Flags
Patch v01
none
mylyn/context/zip none

Description Tomasz Zarna CLA 2009-05-06 05:54:39 EDT
I20090430-2300

Similar to bug 273951. Steps are almost identical to those given by Markus there:

1. change a line in a MANIFEST.MF
2. open the MANIFEST.MF in History view, turn on Compare Mode
3. double click on the last local revision
4. close the compare editor with Command+W
5. repeat 3 & 4 quickly. After about 3 iteration, I usually get this NPE.

java.lang.NullPointerException
at org.eclipse.team.internal.ui.mapping.CompareInputChangeNotifier.dispose(CompareInputChangeNotifier.java:192)
at org.eclipse.team.internal.ui.history.CompareFileRevisionEditorInput.handleDispose(CompareFileRevisionEditorInput.java:286)
at org.eclipse.compare.CompareEditorInput.dispose(CompareEditorInput.java:569)
at org.eclipse.compare.internal.CompareEditor.dispose(CompareEditor.java:487)
at org.eclipse.ui.internal.WorkbenchPartReference.doDisposePart(WorkbenchPartReference.java:737)
at org.eclipse.ui.internal.EditorReference.doDisposePart(EditorReference.java:321)
at org.eclipse.ui.internal.WorkbenchPartReference.dispose(WorkbenchPartReference.java:684)
at org.eclipse.ui.internal.WorkbenchPage.disposePart(WorkbenchPage.java:1715)
at org.eclipse.ui.internal.WorkbenchPage.handleDeferredEvents(WorkbenchPage.java:1422)
at org.eclipse.ui.internal.WorkbenchPage.deferUpdates(WorkbenchPage.java:1406)
at org.eclipse.ui.internal.WorkbenchPage.closeEditors(WorkbenchPage.java:1380)
at org.eclipse.ui.internal.WorkbenchPage.closeEditor(WorkbenchPage.java:1444)
at org.eclipse.ui.internal.CloseEditorHandler.execute(CloseEditorHandler.java:47)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:294)
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:470)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:824)
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:510)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:125)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled Code))
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1191)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1002)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1040)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1036)
at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1368)
at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4047)
at org.eclipse.swt.widgets.Control.windowProc(Control.java(Compiled Code))
at org.eclipse.swt.widgets.Display.windowProc(Display.java(Compiled Code))
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2409)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3471)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
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:194)
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:368)
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:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
at java.lang.reflect.Method.invoke(Method.java:391)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
Comment 1 Tomasz Zarna CLA 2009-05-06 06:00:37 EDT
Created attachment 134597 [details]
Patch v01

Check for null before disposing.
Comment 2 Tomasz Zarna CLA 2009-05-06 06:00:40 EDT
Created attachment 134598 [details]
mylyn/context/zip
Comment 3 Tomasz Zarna CLA 2009-05-06 06:02:00 EDT
This is a very rare situation and I guess reproducible only on a dual core machine.
Comment 4 Tomasz Zarna CLA 2009-05-06 06:11:21 EDT
Szymon do you find the patch safe for 3.5?
Comment 5 Tomasz Zarna CLA 2009-05-07 04:58:59 EDT
Pawel could you take a look at the patch?
Comment 6 Pawel Pogorzelski CLA 2009-05-07 11:05:16 EDT
The check looks reasonable, seems like it was missing from the beginning. Moreover I haven't found negative consequences of letting the code execute further - after the point now the Exception is thrown.
Comment 7 Tomasz Zarna CLA 2009-05-08 05:47:42 EDT
Thanks for the review Pawel. Given the fact that the issue is not intrusive and hardly reproducible I'm setting it to be released during early 3.6.
Comment 8 Tomasz Zarna CLA 2009-07-09 09:53:02 EDT
Released to HEAD, available in builds >N20090708-2000.