Bug 83388 - [search] SearchRequestor reports 'null' as match
Summary: [search] SearchRequestor reports 'null' as match
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M6   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-21 07:29 EST by Martin Aeschlimann CLA
Modified: 2005-03-30 15:45 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2005-01-21 07:29:00 EST
20050121

Not sure if thi is reporducable: Search for an import declaration. Select the
found result in the search result view, open the search dialog on it and specify
'serach in selection)

The null seems to come from MatchLocator.newDeclarationMatch

java.lang.NullPointerException
	at
org.eclipse.jdt.internal.ui.search.NewSearchResultCollector.acceptSearchMatch(NewSearchResultCollector.java:31)
	at
org.eclipse.jdt.internal.core.search.matching.MatchLocator.report(MatchLocator.java:1406)
	at
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locatePackageDeclarations(MatchLocator.java:1081)
	at
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locatePackageDeclarations(MatchLocator.java:1064)
	at
org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:99)
	at
org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:196)
	at
org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:382)
	at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:512)
	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:66)
Comment 1 Frederic Fusier CLA 2005-01-21 07:47:34 EST
Don't you have any test case on which this NPE occurs?
What do you mean by: "specify 'serach in selection)"?
Comment 2 Martin Aeschlimann CLA 2005-01-21 08:34:25 EST
In the search dialog, Java page, scope 'Selected resources'. But I realized it's
not important:

- create the following class
- set the cursor on 'pack' in the package statement and search for references
- In the search result view (tree mode) select the match in the import
declarations (Make sure you don't filter matches in imports)
- Open the search dialog and search

package pack;
import pack.*;
public class R {
}


Comment 3 Frederic Fusier CLA 2005-02-28 11:44:26 EST
Also happens in 3.0.1
Comment 4 Frederic Fusier CLA 2005-02-28 14:47:46 EST
Fixed.

Now search engine report a non-null match in this peculiar case.
Note that this fix slighlty changes match associated element when a package
declaration is selected to perform this kind of search (see bug 73551). Instead
of a IPackageDeclaration, it is now a IPackageFragment which is a more accurate
element for the match.

[jdt-core-internal]
Changes done in MatchLocator.locatePackageDeclarations(...)
Test case added in JavaSearchBugsTests
Test case for bug 73551 modified to reflect change of associated element
Comment 5 Olivier Thomann CLA 2005-03-30 15:45:42 EST
NPE is fixed.
Open a new bug for the problem with duplicate package fragments.
Verified in I20050330-0500