Bug 90233

Summary: [search] NPE during search
Product: [Eclipse Project] JDT Reporter: Rafael Chaves <eclipse>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: morten-eclipse
Version: 3.1   
Target Milestone: 3.1 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Rafael Chaves CLA 2005-04-04 19:11:45 EDT
3.1 m6
java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition
java.runtime.version=1.5.0-b64

I started getting the following NPE every time I searched for references to a 
specific method. Don't know how to reproduce. I had just deleted that method,
saved, undone my changes (restoring the method), saved again, and looked for
references to that method.

!ENTRY org.eclipse.core.runtime 4 2 2005-04-04 19:05:15.768
!MESSAGE An internal error occurred during: "Java Search".
!STACK 0
java.lang.NullPointerException
	at
org.eclipse.jdt.internal.core.search.matching.MethodLocator.matchReportReference(MethodLocator.java:217)
	at
org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching(MatchLocator.java:1775)
	at
org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching(MatchLocator.java:2039)
	at
org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching(MatchLocator.java:1842)
	at
org.eclipse.jdt.internal.core.search.matching.MatchLocator.process(MatchLocator.java:1384)
	at
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:929)
	at
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:968)
	at
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1070)
	at
org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:94)
	at
org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:208)
	at
org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:394)
	at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:532)
	at org.eclipse.jdt.internal.ui.search.JavaSearchQuery.run(JavaSearchQuery.java:131)
	at
org.eclipse.search2.internal.ui.InternalSearchUI$InternalSearchJob.run(InternalSearchUI.java:93)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:67)
Comment 1 Rafael Chaves CLA 2005-04-04 19:20:34 EDT
Note that looking for the references in the same project, the NPE does not
occur. Looking for references in the workspace (the method is private static),
causes the NPE.
Comment 2 Rafael Chaves CLA 2005-04-04 19:31:50 EDT
I soon started having problems searching for references to other methods (not
sure was looking in the same project or the entire workspace), so I had to
restart Eclipse. I haven't seen the problem since then.
Comment 3 Frederic Fusier CLA 2005-04-05 04:54:03 EDT
Raphael,
Looking at code + the fact that you cannot reproduce it sounds more as a VM
issue rather than a code issue.
Line 217 is:
    if (isPrivate && !CharOperation.equals(method.declaringClass.sourceName,
        focus.getParent().getElementName().toCharArray())) {

I've verified that:
1) method cannot be null and same for its declaringClass
2) focus cannot be null + Java Model insure that all elements have parent and
name (otherwise all JDT/Core would dump multiple NPEs...).

As you cannot reproduce, I will put this bug in REMIND and let you reopen it as
soon as you see this issue again with hopefully a detailed test case to
reproduce it.

TIA
Comment 4 Frederic Fusier CLA 2005-04-22 12:21:16 EDT
Reopen as I got one reproduceable example in duplicate bug.
Comment 5 Frederic Fusier CLA 2005-04-22 12:21:36 EDT

*** This bug has been marked as a duplicate of 92315 ***
Comment 6 Felipe Heidrich CLA 2005-05-17 15:24:01 EDT
*** Bug 95466 has been marked as a duplicate of this bug. ***