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

Bug 326314

Summary: [Compatibility] NPE caused by attempting to query editors that are no longer in the installation
Product: [Eclipse Project] e4 Reporter: John Arthorne <john.arthorne>
Component: UIAssignee: Remy Suen <remy.suen>
Status: RESOLVED FIXED QA Contact: Remy Suen <remy.suen>
Severity: major    
Priority: P3 CC: remy.suen
Version: 1.0   
Target Milestone: 4.1 M3   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Complete log file from the session none

Description John Arthorne CLA 2010-09-27 11:02:14 EDT
Build: 4.1 M2

When I attempted to start this build on an existing workspace, I got this NPE:

Caused by: java.lang.NullPointerException
	at org.eclipse.ui.internal.WorkbenchPage.checkEditor(WorkbenchPage.java:1558)
	at org.eclipse.ui.internal.WorkbenchPage.findEditors(WorkbenchPage.java:1530)
	at org.eclipse.ui.internal.WorkbenchPage.findEditor(WorkbenchPage.java:1514)
	at org.eclipse.ui.NavigationLocation.getEditorPart(NavigationLocation.java:44)
	at org.eclipse.ui.NavigationLocation.getText(NavigationLocation.java:60)


After that, attempting to open any view via Quick Access results in more errors:

java.lang.NullPointerException
	at org.eclipse.ui.internal.EditorReference.getId(EditorReference.java:115)
	at org.eclipse.ui.internal.quickaccess.EditorElement.getId(EditorElement.java:49)
	at org.eclipse.ui.internal.quickaccess.EditorProvider.getElements(EditorProvider.java:48)
	at org.eclipse.ui.internal.quickaccess.QuickAccessProvider.getElementsSorted(QuickAccessProvider.java:56)
	at org.eclipse.ui.internal.quickaccess.QuickAccessContents.computeMatchingEntries(QuickAccessContents.java:228)
	at org.eclipse.ui.internal.quickaccess.QuickAccessContents.refresh(QuickAccessContents.java:107)
	at org.eclipse.ui.internal.quickaccess.QuickAccessContents.access$1(QuickAccessContents.java:101)
	at org.eclipse.ui.internal.quickaccess.QuickAccessContents$4$1.run(QuickAccessContents.java:419)
	at org.eclipse.swt.widgets.Display.runTimer(Display.java:4167)

This build seems unusable to me.
Comment 1 John Arthorne CLA 2010-09-27 11:02:48 EDT
Created attachment 179653 [details]
Complete log file from the session
Comment 2 Remy Suen CLA 2010-09-27 13:34:23 EDT
I talked to John and there appears to be two different problems with the layout of his workspace we were trying to restore.

1. There were editors opened that were no longer present in the new installation that was run on the workspace. This is the cause behind the NPEs.
2. Trying to click around some existent editors but which were opened on resources that no longer existed were causing more NPEs to be thrown. I suspect this to be a side-effect of 1 but I will investigate to make sure.

The workaround is to just Ctrl+Shift+W and close all the editors. Eclipse should continue functioning as normal.
Comment 3 Remy Suen CLA 2010-09-27 14:18:54 EDT
(In reply to comment #2)
> 1. There were editors opened that were no longer present in the new
> installation that was run on the workspace. This is the cause behind the NPEs.

I only half-fixed this problem for non-restorable editors. The problem that John uncovered is for the cases where the non-restorable editor hasn't actually ever been clicked on. As parts are restored lazily, we haven't tried restoring them so the editor descriptors haven't been swapped out for the error one, causing NPEs to be thrown.
Comment 4 Remy Suen CLA 2010-09-27 14:58:30 EDT
Fixed in CVS HEAD. Asking IEditorReferences for their ids should no longer cause an NPE if the editor does not exist in the installation.