Bug 15211 - NPE while searching for a field
Summary: NPE while searching for a field
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 2.0 F2   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-05-03 12:13 EDT by Peter Burka CLA
Modified: 2002-06-03 12:08 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Burka CLA 2002-05-03 12:13:58 EDT
Build M5

I tried to open a hierarchy browser by pressing F4 from inside a .java file 
editor. An error dialog appeared saying that an error had occurred in the 
search engine.

The following error was in my .log file:

<log-entry date="Fri May 03 12:11:39 EDT 2002">
  <status
     message="Internal Error"
     severity="ERROR"
     code="1"
     plugin-id="org.eclipse.jdt.ui">
    <exception
       trace="
java.lang.reflect.InvocationTargetException: java.lang.NullPointerException

Stack trace:
   java/lang/Throwable.&lt;init&gt;()V
   java/lang/Throwable.&lt;init&gt;(Ljava/lang/String;)V
   java/lang/NullPointerException.&lt;init&gt;(Ljava/lang/String;)V
   org/eclipse/jdt/internal/ui/search/JavaSearchResultCollector.accept
(Lorg/eclipse/core/resources/IResource;IILorg/eclipse/jdt/core/IJavaElement;I)V
   org/eclipse/jdt/internal/core/search/matching/MatchLocator.report
(Lorg/eclipse/core/resources/IResource;IILorg/eclipse/jdt/core/IJavaElement;I)V
   org/eclipse/jdt/internal/core/search/matching/MatchLocator.report
(IILorg/eclipse/jdt/core/IJavaElement;I)V
   
org/eclipse/jdt/internal/core/search/matching/MatchLocator.reportAccurateRefere
nce(II[[CLorg/eclipse/jdt/core/IJavaElement;I)V
   
org/eclipse/jdt/internal/core/search/matching/FieldReferencePattern.matchReport
Reference
(Lorg/eclipse/jdt/internal/compiler/ast/AstNode;Lorg/eclipse/jdt/core/IJavaElem
ent;ILorg/eclipse/jdt/internal/core/search/matching/MatchLocator;)V
   org/eclipse/jdt/internal/core/search/matching/MatchLocator.reportReference
(Lorg/eclipse/jdt/internal/compiler/ast/AstNode;Lorg/eclipse/jdt/internal/compi
ler/ast/AbstractMethodDeclaration;Lorg/eclipse/jdt/core/IJavaElement;I)V
   org/eclipse/jdt/internal/core/search/matching/MatchSet.reportMatching
(Lorg/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration;Lorg/eclipse/
jdt/core/IJavaElement;)V
   org/eclipse/jdt/internal/core/search/matching/MatchSet.reportMatching
(Lorg/eclipse/jdt/internal/compiler/ast/TypeDeclaration;Lorg/eclipse/jdt/core/I
JavaElement;)V
   org/eclipse/jdt/internal/core/search/matching/MatchSet.reportMatching
(Lorg/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration;)V
   
org/eclipse/jdt/internal/core/search/matching/MatchingOpenable.locateMatchesInC
ompilationUnit([C)V
   org/eclipse/jdt/internal/core/search/matching/MatchingOpenable.locateMatches
()V
   org/eclipse/jdt/internal/core/search/matching/MatchLocator.locateMatches
(Lorg/eclipse/jdt/internal/core/JavaProject;Lorg/eclipse/core/runtime/IProgress
Monitor;)V
   org/eclipse/jdt/internal/core/search/matching/MatchLocator.locateMatches
([Ljava/lang/String;Lorg/eclipse/core/resources/IWorkspace;
[Lorg/eclipse/jdt/core/IWorkingCopy;Lorg/eclipse/core/runtime/IProgressMonitor;
)V
   org/eclipse/jdt/core/search/SearchEngine.search
(Lorg/eclipse/core/resources/IWorkspace;Lorg/eclipse/jdt/core/search/ISearchPat
tern;Lorg/eclipse/jdt/core/search/IJavaSearchScope;Lorg/eclipse/jdt/core/search
/IJavaSearchResultCollector;)V
   org/eclipse/jdt/core/search/SearchEngine.search
(Lorg/eclipse/core/resources/IWorkspace;Lorg/eclipse/jdt/core/IJavaElement;ILor
g/eclipse/jdt/core/search/IJavaSearchScope;Lorg/eclipse/jdt/core/search/IJavaSe
archResultCollector;)V
   org/eclipse/jdt/internal/ui/search/JavaSearchOperation.execute
(Lorg/eclipse/core/runtime/IProgressMonitor;)V
   org/eclipse/ui/actions/WorkspaceModifyOperation$1.run
(Lorg/eclipse/core/runtime/IProgressMonitor;)V
   org/eclipse/core/internal/resources/Workspace.run
(Lorg/eclipse/core/resources/IWorkspaceRunnable;Lorg/eclipse/core/runtime/IProg
ressMonitor;)V
   org/eclipse/ui/actions/WorkspaceModifyOperation.run
(Lorg/eclipse/core/runtime/IProgressMonitor;)V
   org/eclipse/jface/operation/ModalContext$ModalContextThread.run()V

"
       message="null">
    </exception>
  </status>
</log-entry>
Comment 1 Peter Burka CLA 2002-05-03 12:21:10 EDT
I think that I might have been wrong about what I was doing when this error 
occurred.

I think that the open-in-hierarchy view had actually succeeded, and then I was 
searching within that editor for references to an instance variable.

On exiting and restarting Eclipse searching seems to work OK again.

Sorry about the misinformation.
Comment 2 Erich Gamma CLA 2002-05-04 06:10:51 EDT
The walkback indicates that the crash occurred during a reference search to a 
field. 

MatchLocator passes in an IResource and the enclosingElement. The API specifies 
that enclosingElement can be null and the ResultCollector handles this case.
The other possibility is that an null IResource is passed which is not 
specified in the API. 

Philippe can it happen that an null resource is passed in and the code has to 
protect against this case?
Comment 3 Jerome Lanneluc CLA 2002-05-07 11:19:02 EDT
No, null should never be passed to the result collector. 

Peter, I would need your help. If you don't have a test case, could you answer 
the following:
1. Do you know the class the match should be reported in? 
2. Do you know if this class is in a jar file? 
3. Does it have source attached?
Comment 4 Jerome Lanneluc CLA 2002-05-27 05:05:21 EDT
Please, reopen if you have more details.
Comment 5 Kent Johnson CLA 2002-06-03 12:08:58 EDT
No reproduceable steps.