This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 403754 - NPE when JavaModelException occurs opening an editor
Summary: NPE when JavaModelException occurs opening an editor
Status: CLOSED DUPLICATE of bug 387475
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.3.1   Edit
Assignee: Brian de Alwis CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-19 07:20 EDT by Stephan Herrmann CLA
Modified: 2013-08-24 07:16 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2013-03-19 07:20:06 EDT
Since building against Kepler M6 I'm seeing the following NPE in a unit test,
which previously passed:

java.lang.NullPointerException
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3142)
	at org.eclipse.ui.internal.WorkbenchPage.access$22(WorkbenchPage.java:3048)
	at org.eclipse.ui.internal.WorkbenchPage$8.run(WorkbenchPage.java:3030)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3026)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2990)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2981)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:373)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:179)
	at org.eclipse.jdt.ui.JavaUI.openInEditor(JavaUI.java:698)
	at org.eclipse.jdt.ui.JavaUI.openInEditor(JavaUI.java:676)
 ...

In the debugger I see the following sequence of events:

1) inside org.eclipse.jdt.internal.ui.javaeditor.ClassFileEditor.doSetInput()
the call to probeInputForSource(input) returns a JavaModelException
("Java Model Status [NonJavaPrj does not exist").

2) this is rethrown as a CoreException

3) the runnable inside AbstractTextEditor.internalInit rethrows as
InvocationTargetException

4) AbstractTextEditor.internalInit rethrows as PartInitException

5) this causes early exit from EditorReference.initialize() which as the
second-but-last line *would* assign "legacyPart = part;",
but we don't get there.

6) CompatibilityPart.create() catches the exception and goes into
handlePartInitException().

7) inside EditorReference.getSite() we hit NPE because legacyPart is null.

8) after some more rethrowing etc. ReflectionContributionFactory returns
null from doCreate()

9) from here all *seems* to be going well, busyOpenEditor() continues its
work until the final return compatibilityEditor.getEditor(); where
compatibilityEditor is null.
Comment 1 Brian de Alwis CLA 2013-03-20 11:10:56 EDT
Stephan: what unit test do you see this on?  I have some fixes in progress relating to similar problems.
Comment 2 Stephan Herrmann CLA 2013-03-21 08:12:56 EDT
(In reply to comment #1)
> Stephan: what unit test do you see this on?  I have some fixes in progress
> relating to similar problems.

It's this test:
http://git.eclipse.org/c/objectteams/org.eclipse.objectteams.git/tree/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/callinmarker/CallinMarkerTests.java#n447

The project used in the test is here:
http://git.eclipse.org/c/objectteams/org.eclipse.objectteams.git/tree/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/NonJavaPrj

As the error seems to occurs before actually any Object Teams specifics are
involved maybe you can reproduce just with a plain SDK, not sure.
Otherwise if you have a fix I'll be happy to re-test against a nightly build
or such.

Thanks for looking into this.
Comment 3 Brian de Alwis CLA 2013-08-23 17:08:26 EDT
I suspect this is a duplicate of bug 387475.  Stefan, please re-open if you see this still.

*** This bug has been marked as a duplicate of bug 387475 ***
Comment 4 Stephan Herrmann CLA 2013-08-24 07:16:51 EDT
Indeed I haven't seen this exception in a while. Great!