Community
Participate
Working Groups
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 ?
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.
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 ?
*** This bug has been marked as a duplicate of 81503 ***