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

Bug 61585

Summary: NPE closing all editors
Product: [Eclipse Project] Platform Reporter: Michael Van Meekeren <michaelvanmeekeren>
Component: UIAssignee: Ines Khelifi <ines>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: Darin_Swanson, sxenos
Version: 3.0Keywords: helpwanted
Target Milestone: 3.0 M9   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Michael Van Meekeren CLA 2004-05-10 09:41:52 EDT
build N20040510

- Opened the workspace (started in the team Synchronizing perspective had 4 
java editors open)
- press Ctrl-Shift-W to close all editors... 
- got the following NPE


!STACK 0
java.lang.NullPointerException
	at 
org.eclipse.jdt.internal.ui.javaeditor.BasicJavaEditorActionContributor.setActi
veEditor(BasicJavaEditorActionContributor.java:242)
	at 
org.eclipse.jdt.internal.ui.javaeditor.BasicEditorActionContributor.setActiveEd
itor(BasicEditorActionContributor.java:83)
	at 
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditorActionContributor.s
etActiveEditor(CompilationUnitEditorActionContributor.java:59)
	at org.eclipse.ui.internal.EditorActionBars.partChanged
(EditorActionBars.java:291)
	at org.eclipse.ui.internal.WorkbenchPage$2.run(WorkbenchPage.java:474)
	at org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:607)
	at org.eclipse.core.runtime.Platform.run(Platform.java:668)
	at org.eclipse.ui.internal.WorkbenchPage.activatePart
(WorkbenchPage.java:466)
	at org.eclipse.ui.internal.WorkbenchPage.setActivePart
(WorkbenchPage.java:2587)
	at org.eclipse.ui.internal.WorkbenchPage.activate
(WorkbenchPage.java:455)
	at org.eclipse.ui.internal.WorkbenchPage.hideView
(WorkbenchPage.java:1787)
	at org.eclipse.ui.internal.WorkbenchPage.hideView
(WorkbenchPage.java:1747)
	at org.eclipse.ui.internal.ViewPane.doHide(ViewPane.java:298)
	at org.eclipse.ui.internal.PartStack.close(PartStack.java:210)
	at org.eclipse.ui.internal.PartStack.close(PartStack.java:194)
	at org.eclipse.ui.internal.PartStack$1.close(PartStack.java:62)
	at org.eclipse.ui.internal.presentations.SystemMenuClose.run
(SystemMenuClose.java:41)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:881)
	at 
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:609)
	at org.eclipse.jface.action.ActionContributionItem.access$2
(ActionContributionItem.java:560)
	at org.eclipse.jface.action.ActionContributionItem$6.handleEvent
(ActionContributionItem.java:479)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2725)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2390)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1353)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1324)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench
(Workbench.java:243)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
	at org.eclipse.ui.internal.ide.IDEApplication.run
(IDEApplication.java:90)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run
(PlatformActivator.java:298)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run
(EclipseStarter.java:249)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run
(EclipseStarter.java:126)
	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:324)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:269)
	at org.eclipse.core.launcher.Main.run(Main.java:722)
	at org.eclipse.core.launcher.Main.main(Main.java:706)
Comment 1 Michael Van Meekeren CLA 2004-05-10 09:44:17 EDT
Actually I just checked, this error was on trying to open an editor after 
having gotten another NPE on closing all editors... the other NPE is below... 
this looks like Platform UI first of all and possibly a JDT bug after that.. 
but perhaps not..

moving

!MESSAGE The command for the key you pressed failed
!STACK 0
java.lang.NullPointerException
	at org.eclipse.ui.internal.presentations.DefaultPartPresentation.layout
(DefaultPartPresentation.java:596)
	at 
org.eclipse.ui.internal.presentations.DefaultPartPresentation.setControlSize
(DefaultPartPresentation.java:630)
	at 
org.eclipse.ui.internal.presentations.DefaultPartPresentation.selectPart
(DefaultPartPresentation.java:778)
	at org.eclipse.ui.internal.PartStack.refreshPresentationSelection
(PartStack.java:717)
	at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:692)
	at org.eclipse.ui.internal.PartStack.presentationSelectionChanged
(PartStack.java:497)
	at org.eclipse.ui.internal.PartStack.access$0(PartStack.java:487)
	at org.eclipse.ui.internal.PartStack$1.selectPart(PartStack.java:82)
	at 
org.eclipse.ui.internal.presentations.DefaultPartPresentation$4.handleEvent
(DefaultPartPresentation.java:155)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:820)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:805)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:613)
	at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:2944)
	at org.eclipse.swt.custom.CTabFolder.destroyItem(CTabFolder.java:633)
	at org.eclipse.swt.custom.CTabItem.dispose(CTabItem.java:135)
	at 
org.eclipse.ui.internal.presentations.DefaultPartPresentation.removePart
(DefaultPartPresentation.java:758)
	at org.eclipse.ui.internal.PartStack.remove(PartStack.java:524)
	at org.eclipse.ui.internal.EditorSashContainer.removeEditor
(EditorSashContainer.java:192)
	at org.eclipse.ui.internal.EditorAreaHelper.closeEditor
(EditorAreaHelper.java:102)
	at org.eclipse.ui.internal.EditorAreaHelper.closeEditor
(EditorAreaHelper.java:92)
	at org.eclipse.ui.internal.EditorManager.closeEditor
(EditorManager.java:160)
	at org.eclipse.ui.internal.WorkbenchPage.closeEditors
(WorkbenchPage.java:886)
	at org.eclipse.ui.internal.WorkbenchPage.closeAllEditors
(WorkbenchPage.java:833)
	at org.eclipse.ui.internal.CloseAllAction.run(CloseAllAction.java:74)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:881)
	at org.eclipse.ui.commands.ActionHandler.execute
(ActionHandler.java:141)
	at org.eclipse.ui.internal.commands.Command.execute(Command.java:132)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand
(WorkbenchKeyboard.java:468)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press
(WorkbenchKeyboard.java:886)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent
(WorkbenchKeyboard.java:927)
	at 
org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings
(WorkbenchKeyboard.java:545)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$2
(WorkbenchKeyboard.java:493)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard$1.handleEvent
(WorkbenchKeyboard.java:258)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:712)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:795)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:820)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:805)
	at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1722)
	at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1718)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3047)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:2950)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:3291)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1466)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2388)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1353)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1324)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench
(Workbench.java:243)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
	at org.eclipse.ui.internal.ide.IDEApplication.run
(IDEApplication.java:90)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run
(PlatformActivator.java:298)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run
(EclipseStarter.java:249)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run
(EclipseStarter.java:126)
	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:324)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:269)
	at org.eclipse.core.launcher.Main.run(Main.java:722)
	at org.eclipse.core.launcher.Main.main(Main.java:706) 
Comment 2 Ines Khelifi CLA 2004-05-12 13:44:23 EDT
My steps using N20040510 and 200405121200:

- I checked out a project from CVs ("org.eclipse.jface")
- I opened 4 java files and modified them
- I right-clicked on the package and selected "Team Synchronize with Repository"
- I opened the files that appeared in the "CVS Workspace" view
- I restarted Eclipse
- I pressed Ctrl+Shift+W
- I also tried opening 4 java files in the Java Perspective then switching to
the Team perspective.
- I restarted eclipse and pressed Ctrl+Shift+W

There was nothing in the log file referring to an NPE. Is this a recurrent bug?
Comment 3 Ines Khelifi CLA 2004-05-13 10:20:07 EDT
Please re-open if this happens again.
Comment 4 Darin Swanson CLA 2004-05-25 19:03:54 EDT
On I200405251600 just got a very similar expection as in comment #1.
I had just moved to the build and for some reason I got the following error:
Error May 25, 2004 15:44:40.561 Exception creating editor: The classfile is 
not on the classpath

Then I got the NPE of comment #1
java.lang.NullPointerException
at org.eclipse.ui.internal.presentations.DefaultPartPresentation.layout
(DefaultPartPresentation.java:643)
at org.eclipse.ui.internal.presentations.DefaultPartPresentation.setControlSize
(DefaultPartPresentation.java:677)
at org.eclipse.ui.internal.presentations.DefaultPartPresentation.selectPart
(DefaultPartPresentation.java:856)
at org.eclipse.ui.internal.PartStack.refreshPresentationSelection
(PartStack.java:920)
at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:895)
at org.eclipse.ui.internal.PartStack.updateContainerVisibleTab
(PartStack.java:1038)
at org.eclipse.ui.internal.PartStack.remove(PartStack.java:699)
at org.eclipse.ui.internal.EditorSashContainer.removeEditor
(EditorSashContainer.java:193)
at org.eclipse.ui.internal.EditorAreaHelper.closeEditor
(EditorAreaHelper.java:109)
at org.eclipse.ui.internal.EditorAreaHelper.closeEditor
(EditorAreaHelper.java:99)
at org.eclipse.ui.internal.EditorManager.closeEditor(EditorManager.java:162)
at org.eclipse.ui.internal.WorkbenchPage.closeEditor(WorkbenchPage.java:966)
at org.eclipse.ui.internal.WorkbenchPage.closeEditor(WorkbenchPage.java:932)
at org.eclipse.ui.internal.EditorPane.doHide(EditorPane.java:95)
at org.eclipse.ui.internal.PartStack.close(PartStack.java:334)
at org.eclipse.ui.internal.EditorStack.close(EditorStack.java:201)
at org.eclipse.ui.internal.PartStack$1.close(PartStack.java:74)
at 
org.eclipse.ui.internal.presentations.DefaultPartPresentation$1.closeButtonPres
sed(DefaultPartPresentation.java:104)
at org.eclipse.ui.internal.presentations.PaneFolder.notifyCloseListeners
(PaneFolder.java:417)
at org.eclipse.ui.internal.presentations.PaneFolder$1.close
(PaneFolder.java:123)
at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:2001)
at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:292)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2716)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2382)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1363)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1334)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:253)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:97)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run
(PlatformActivator.java:307)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:256)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:127)
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:324)
at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
at org.eclipse.core.launcher.Main.run(Main.java:638)
at org.eclipse.core.launcher.Main.main(Main.java:622)
at intuitive.audit.Main.runProgramWithClass(Native Method)
at intuitive.audit.Audit.main(Audit.java:816)

My test case was not on close all but rather on closing individual editors, 
one at a time.
Comment 5 Ines Khelifi CLA 2004-05-26 09:29:27 EDT
Thank you for re-opening the bug. I am going to guess that you were not able to
reproduce this NPE after it happened? I am currently investigating.
Comment 6 Ines Khelifi CLA 2004-05-26 10:24:07 EDT
This looks like a duplicate of bug 61581. Please modify if you believe otherwise.

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