Community
Participate
Working Groups
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)
Don't you have any test case on which this NPE occurs? What do you mean by: "specify 'serach in selection)"?
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 { }
Also happens in 3.0.1
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
NPE is fixed. Open a new bug for the problem with duplicate package fragments. Verified in I20050330-0500