Bug 18920 - NPE searching for references to a message
Summary: NPE searching for references to a message
Status: VERIFIED FIXED
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 F3   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-06-03 16:59 EDT by Peter Burka CLA
Modified: 2002-06-13 08:46 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-06-03 16:59:29 EDT
Build F2

I selected a declaration of a public static method (createJavaSnippetImpl) in 
a CompilationUnitEditor, and chose 'Search'->'References'->'Workspace'. The 
progress dialog completes about 10% when a dialog appears saying that an error 
has occurred. The error below is recorded in my .log file.

The problem seems to be repeatable, but I haven't tried exiting and restarting 
yet.

!ENTRY org.eclipse.jdt.ui 4 1 Jun 03, 2002 17:08:44.890
!MESSAGE Internal Error
!STACK 0
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/core/Util.quickSort([Ljava/lang/String;II)V
   org/eclipse/jdt/internal/core/Util.sort([Ljava/lang/String;)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
Comment 1 Peter Burka CLA 2002-06-03 17:08:10 EDT
I had recently deleted a file from the same package as this message.
Comment 2 Peter Burka CLA 2002-06-03 17:23:02 EDT
I just noticed that the deleted file was still open in an editor, somehow.

I've also zipped up the contents of my 
D:\eclipse\workspace\.metadata\.plugins\org.eclipse.jdt.core directory. For 
some reason I can't add them as an attachment (it's 5MB). Please e-mail me if 
you want these. Or you can just FTP it from 
ott2f/.../accounts/peterb/public/index-for-18920.zip
Comment 3 Peter Burka CLA 2002-06-03 17:23:41 EDT
Closing the open editor seems to have made the bug go away.
Comment 4 Peter Burka CLA 2002-06-03 17:27:23 EDT
Steps to repeat:

- open a Java file and modify it
- switch editors so that the dirty file isn't the active editor
- from a second window, in the Resource perspective, delete the dirty file
- perform a search
Comment 5 Jerome Lanneluc CLA 2002-06-04 05:55:31 EDT
Thanks for the test case Peter. Note that leaving the dirty editor open is a 
feature from JDT/UI (so that you don't loose your changes).

When collecting the paths of the working copies, the match locator was 
incorrectly using getUnderlyingResource().getFullPath() that would throw an 
exception and leave the file path list with <null> if the file did not exist.

Fixed by using the handle only method getPath() on the java element instead.
Comment 6 Olivier Thomann CLA 2002-06-04 14:02:37 EDT
Verified. I got a OutOfMemoryError, but this is related to the VM args I used 
to start the self hosting workspace.
Comment 7 David Audel CLA 2002-06-13 08:46:52 EDT
Verified.