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

Bug 331007

Summary: [Compatibility] NPE thrown opening new workbench window
Product: [Eclipse Project] e4 Reporter: Remy Suen <remy.suen>
Component: UIAssignee: Remy Suen <remy.suen>
Status: VERIFIED FIXED QA Contact: Remy Suen <remy.suen>
Severity: normal    
Priority: P3 CC: emoffatt
Version: 1.0   
Target Milestone: 4.1 M4   
Hardware: All   
OS: All   
Whiteboard:

Description Remy Suen CLA 2010-11-24 07:41:49 EST
1. Window > New Window
2. An NPE occurs.

java.lang.NullPointerException
	at org.eclipse.ui.part.PageBookView$4.partVisible(PageBookView.java:1062)
	at org.eclipse.ui.internal.WorkbenchPage.firePartVisible(WorkbenchPage.java:3335)
	at org.eclipse.ui.internal.WorkbenchPage.access$5(WorkbenchPage.java:3328)
	at org.eclipse.ui.internal.WorkbenchPage$2.handleEvent(WorkbenchPage.java:2080)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:41)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
	at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
	at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
	at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
	at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:73)
	at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:58)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:380)
	at org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveStackImpl.setSelectedElement(PerspectiveStackImpl.java:144)
	at org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveStackImpl.setSelectedElement(PerspectiveStackImpl.java:1)
	at org.eclipse.ui.internal.WorkbenchPage.setPerspective(WorkbenchPage.java:2662)
	at org.eclipse.ui.internal.WorkbenchWindow.setup(WorkbenchWindow.java:526)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:618)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:52)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:793)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:103)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:73)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.inject(ContextInjectionFactory.java:72)
	at org.eclipse.ui.internal.Workbench.createWorkbenchWindow(Workbench.java:1164)
	at org.eclipse.ui.internal.Workbench.openWorkbenchWindow(Workbench.java:2191)
	at org.eclipse.ui.internal.Workbench.openWorkbenchWindow(Workbench.java:2183)
	at org.eclipse.ui.internal.handlers.OpenInNewWindowHandler.execute(OpenInNewWindowHandler.java:58)
Comment 1 Remy Suen CLA 2010-11-24 07:45:28 EST
Caused by changes to bug 283741. Since the event handlers are global, we get events from other windows also. Hence, only asserting that the changed element is an MPerspectiveStack is insufficient as the page only cares about perspective changes from itself and not other pages.

Fixed in CVS HEAD.
Comment 2 Remy Suen CLA 2010-12-08 08:28:50 EST
Verified with I20101208-0250 on Windows XP.