JDK-5105554 : RFE: More specific error message when a jar or zip is corrupt
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.jar
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-09-22
  • Updated: 2014-01-16
Related Reports
Relates :  
Description
Name: jl125535			Date: 09/22/2004


A DESCRIPTION OF THE REQUEST :
When java.util.zip.ZipFile parses a corrupt jar or zip file, a typical result is an error message like the one below.  It would be more helpful if the error message stated that the jar or zip file appears to be corrupt.

<ERROR_MESSAGE>
An exception has occurred in the compiler (1.5.0-rc). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report.  Thank you.
java.lang.InternalError: jzentry == 0,
 jzfile = 74342920,
 total = 212,
 name = Q:\projects\3rdparty\antlr-2.7.4\antlr.jar,
 i = 1,
 message = couldn't read CEN extra
	at java.util.zip.ZipFile$3.nextElement(ZipFile.java:427)
	at java.util.zip.ZipFile$3.nextElement(ZipFile.java:413)
	at com.sun.tools.javac.jvm.ClassReader.openArchive(ClassReader.java:1442)
...
</ERROR_MESSAGE>


JUSTIFICATION :
The current error message implies that the best course of action is to submit a bug report.  But as evidenced by the Evaluation of http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4977607, it is faster and more effective to replace the offending file.
(Incident Review ID: 311444) 
======================================================================

Comments
EVALUATION I believe the quality of the error message has significantly improved in mustang, but there is still much room for improvement.
19-08-2005

EVALUATION Agreed. In particular, invalid data should never generate an InternalError. This kind of thing is hard to get right because of the large variety of corruption modes, and the imperative for speed in the jar grokking code. ###@###.### 2004-09-24
24-09-2004