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

Bug 146825

Summary: [console] NPE in process console participant
Product: [Eclipse Project] Platform Reporter: Darin Wright <darin.eclipse>
Component: DebugAssignee: Curtis Windatt <curtis.windatt.public>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: benno.baumgartner, curtis.windatt.public, daniel_megert, eclipse, markus.kell.r, Olivier_Thomann, pwebster
Version: 3.2   
Target Milestone: 3.4 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Darin Wright CLA 2006-06-13 09:44:35 EDT
3.3 - HEAD

When running the Java debug tests I sometimes get these exceptions in the log:
Caused by: java.lang.NullPointerException
	at org.eclipse.debug.internal.ui.views.console.ProcessConsolePageParticipant.deactivated(ProcessConsolePageParticipant.java:238)
	at org.eclipse.debug.internal.ui.views.console.ProcessConsolePageParticipant.dispose(ProcessConsolePageParticipant.java:117)
	at org.eclipse.ui.internal.console.ConsoleView.doDestroyPage(ConsoleView.java:239)
	at org.eclipse.ui.part.PageBookView.removePage(PageBookView.java:854)
	at org.eclipse.ui.part.PageBookView.partClosed(PageBookView.java:776)
	at org.eclipse.ui.internal.console.ConsoleView.partClosed(ConsoleView.java:116)
	at org.eclipse.ui.internal.console.ConsoleView$2.run(ConsoleView.java:373)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
	... 33 more
Comment 1 Kevin Barnes CLA 2006-06-15 15:05:41 EDT
Can get the handlerService from the page site which will still work if the console view isn't found.
fixed in ProcessConsolePageParticipant.
Comment 2 Kevin Barnes CLA 2006-06-15 15:06:03 EDT
Darin, please verify
Comment 3 Darin Wright CLA 2006-06-19 15:22:46 EDT
Verified.
Comment 4 Curtis Windatt CLA 2007-11-13 15:51:57 EST
This bug started showing up again this week.  Seen while creating/running junit tests for PDE.

eclipse.buildId=N20071113-0010
java.version=1.5.0_09
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86

Error
Tue Nov 13 14:43:20 CST 2007
Error logged from Console plug-in: 

java.lang.NullPointerException
	at org.eclipse.debug.internal.ui.views.console.ProcessConsolePageParticipant.deactivated(ProcessConsolePageParticipant.java:255)
	at org.eclipse.debug.internal.ui.views.console.ProcessConsolePageParticipant.dispose(ProcessConsolePageParticipant.java:122)
	at org.eclipse.ui.internal.console.ConsoleView$2.run(ConsoleView.java:254)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.ui.internal.console.ConsoleView.doDestroyPage(ConsoleView.java:252)
	at org.eclipse.ui.part.PageBookView.removePage(PageBookView.java:852)
	at org.eclipse.ui.part.PageBookView.partClosed(PageBookView.java:774)
	at org.eclipse.ui.internal.console.ConsoleView.partClosed(ConsoleView.java:119)
	at org.eclipse.ui.internal.console.ConsoleView$5.run(ConsoleView.java:406)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:130)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3722)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3359)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2395)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2359)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2225)
	at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:468)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:463)
	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:106)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
	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(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:516)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:456)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1194)

Comment 5 Darin Wright CLA 2007-11-13 16:11:18 EST
*** Bug 173714 has been marked as a duplicate of this bug. ***
Comment 6 Olivier Thomann CLA 2007-11-14 10:45:38 EST
I get it each time I start a RCP application inside my workspace using latest integration build (20071113-0800).
Comment 7 Dani Megert CLA 2007-11-15 04:53:33 EST
Same here launching Eclipse target: I get 2 entries each time I start. Marking as 'major' as I have no clue what side effects this causes.
Comment 8 Darin Wright CLA 2007-11-15 09:13:00 EST
I can reproduce simply by running a program to termination (that produces console output), and then pressing "removing all terminated" in the debug view. This has the effect of disposing the console assocaited with the program that was run.

When the console page in the page book view is removed, we dispose of the "console page participants". It looks like the order of some code has changed - so now when the participant is disposed, its IPageSite's service locator no longer has a handler or context service.

There have been changes in this area (see bug 103810).

Paul (W) tells me that we no longer need to deactivate our contexts/handlers when a page site is disposed, as the framework takes care of it for us. I can fix the NPE by removing our call to "deactivate" in the ProcessConsolePageParticipant. However, I wonder if there might be a bug in the page book framework here? 
Comment 9 Darin Wright CLA 2007-11-15 09:19:11 EST
Fixed in console page participant. When disposed, we no longer deactivate handler/context.
Comment 10 Darin Wright CLA 2007-11-15 09:19:57 EST
Please verify, Curtis.
Comment 11 Curtis Windatt CLA 2007-11-15 14:55:47 EST
Verified.
Comment 12 Darin Wright CLA 2007-11-20 08:41:47 EST
*** Bug 210371 has been marked as a duplicate of this bug. ***