Bug 85944 - errors during background indexing should be more descriptive
Summary: errors during background indexing should be more descriptive
Status: RESOLVED DUPLICATE of bug 81503
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-21 05:38 EST by Michael Illgner CLA
Modified: 2006-03-28 09:58 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Illgner CLA 2005-02-21 05:38:27 EST
During checkout out of an acient source code management system, some of our jars
and zips got corrupted, which was not noticed during the checkout process (This
is clearly no eclipse problem ;-)
Now we add this corrupt jars to a eclipse java project and got some mysterious
erros like empty type lists, messages like "no types available" during "Open
Type" etc. 
In the eclipse .log we have found messages like 
!ENTRY org.eclipse.jdt.core 4 4 Feb 21, 2005 09:47:36.795
!MESSAGE Background Indexer Crash Recovery
!STACK 0
java.lang.ArrayIndexOutOfBoundsException: 37772
	at
org.eclipse.jdt.internal.compiler.classfmt.ClassFileStruct.utf8At(ClassFileStruct.java:84)
	at
org.eclipse.jdt.internal.compiler.classfmt.MethodInfo.readExceptionAttributes(MethodInfo.java:156)
	at
org.eclipse.jdt.internal.compiler.classfmt.MethodInfo.getExceptionTypeNames(MethodInfo.java:59)
	at
org.eclipse.jdt.internal.core.search.indexing.BinaryIndexer.indexDocument(BinaryIndexer.java:498)
	at
org.eclipse.jdt.internal.core.search.JavaSearchParticipant.indexDocument(JavaSearchParticipant.java:74)
	at
org.eclipse.jdt.internal.core.search.indexing.IndexManager.indexDocument(IndexManager.java:290)
	at
org.eclipse.jdt.internal.core.search.indexing.AddJarFileToIndex.execute(AddJarFileToIndex.java:173)
	at
org.eclipse.jdt.internal.core.search.processing.JobManager.run(JobManager.java:363)
	at java.lang.Thread.run(Unknown Source)

!ENTRY org.eclipse.jdt.core 4 4 Feb 21, 2005 09:49:35.506
!MESSAGE Background Indexer Crash Recovery
!STACK 0
java.lang.ArrayIndexOutOfBoundsException: 37772
	at
org.eclipse.jdt.internal.compiler.classfmt.ClassFileStruct.utf8At(ClassFileStruct.java:84)
	at
org.eclipse.jdt.internal.compiler.classfmt.MethodInfo.readExceptionAttributes(MethodInfo.java:156)
	at
org.eclipse.jdt.internal.compiler.classfmt.MethodInfo.getExceptionTypeNames(MethodInfo.java:59)
	at
org.eclipse.jdt.internal.core.search.indexing.BinaryIndexer.indexDocument(BinaryIndexer.java:498)
	at
org.eclipse.jdt.internal.core.search.JavaSearchParticipant.indexDocument(JavaSearchParticipant.java:74)
	at
org.eclipse.jdt.internal.core.search.indexing.IndexManager.indexDocument(IndexManager.java:290)
	at
org.eclipse.jdt.internal.core.search.indexing.AddJarFileToIndex.execute(AddJarFileToIndex.java:173)
	at
org.eclipse.jdt.internal.core.search.processing.JobManager.run(JobManager.java:363)
	at java.lang.Thread.run(Unknown Source)

but no hint which file causes this error. 
Is it possible to give a more specific error message, either in the .log file or
even as an explicit error message in the eclipse GUI ?
Comment 1 Olivier Thomann CLA 2005-02-21 15:34:28 EST
I would say that these corrupted .class files should simply be ignored. In order
to do this, the BinaryIndex should fully initialize the .class files.

Should replace:
ClassFileReader reader = new ClassFileReader(contents,
this.document.getPath().toCharArray());
with:
ClassFileReader reader = new ClassFileReader(contents,
this.document.getPath().toCharArray(), true);

Then the ArrayIndexOutOfBoundsException would be converted to a
ClassFormatException.

Or we can add checks in the decoding of the method info to protect it from
ArrayIndexOutOfBoundsException.
Comment 2 Michael Illgner CLA 2005-02-21 16:00:49 EST
In my opinion, it is not important which kind of exception is thrown, but the
user must be clearly informed which corrupt jar or class has caused it. It took
us   some hours of trial and error to to find out the corrupt archive.
It is possible to show these kind of errors in the "normal" problem view ? 
Comment 3 Jerome Lanneluc CLA 2006-03-28 09:58:51 EST

*** This bug has been marked as a duplicate of 81503 ***