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

Bug 358119

Summary: Can't open perspective (NPE)
Product: [Eclipse Project] Platform Reporter: Dani Megert <daniel_megert>
Component: UIAssignee: Eric Moffatt <emoffatt>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: emoffatt, john.arthorne, remy.suen, tom.schindl
Version: 3.8   
Target Milestone: 4.2 M3   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Workspace none

Description Dani Megert CLA 2011-09-19 09:54:21 EDT
3.8 M2.

When I try to open a perspective I get this:


!ENTRY org.eclipse.ui 4 0 2011-09-19 15:47:27.558
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException
	at org.eclipse.ui.internal.ViewSashContainer.restoreState(ViewSashContainer.java:122)
	at org.eclipse.ui.internal.PerspectiveHelper.restoreState(PerspectiveHelper.java:1363)
	at org.eclipse.ui.internal.Perspective.restoreState(Perspective.java:1309)
	at org.eclipse.ui.internal.Perspective.loadCustomPersp(Perspective.java:706)
	at org.eclipse.ui.internal.Perspective.createPresentation(Perspective.java:268)
	at org.eclipse.ui.internal.Perspective.<init>(Perspective.java:156)
	at org.eclipse.ui.internal.tweaklets.Workbench3xImplementation.createPerspective(Workbench3xImplementation.java:55)
	at org.eclipse.ui.internal.WorkbenchPage.createPerspective(WorkbenchPage.java:1748)
	at org.eclipse.ui.internal.WorkbenchPage.init(WorkbenchPage.java:2535)
	at org.eclipse.ui.internal.WorkbenchPage.<init>(WorkbenchPage.java:637)
	at org.eclipse.ui.internal.tweaklets.Workbench3xImplementation.createWorkbenchPage(Workbench3xImplementation.java:39)
	at org.eclipse.ui.internal.WorkbenchWindow.busyOpenPage(WorkbenchWindow.java:796)
	at org.eclipse.ui.internal.WorkbenchWindow$9.run(WorkbenchWindow.java:1839)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchWindow.openPage(WorkbenchWindow.java:1836)
	at org.eclipse.ui.handlers.ShowPerspectiveHandler.openPerspective(ShowPerspectiveHandler.java:150)
	at org.eclipse.ui.handlers.ShowPerspectiveHandler.openOther(ShowPerspectiveHandler.java:118)
	at org.eclipse.ui.handlers.ShowPerspectiveHandler.execute(ShowPerspectiveHandler.java:57)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:178)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:247)
	at org.eclipse.ui.actions.PerspectiveMenu.runOther(PerspectiveMenu.java:376)
	at org.eclipse.ui.actions.PerspectiveMenu$3.runWithEvent(PerspectiveMenu.java:130)
	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:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
	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:344)
	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:624)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:579)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1431)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1407)
	at org.eclipse.core.launcher.Main.main(Main.java:34)
Comment 1 Thomas Schindl CLA 2011-09-19 10:04:30 EDT
Could be introduced by bug 355750
Comment 2 Dani Megert CLA 2011-09-19 10:08:08 EDT
Created attachment 203594 [details]
Workspace

1. extract the zip into a new folder
2. start Eclipse using that folder as workspace
3. Window > Open Perspective > Java Browsing
==> NPE
Comment 3 Thomas Schindl CLA 2011-09-19 10:19:13 EDT
The problem is really caused by the fix for bug 355750 - it looks like page.getPerspective() returns null.
Comment 4 Thomas Schindl CLA 2011-09-19 10:55:04 EDT
I think the difference is that in this workspace config perspectives are opened always in new windows and so it fails when restoring.
Comment 5 Remy Suen CLA 2011-09-19 13:10:04 EDT
I20110915-1308

1. Start in a new workspace.
2. Close the 'Welcome' screen.
3. Window > Save Perspective As... > Some name > OK
4. Window > New Window
5. Nothing happens, the error is logged, check the 'Error Log' view.
6. Close your window.
7. Eclipse will _not_ prompt you.
8. Check your processes, Eclipse is actually still running. If you try to run Eclipse again it will tell you the workspace is still in use.
Comment 6 John Arthorne CLA 2011-09-19 13:52:29 EDT
Eric asked me whether this deserves a respin of M2 (M2a since M2 is already available). Arguments in favour of a respin:

 + This is really bad end user behaviour. Essentially Window->New Window is broken for perspectives that have been customized and saved.
 + Failure to shutdown properly after the failure makes it worse

Arguments against respin:

 - We are past our release train date so this impacts other projects' schedules. Some +1 projects would need to react to this change.
 - Perspective customization and Window->New Window are not the most common workflows. For example nobody hit this in the three weeks since the bug was introduced.
 - There is a workaround: Window > Reset Perspective seems to fix it.
 - This "only" affects 3.8 M2. The problem does not occur in 4.2 M2. This means release train and EPP packages are not affected by the problem.

Overall I could go either way, but I think this does not deserve an M2a. This is lost end user behaviour rather than something that affects downstream projects. There will be an integration build tomorrow towards M3 that will contain a fix, so if end users can't live without this workflow they can upgrade to tomorrow's build to get the fix.
Comment 7 Eric Moffatt CLA 2011-09-19 15:01:46 EDT
commit cac34ecf178dc898ef1db0badbd67da7301ffc0f

This commit (on R3_development) reverts the changes in the ViewSashContainer made by the fix fir bug 355750 (which I'll re-open and tag for a revisit in M3).
Comment 8 Eric Moffatt CLA 2011-09-19 15:05:43 EDT
I've re-opened bug 355750 for more work in M3.
Comment 9 Eric Moffatt CLA 2011-09-19 15:23:19 EDT
We should likely verify that this is fixed in tomorrow's I-build and close it if it is...
Comment 10 Dani Megert CLA 2011-09-20 01:50:45 EDT
> Overall I could go either way, but I think this does not deserve an M2a.
I agree. 

> There is a workaround: Window > Reset Perspective seems to fix it.
If one does not want to loose the settings one can also use M1 to open the perspective and then switch to M2 again.
Comment 11 Remy Suen CLA 2011-09-20 08:20:16 EDT
We should have a test to ensure that this problem doesn't occur again.

I also opened bug 358229 for the shutdown problem described by comment 5.
Comment 12 Eric Moffatt CLA 2011-10-11 13:51:33 EDT
I'll mark this as fixed since we've reverted the original 'fix', we're continuing to work on the issue in bug 355750.