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

Bug 326406

Summary: [Compatibility] NPE in LegacyHandlerService's deactivateHandler(IHandlerActivation)
Product: [Eclipse Project] e4 Reporter: Olivier Thomann <Olivier_Thomann>
Component: UIAssignee: Remy Suen <remy.suen>
Status: VERIFIED FIXED QA Contact: Paul Webster <pwebster>
Severity: normal    
Priority: P3 CC: emoffatt, john.arthorne, remy.suen
Version: 1.0   
Target Milestone: 4.1 M4   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
LegacyHandlerService patch v1 none

Description Olivier Thomann CLA 2010-09-28 08:53:35 EDT
Using eclipse.buildId=I20100922-0843
java.version=1.6.0_20-ea
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 -console,

I got this exception in the .log file.

java.lang.NullPointerException
at org.eclipse.ui.internal.handlers.LegacyHandlerService.deactivateHandler(LegacyHandlerService.java:312)
at org.eclipse.debug.internal.ui.views.console.ProcessConsolePageParticipant.deactivated(ProcessConsolePageParticipant.java:254)
at org.eclipse.ui.internal.console.ConsoleView$8.run(ConsoleView.java:740)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.console.ConsoleView.deactivateParticipants(ConsoleView.java:738)
at org.eclipse.ui.internal.console.ConsoleView.showPageRec(ConsoleView.java:177)
at org.eclipse.ui.part.PageBookView.partActivated(PageBookView.java:759)
at org.eclipse.ui.internal.console.ConsoleView$4.run(ConsoleView.java:404)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4041)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:684)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:593)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:104)
at org.eclipse.ui.internal.Workbench$3.run(Workbench.java:546)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:528)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
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:369)
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:621)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:576)
at org.eclipse.equinox.launcher.Main.run(Main.java:1409)
at org.eclipse.equinox.launcher.Main.main(Main.java:1385)
Comment 1 John Arthorne CLA 2010-10-08 10:01:31 EDT
I am seeing this in the log as well. From a quick look, it may be the ProcessConsolePageParticipant that is passing in null here. I am seeing it on 4.1 M2.
Comment 2 Remy Suen CLA 2010-10-27 16:07:12 EDT
*** Bug 328880 has been marked as a duplicate of this bug. ***
Comment 3 Remy Suen CLA 2010-12-06 12:47:03 EST
Olivier came to talk to me about this problem today and I think I've gotten some decently reliable steps down.

1. Show the 'Console' view if you don't have it up already.
2. Have two Java applications prepared.
3. Have a breakpoint in one of them.
4. Debug it.
5. Now just run the second one.
6. The exception should occur.
Comment 4 Remy Suen CLA 2010-12-06 13:02:54 EST
Note that while you're trying to reproduce the problem, you must not activate the 'Console' view by mistake.
Comment 5 Remy Suen CLA 2010-12-06 13:17:29 EST
Created attachment 184644 [details]
LegacyHandlerService patch v1
Comment 6 Olivier Thomann CLA 2010-12-06 13:24:42 EST
I think we need to add protection, but also find out what calls are wrong and get them fixed. If null is not allowed, then this should be fixed as well.
Comment 7 Remy Suen CLA 2010-12-06 13:34:32 EST
(In reply to comment #5)
> Created an attachment (id=184644) [details]
> LegacyHandlerService patch v1

Patch released to CVS HEAD.

(In reply to comment #6)
> I think we need to add protection, but also find out what calls are wrong and
> get them fixed. If null is not allowed, then this should be fixed as well.

Agreed. We have opened bug 331932 against Debug for this problem. Perhaps we may roll back this patch later but that can be considered after M4 has shipped.

Thanks for the help, Olivier.
Comment 8 Remy Suen CLA 2010-12-07 13:02:49 EST
Verified with I20101207-0250 on Windows XP.

Unfortunately, I managed to miss this and another NPE happens afterwards actually. I will be adding a null check for bug 332063 and have notified the Debug team of this API violation in bug 331932 comment 5.