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

Bug 56176

Summary: NPE switching to debug perspective
Product: [Eclipse Project] Platform Reporter: John Arthorne <john.arthorne>
Component: UIAssignee: Stefan Xenos <sxenos>
Status: RESOLVED DUPLICATE QA Contact:
Severity: major    
Priority: P1 CC: csmclaren, douglas.pollock, eclipse, michaelvanmeekeren, sxenos, Tod_Creasey
Version: 3.0   
Target Milestone: 3.0 M9   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Attachments:
Description Flags
JPG of broken debug perspective none

Description John Arthorne CLA 2004-03-25 12:01:50 EST
I20040325 (0800)

1) Started up in Java perspective
2) Launched a runtime workbench
3) At the prompt to switch perspectives, I chose "Always".

Error dialog: Message was something like, "An internal error occurred while
switching perspectives".  Log:

!SESSION Mar 25, 2004 11:54:52.869 ---------------------------------------------
java.fullversion=J2RE 1.4.1 IBM J9 build 20031212 (JIT enabled)
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments: -keyring d:\1target\plugins\.metadata\.keyring -vmargs
-Xj9 -cp D:\eclipse\startup.jar org.eclipse.core.launcher.Main
!ENTRY org.eclipse.core.runtime 4 2 Mar 25, 2004 11:54:52.869
!MESSAGE Problems occurred when invoking code from plug-in:
"org.eclipse.core.runtime".
!STACK 0
java.lang.NullPointerException
	at java.lang.Throwable.<init>(Throwable.java)
	at java.lang.Throwable.<init>(Throwable.java)
	at java.lang.NullPointerException.<init>(NullPointerException.java:60)
	at
org.eclipse.ui.internal.PerspectivePresentation.addPart(PerspectivePresentation.java:234)
	at org.eclipse.ui.internal.Perspective.showView(Perspective.java:1420)
	at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:727)
	at org.eclipse.ui.internal.WorkbenchPage.access$9(WorkbenchPage.java:704)
	at org.eclipse.ui.internal.WorkbenchPage$13.run(WorkbenchPage.java:2890)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:84)
	at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:2887)
	at
org.eclipse.debug.internal.ui.views.launch.LaunchViewContextListener.contextActivated(LaunchViewContextListener.java:235)
	at
org.eclipse.debug.internal.ui.views.launch.LaunchViewContextListener.contextChanged(LaunchViewContextListener.java:173)
	at org.eclipse.ui.internal.contexts.Context.fireContextChanged(Context.java:117)
	at
org.eclipse.ui.internal.contexts.MutableContextManager.notifyContexts(MutableContextManager.java:140)
	at
org.eclipse.ui.internal.contexts.MutableContextManager.setEnabledContextIds(MutableContextManager.java:274)
	at
org.eclipse.debug.internal.ui.views.launch.LaunchView.showViewsForCurrentSelection(LaunchView.java:575)
	at
org.eclipse.debug.internal.ui.views.launch.LaunchView.selectionChanged(LaunchView.java:507)
	at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:159)
	at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java)
	at org.eclipse.core.runtime.Platform.run(Platform.java)
	at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:157)
	at
org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:1310)
	at
org.eclipse.jface.viewers.StructuredViewer.setSelection(StructuredViewer.java:1033)
	at
org.eclipse.debug.internal.ui.views.launch.LaunchView.autoExpand(LaunchView.java:1133)
	at
org.eclipse.debug.internal.ui.views.launch.LaunchView.initializeSelection(LaunchView.java:379)
	at
org.eclipse.debug.internal.ui.views.launch.LaunchView.becomesVisible(LaunchView.java:1398)
	at
org.eclipse.debug.ui.AbstractDebugView$DebugViewPartListener.partVisible(AbstractDebugView.java:161)
	at org.eclipse.ui.internal.PartListenerList2$7.run(PartListenerList2.java:175)
	at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java)
	at org.eclipse.core.runtime.Platform.run(Platform.java)
	at
org.eclipse.ui.internal.PartListenerList2.firePartVisible(PartListenerList2.java:173)
	at org.eclipse.ui.internal.WorkbenchPage$1.propertyChange(WorkbenchPage.java:137)
	at org.eclipse.ui.internal.LayoutPart.setVisible(LayoutPart.java:245)
	at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:309)
	at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:664)
	at
org.eclipse.ui.internal.PresentableViewPart.setVisible(PresentableViewPart.java:108)
	at
org.eclipse.ui.internal.presentations.BasicStackPresentation.selectPart(BasicStackPresentation.java:652)
	at org.eclipse.ui.internal.PartTabFolder.setSelection(PartTabFolder.java:825)
	at org.eclipse.ui.internal.PartTabFolder.showPart(PartTabFolder.java:905)
	at org.eclipse.ui.internal.PartTabFolder.createControl(PartTabFolder.java:317)
	at
org.eclipse.ui.internal.PartSashContainer.createControl(PartSashContainer.java:256)
	at
org.eclipse.ui.internal.PerspectivePresentation.activate(PerspectivePresentation.java:148)
	at org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:630)
	at org.eclipse.ui.internal.WorkbenchPage.setPerspective(WorkbenchPage.java:2674)
	at org.eclipse.ui.internal.WorkbenchPage.busySetPerspective(WorkbenchPage.java:694)
	at org.eclipse.ui.internal.WorkbenchPage.access$8(WorkbenchPage.java:679)
	at org.eclipse.ui.internal.WorkbenchPage$12.run(WorkbenchPage.java:2804)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:84)
	at org.eclipse.ui.internal.WorkbenchPage.setPerspective(WorkbenchPage.java:2802)
	at org.eclipse.ui.internal.Workbench.showPerspective(Workbench.java:1633)
	at
org.eclipse.debug.internal.ui.launchConfigurations.PerspectiveManager.switchToPerspective(PerspectiveManager.java:173)
	at
org.eclipse.debug.internal.ui.launchConfigurations.PerspectiveManager$5.run(PerspectiveManager.java:325)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1562)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1536)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:257)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:139)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:90)
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:288)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:232)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:116)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:41)
	at java.lang.reflect.Method.invoke(Method.java:386)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:315)
	at org.eclipse.core.launcher.Main.run(Main.java:740)
	at org.eclipse.core.launcher.Main.main(Main.java:724)
Comment 1 John Arthorne CLA 2004-03-25 12:12:09 EST
Created attachment 8882 [details]
JPG of broken debug perspective

This resulted in a broken debug perspective with a large grey area at the
bottom. See screen shot.
Comment 2 Kim Horne CLA 2004-03-25 12:14:18 EST
If I had to guess I'd say this is due to the breakage in either 15822 or 50618
introduced by the presentation work.
Comment 3 Michael Van Meekeren CLA 2004-03-25 14:04:47 EST
see also bug 53303
Comment 4 Michael Van Meekeren CLA 2004-03-25 14:05:30 EST
see also bug 54928
Comment 5 Kim Horne CLA 2004-03-25 14:18:57 EST
I am unable to reproduce this problem...can you reproduce it consistantly?  Are
you running in a clean workspace?  Are you launching a test plugin or plugins
from an eclipse CVS module? 
Comment 6 Kim Horne CLA 2004-03-25 14:45:49 EST
I added the following to 54928:

This could be some kind of timing issue... where you're trying to open the view
in a perspective that hasn't gotten itself into a working state... it could be
that you'll need to wrap your logic in LaunchView.showViewsForCurrentSelection
in a WorkbenchJob to ensure that the perspective is in a happy state.
Comment 7 Tod Creasey CLA 2004-04-12 11:02:39 EDT
I get this one everytime I try and step through to another class with the 
debugger. It is failing on opening the editor in the debug perspective.

This should be P1 - the debugger is unusable with it.

STEPS
1) Set a breakpoint
2) Run the run time workbench
3) When the breakpoint is hit step through until you hit a point where a new 
editor needs to open.
Comment 8 Stefan Xenos CLA 2004-04-12 16:12:47 EDT
I'm unable to reproduce this. (Running the code in HEAD, 20040412).

I've tried the original steps in this report, and Tod's steps in comment 7, but
neither of them throw the exception.
Comment 9 John Arthorne CLA 2004-04-12 16:19:41 EDT
I was never able to reproduce with my original steps.  At the time we surmised
it was a timing issue.
Comment 10 Michael Van Meekeren CLA 2004-04-12 17:02:17 EDT
does the code look like it would properly protect itself from an NPE or that 
NPEs would be possible in certain scenarios?

If not then I suggest we close this.
Comment 11 Stefan Xenos CLA 2004-04-12 21:56:33 EDT

*** This bug has been marked as a duplicate of 54928 ***