Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 311406 - PageBookView partListener partActivated NPE
Summary: PageBookView partListener partActivated NPE
Status: CLOSED WONTFIX
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Prakash Rangaraj CLA
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-03 14:30 EDT by Dan Rubel CLA
Modified: 2019-06-06 16:10 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Rubel CLA 2010-05-03 14:30:31 EDT
I'm using 

   Eclipse SDK
   Version: 4.0.0
   Build id: I20100429-2233

I'm seeing the following exception (see below) and it appears that partRef is null in this PageBookView partListener method...

	public void partActivated(IWorkbenchPartReference partRef) {
		IWorkbenchPart part = partRef.getPart(false);
		PageBookView.this.partActivated(part);
	}

... I can add guard code to check for null if that is appropriate, but my wider question is... should partActivated be called with a null value?
Any guidance would be most appreciated.

**************** Stack trace follows:

org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException
	at org.eclipse.e4.core.internal.di.MethodRequestor.callMethod(MethodRequestor.java:64)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:32)
	at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier$ContextInjectionListener.notify(ContextObjectSupplier.java:80)
	at org.eclipse.e4.core.internal.contexts.EclipseContext$TrackableComputationExt.notify(EclipseContext.java:169)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.processScheduled(EclipseContext.java:500)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.set(EclipseContext.java:527)
	at org.eclipse.e4.workbench.ui.internal.PartServiceImpl.activate(PartServiceImpl.java:322)
	at org.eclipse.e4.workbench.ui.internal.PartServiceImpl.showPart(PartServiceImpl.java:476)
	at org.eclipse.e4.workbench.ui.internal.PartServiceImpl.showPart(PartServiceImpl.java:522)
	at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:632)
	at org.eclipse.ui.internal.WorkbenchPage$6.run(WorkbenchPage.java:2246)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:2243)
	at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:2219)
	at com.instantiations.assist.eclipse.analysis.ui.audit.action.AuditCodeActionDelegate$3.run(AuditCodeActionDelegate.java:331)
	at com.instantiations.assist.eclipse.core.ui.CodeProUI.syncExecUI(CodeProUI.java:376)
	at com.instantiations.assist.eclipse.core.ui.CodeProUI.syncExec(CodeProUI.java:350)
	at com.instantiations.assist.eclipse.analysis.ui.audit.action.AuditCodeActionDelegate.openAuditView(AuditCodeActionDelegate.java:324)
	at com.instantiations.assist.eclipse.analysis.ui.audit.action.AuditCodeActionDelegate.run(AuditCodeActionDelegate.java:128)
	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:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
	at org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine$4.run(PartRenderingEngine.java:517)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine.run(PartRenderingEngine.java:455)
	at org.eclipse.e4.workbench.ui.internal.E4Workbench.createAndRunUI(E4Workbench.java:100)
	at org.eclipse.ui.internal.Workbench$3.run(Workbench.java:533)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:519)
	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(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:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: java.lang.NullPointerException
	at org.eclipse.ui.part.PageBookView$4.partActivated(PageBookView.java:1010)
	at org.eclipse.ui.internal.WorkbenchPage.firePartActivated(WorkbenchPage.java:2613)
	at org.eclipse.ui.internal.WorkbenchPage.access$3(WorkbenchPage.java:2602)
	at org.eclipse.ui.internal.WorkbenchPage$E4PartListener.partActivated(WorkbenchPage.java:117)
	at org.eclipse.e4.workbench.ui.internal.PartServiceImpl.firePartActivated(PartServiceImpl.java:172)
	at org.eclipse.e4.workbench.ui.internal.PartServiceImpl.setPart(PartServiceImpl.java:131)
	at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.e4.core.internal.di.MethodRequestor.callMethod(MethodRequestor.java:57)
	... 48 more
Comment 1 Eric Moffatt CLA 2010-05-03 14:51:34 EDT
Dan, I'm pretty sure that the answer is 'no', we shouldn't be throwing 'activated' events with a null. Even in the case where (for some reason) we end up with no activated part we should just be throwing 'deactivated' for the currently active part and no activate event.

Can anyone propose a situation where this is not true?
Comment 2 Remy Suen CLA 2010-05-03 15:08:31 EDT
I see this occasionally but haven't quite been able to reproduce it yet.
Comment 3 Dane Hammer CLA 2010-07-28 18:44:22 EDT
I'm able to recreate with the following (no idea what this means from a lower level than the end-user):

1. Open an xsd file with the xsd editor.
2. Open a second editor editing a file that you didn't have open, yet.
3. Click back to the xsd file.
4. Alert window.

It doesn't do it for the Java editor.
Comment 4 Paul Webster CLA 2011-05-13 15:47:33 EDT
This doesn't occur in the latest 4.1 candidate.

PW
Comment 5 Eclipse Genie CLA 2019-06-06 16:10:25 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.