[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.jdt] Re: NullPointerException in search

Chris Senior wrote:

I am running a search in a workspace containing 1 java project. And I get the an NPE (see trace at foot of post) when I run the following search for all classes declared in a project:

SearchPattern pattern = SearchPattern.createPattern(
"*", IJavaSearchConstants.CLASS,
IJavaSearchConstants.DECLARATIONS,
SearchPattern.R_PATTERN_MATCH | SearchPattern.R_CASE_SENSITIVE | SearchPattern.R_ERASURE_MATCH);
SearchParticipant[] participants = new SearchParticipant[] { SearchEngine
.getDefaultSearchParticipant() };
IJavaSearchScope scope = SearchEngine
.createJavaSearchScope(new IJavaElement[] { selectedProject });
searchEngine.search(pattern, participants,
scope, requestor, monitor);


Any ideas what is wrong? Interestingly, I can get jdt.ui Java search page to do the same search with no problems and I can't work out what it does differently?

- Chris


It's really interesting that it works using UI but not using directly JDT/Core API... It should help me to understand what happen here more rapidly.

May you retry these 2 searches with trace activated:
  - programmatic:
    change following Search trace static field value:
        org.eclipse.jdt.internal.core.search.BasicSearchEngine.VERBOSE=true
  - jdt.ui:
    add following line in .options file in <eclipse install dir>/eclipse directory:
        # Reports java search activity
        org.eclipse.jdt.core/debug/search=true
    shutdown/restart eclipse
    perform search

Then attach traces you get in console to bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=130241

Thanks in advance