Community
Participate
Working Groups
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.<init>()V java/lang/Throwable.<init>(Ljava/lang/String;)V java/lang/NullPointerException.<init>(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>
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.
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?
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?
Please, reopen if you have more details.
No reproduceable steps.