Bug 107124 - NullPointerException at ClassFileStruct.u2At
Summary: NullPointerException at ClassFileStruct.u2At
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-16 12:03 EDT by Scott Ellis CLA
Modified: 2005-09-20 14:06 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 Scott Ellis CLA 2005-08-16 12:03:26 EDT
On the night of 8/15/2005 we hit this npe during BEA internal tests:

java.lang.NullPointerException
         [java]     at
org.eclipse.jdt.internal.compiler.classfmt.ClassFileStruct.u2At(ClassFileStruct.java:71)
         [java]     at
org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:117)
         [java]     at
org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:94)
         [java]     at
org.eclipse.jdt.internal.core.search.indexing.BinaryIndexer.indexDocument(BinaryIndexer.java:443)
         [java]     at
org.eclipse.jdt.internal.core.search.JavaSearchParticipant.indexDocument(JavaSearchParticipant.java:74)
         [java]     at
org.eclipse.jdt.internal.core.search.indexing.IndexManager.indexDocument(IndexManager.java:290)
         [java]     at
org.eclipse.jdt.internal.core.search.indexing.IndexManager$1.execute(IndexManager.java:601)
         [java]     at
org.eclipse.jdt.internal.core.search.processing.JobManager.run(JobManager.java:372)
         [java]     at java.lang.Thread.run()V(Unknown Source)
Comment 1 Olivier Thomann CLA 2005-08-16 12:29:03 EDT
Would you have steps to reproduce?
This would mean that the byte array is null.
Comment 2 Scott Ellis CLA 2005-08-16 12:32:46 EDT
No, sorry, I don't have repro steps.  Seems to have just come out of the blue.
Comment 3 Olivier Thomann CLA 2005-08-16 16:22:29 EDT
This can potentially happen if the binary contents cannot be retrieved for a
document.
			byte[] contents = this.document.getByteContents();
can return null if a IOException occurs while retrieving the contents.
So the binary indexer should be protected against this.
I will add a null check.
If you get it repeatedly, then it could be interesting to run in debug mode and
enable the following options:
# Reports background indexer activity: indexing, saving index file, index queries
org.eclipse.jdt.core/debug/indexmanager=true

# Reports background indexer activity: indexing, saving index file, index queries
org.eclipse.jdt.core/debug/indexmanager=true

in the .options file of the JDT/Core plugin.
Then put this file in the same directory than the eclipse.exe that you are using.
and restart with -debug on the Eclipse command line.
Comment 4 Olivier Thomann CLA 2005-08-16 16:40:53 EDT
Fixed and released in HEAD.
No regression tests added as this could only happen if a IOException occurs
while retrieving the contents of a search document.
Comment 5 Olivier Thomann CLA 2005-09-20 14:06:01 EDT
Verified using I20050920-0010 for 3.2M2