Bug 195823 - ClassFormatException during class file indexing
Summary: ClassFormatException during class file indexing
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 205596 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-07-09 09:21 EDT by artur saldanha CLA
Modified: 2007-12-18 20:35 EST (History)
4 users (show)

See Also:


Attachments
jdbc driver (1.92 MB, application/java-archive)
2007-07-10 18:26 EDT, artur saldanha CLA
no flags Details
licence for jdbc driver (1015 bytes, application/java-archive)
2007-07-10 18:26 EDT, artur saldanha CLA
no flags Details
Proposed fix (2.16 KB, patch)
2007-10-10 11:40 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description artur saldanha CLA 2007-07-09 09:21:52 EDT
ClassFormatException in C:/jars/tudojar.jar|com/ibm/db2os390/sqlj/custom/DB2SQLJProfile.class. Please report this issue to JDT/Core including the problematic document

org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
	at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:342)
	at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:121)
	at org.eclipse.jdt.internal.core.search.indexing.BinaryIndexer.indexDocument(BinaryIndexer.java:622)
	at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.indexDocument(JavaSearchParticipant.java:74)
	at org.eclipse.jdt.internal.core.search.indexing.IndexManager.indexDocument(IndexManager.java:314)
	at org.eclipse.jdt.internal.core.search.indexing.AddJarFileToIndex.execute(AddJarFileToIndex.java:197)
	at org.eclipse.jdt.internal.core.search.processing.JobManager.run(JobManager.java:392)
	at java.lang.Thread.run(Unknown Source)
Comment 1 Olivier Thomann CLA 2007-07-09 09:25:22 EDT
This message was not issued in 3.2.
Would it be possible to get the corresponding .class file for further investigation?
Thanks.
Comment 2 Olivier Thomann CLA 2007-07-10 15:00:14 EDT
If you don't provide this .class file (C:/jars/tudojar.jar|com/ibm/db2os390/sqlj/custom/DB2SQLJProfile.class), there is nothing I can do.
Comment 3 artur saldanha CLA 2007-07-10 18:26:06 EDT
Created attachment 73490 [details]
jdbc driver
Comment 4 artur saldanha CLA 2007-07-10 18:26:55 EDT
Created attachment 73491 [details]
licence for jdbc driver
Comment 5 Olivier Thomann CLA 2007-07-10 21:08:45 EDT
Thanks for the data.
However it looks like these files are corrupted. Even javap cannot read them.
The magic number (0xCAFEBABE) is not there for the entry com/ibm/db2os390/sqlj/custom/DB2SQLJProfile.class.
Since the file is corrupted, the binary indexer is right to reject it.
We could silently do it instead of logging an error and log an error only in debug mode.
Comment 6 Olivier Thomann CLA 2007-07-17 09:44:00 EDT
Philippe,

Since corrupted .class files seem to be more common than expected, I think we should silently ignore them and log an error only in debug mode.
What do you think ?
Comment 7 Philipe Mulet CLA 2007-07-17 09:57:29 EDT
Being resilient is good. I would also vote for logging rather than raising an exception which looks more our bug.

BTW - how do we handle this file when reconciling against it ? Do we ignore it as well ?
Comment 8 Olivier Thomann CLA 2007-07-17 10:03:02 EDT
Right now we simply log the error. If the user doesn't look in the error view, it won't know that the indexer failed.
We cannot open this .class file using the class file reader. It seems that the .class file is corrupted since the magic number (0xCAFEBABE) that starts any .class file is not there.
So we cannot open it successfully in the class file editor, we cannot index it, etc.
I would say that we should only log in debug mode or simply leaving it as is and then the user knows that something is wrong with this .class file.
Comment 9 Olivier Thomann CLA 2007-10-10 11:33:42 EDT
*** Bug 205596 has been marked as a duplicate of this bug. ***
Comment 10 Olivier Thomann CLA 2007-10-10 11:40:32 EDT
Created attachment 80059 [details]
Proposed fix
Comment 11 Olivier Thomann CLA 2007-10-10 11:41:45 EDT
Released for 3.4M3.
No regression test added since this concerns only logging for corrupted .class files.
The logging is preserved in debug mode, and ignore otherwise.
Comment 12 Olivier Thomann CLA 2007-10-15 10:13:15 EDT
I changed the message for "ClassFormatException in .... This document seems to be a corrupted .class file. Please report this issue against the .class file vendor".
Hopefully this is better than the previous message.
Comment 13 Olivier Thomann CLA 2007-10-15 13:20:02 EDT
I released a new change. The error is logged even if the debug mode is off, but it is logged as a warning instead of an error.
The message has been changed to:
"The Java indexing could not index " + this.document.getPath() + ". This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor"
Comment 14 Jerome Lanneluc CLA 2007-10-29 12:28:07 EDT
Verified for 3.4M3 using I20071029-0010