Bug 394495 - [search] can't open editor from "find references" search result
Summary: [search] can't open editor from "find references" search result
Status: CLOSED DUPLICATE of bug 394496
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2012-11-16 14:38 EST by Rafael Chaves CLA
Modified: 2012-12-04 03:30 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Chaves CLA 2012-11-16 14:38:12 EST
Eclipse SDK 4.2.1. M20120914-1800

This looks similar to bug 128363 (closed back in 2006).

I started getting this error opening some search results with double-click (F3 seems to work fine):

java.lang.NullPointerException
	at org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer.initializeViewerColors(JavaSourceViewer.java:265)
	at org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer.configure(JavaSourceViewer.java:249)
	at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.doSetInput(JavaEditor.java:2568)
	at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.doSetInput(CompilationUnitEditor.java:1395)
	at org.eclipse.ui.texteditor.AbstractTextEditor.setInputWithNotify(AbstractTextEditor.java:4286)
	at org.eclipse.ui.texteditor.AbstractTextEditor.setInput(AbstractTextEditor.java:4308)
	at org.eclipse.jdt.internal.ui.search.JavaSearchEditorOpener.showInEditor(JavaSearchEditorOpener.java:96)
	at org.eclipse.jdt.internal.ui.search.JavaSearchEditorOpener.showWithReuse(JavaSearchEditorOpener.java:75)
	at org.eclipse.jdt.internal.ui.search.JavaSearchEditorOpener.openElement(JavaSearchEditorOpener.java:40)
	at org.eclipse.jdt.internal.ui.search.JavaSearchEditorOpener.openMatch(JavaSearchEditorOpener.java:52)
	at org.eclipse.jdt.internal.ui.search.JavaSearchResultPage.showMatch(JavaSearchResultPage.java:198)
	at org.eclipse.search.ui.text.AbstractTextSearchViewPage$7.run(AbstractTextSearchViewPage.java:938)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.search.ui.text.AbstractTextSearchViewPage.showMatch(AbstractTextSearchViewPage.java:941)
	at org.eclipse.search.ui.text.AbstractTextSearchViewPage.showCurrentMatch(AbstractTextSearchViewPage.java:1006)
	at org.eclipse.search.ui.text.AbstractTextSearchViewPage.gotoNextMatch(AbstractTextSearchViewPage.java:971)
	at org.eclipse.search.ui.text.AbstractTextSearchViewPage.handleOpen(AbstractTextSearchViewPage.java:1430)
	at org.eclipse.jdt.internal.ui.search.JavaSearchResultPage.handleOpen(JavaSearchResultPage.java:577)
	at org.eclipse.search.ui.text.AbstractTextSearchViewPage$5.open(AbstractTextSearchViewPage.java:756)
	at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)
	at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:866)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:864)
	at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1152)
	at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1256)
	at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:275)
	at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:269)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:309)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1276)
...

Sorry, no steps to reproduce it.
Comment 1 Dani Megert CLA 2012-11-19 06:57:25 EST
I can't reproduce this using 4.3 M3 and from looking at the code this should not happen. Could be a JIT bug.

Please reopen if you can reproduce this.
Comment 2 Rafael Chaves CLA 2012-11-19 10:54:07 EST
Have you seen recently other reports of bugs that were later shown to be JIT bugs? Do you have any workarounds, such as JRE version numbers known to be problematic, or JVM options that avoid the bug? I believe this was probably running on 1.6.0_22 (I later switched to the latest, 1.7.0_09).

I recently reported a whole lot of NPEs to Platform UI. If I am running a VM that is not to be trusted, I probably should let them know.
Comment 3 Dani Megert CLA 2012-11-19 10:58:28 EST
(In reply to comment #2)
> Have you seen recently other reports of bugs that were later shown to be JIT
> bugs?

Nope.


> Do you have any workarounds, such as JRE version numbers known to be
> problematic, or JVM options that avoid the bug? I believe this was probably
> running on 1.6.0_22 (I later switched to the latest, 1.7.0_09).

1.7.0_09 should be fine.

 
> I recently reported a whole lot of NPEs to Platform UI. If I am running a VM
> that is not to be trusted, I probably should let them know.

Yep. Please cc me.
Comment 4 Rafael Chaves CLA 2012-12-01 19:47:13 EST
I still don't have steps, but I see this very often. What makes it happen and what makes it go away is unclear, but it is definitely there. Seen it with JDK 1.6.0_20 and 1.7.0_09.
Comment 5 Rafael Chaves CLA 2012-12-01 19:56:46 EST
In case it helps, this shows a NPE in AbstractTextEditor in apparently similar code (access to the getTextWidget() returning null): 

http://forums.gentoo.org/viewtopic-t-890192-start-0.html
Comment 6 Dani Megert CLA 2012-12-03 02:59:46 EST
I can leave the bug in the open state if you like that better, but we will not be able to do anything unless more details are given.
Comment 7 Dani Megert CLA 2012-12-03 03:06:41 EST
(In reply to comment #4)
> I still don't have steps, but I see this very often.

If this happens very often, then you might take some time and remote debug your workspace to get more data.
Comment 8 Rafael Chaves CLA 2012-12-03 03:22:57 EST
No, feel free to re-resolve. Thought the expectation was that I reopened it if I saw it again, as it was initially dismissed as an impossible code path, which doesn't really seem to be the case.
Comment 9 Dani Megert CLA 2012-12-03 03:32:22 EST
(In reply to comment #8)
> No, feel free to re-resolve. Thought the expectation was that I reopened it
> if I saw it again, as it was initially dismissed as an impossible code path,
> which doesn't really seem to be the case.

Let's try to figure out what's happening. Maybe you can see what's going on via remote debugging:
http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Fconcepts%2Fcremdbug.htm
Comment 10 Rafael Chaves CLA 2012-12-03 12:17:10 EST
Alright, will be running Eclipse with JPDA enabled for the next while. Restarting Eclipse makes the problem go away. When it comes back, any specific things I should be looking for? Any assumptions you would expect to hold that may be being broken?
Comment 11 Rafael Chaves CLA 2012-12-03 13:26:07 EST
Just got it to happen again. Basically, I was able to reproduce it as soon as I noticed a symptom of another (Platform/UI) bug where the editor area just disappears in a perspective and I have to reset the perspective to bring it back. 

Turns out there is a "Widget is disposed" SWT exception preceding it:

org.eclipse.swt.SWTException: Widget is disposed
	at org.eclipse.swt.SWT.error(SWT.java:4361)
	at org.eclipse.swt.SWT.error(SWT.java:4276)
	at org.eclipse.swt.SWT.error(SWT.java:4247)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:480)
	at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:417)
	at org.eclipse.swt.custom.CTabFolder.getMaximizeVisible(CTabFolder.java:998)
	at org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon$4.mouseDoubleClick(MinMaxAddon.java:207)
	at ...

From there on, I can always see the NPE in initializeViewerColors (I guess that causes getTextWidget() to return null).

I still don't have steps for the SWTException "Widget is disposed" but at least it should be safe to assume this is not a search bug but a Platform UI bug, probably a duplicate of bug 394496.
Comment 12 Dani Megert CLA 2012-12-04 03:30:48 EST
(In reply to comment #11)
> Just got it to happen again. Basically, I was able to reproduce it as soon
> as I noticed a symptom of another (Platform/UI) bug where the editor area
> just disappears in a perspective and I have to reset the perspective to
> bring it back. 
> 
> Turns out there is a "Widget is disposed" SWT exception preceding it:
> 
> org.eclipse.swt.SWTException: Widget is disposed
> 	at org.eclipse.swt.SWT.error(SWT.java:4361)
> 	at org.eclipse.swt.SWT.error(SWT.java:4276)
> 	at org.eclipse.swt.SWT.error(SWT.java:4247)
> 	at org.eclipse.swt.widgets.Widget.error(Widget.java:480)
> 	at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:417)
> 	at org.eclipse.swt.custom.CTabFolder.getMaximizeVisible(CTabFolder.java:998)
> 	at
> org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon$4.
> mouseDoubleClick(MinMaxAddon.java:207)
> 	at ...
> 
> From there on, I can always see the NPE in initializeViewerColors (I guess
> that causes getTextWidget() to return null).
> 
> I still don't have steps for the SWTException "Widget is disposed" but at
> least it should be safe to assume this is not a search bug but a Platform UI
> bug, probably a duplicate of bug 394496.

Yes, it looks like this bug here is a follow-up of bug 394496 which causes the parts not being properly disposed and hence search tries to reuse a dead part.

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