|
Quick Lists
|
|
Bug ID:
|
6295519
|
|
Votes
|
12
|
|
Synopsis
|
javac throws ZipException when you have invalid files in classpath
|
|
Category
|
java:compiler
|
|
Reported Against
|
b05
|
|
Release Fixed
|
mustang(b78),
5.0u7(b01) (Bug ID:2130127)
|
|
State
|
10-Fix Delivered,
bug
|
|
Priority:
|
2-High
|
|
Related Bugs
|
6343932
,
4977607
,
6236704
|
|
Submit Date
|
11-JUL-2005
|
|
Description
|
javac throws a ZipException if you have a non-jar/non-zip file in the classpath. For example, the following command on a Linux system throws an exception
$ javac -classpath .:/usr/lib/libm.so Test.java
The documentation says that it should ignore non-jar/non-zip files. See <http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/classpath.html>. This is a regression from 1.4. 1.4 ignores such files, 1.5 does not. We see similar behaviour on our MacOSX version.
Looking at the code, I found the following code in src/share/classes/com/sun/tools/javac/util/Paths.java
/** Is this the name of a zip file? */
private static boolean isZip(String name) {
return new File(name).isFile();
}
This looks suspicious. It seems the code just checks to see if the file exists. It does not check to see if it is a valid zip file. bug 4971117 is slightly different but (I think) related to this bug.
Release Regression From : 5.0u2
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
xxxxx@xxxxx 2005-07-11 21:17:32 GMT
|
|
Work Around
|
Deleted text.
|
|
Evaluation
|
Contrary to the submitter's statement,
this problem also exists in 5.0u2.
$ /usr/java/jdk1.5.0/bin/javac -J-showversion -classpath .:/usr/lib/libm.so Test.java
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)
error: error reading /usr/lib/libm.so; java.util.zip.ZipException: error in opening zip file
1 error
$ /usr/java/jdk1.5.0_01/bin/javac -J-showversion -classpath .:/usr/lib/libm.so Test.java
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode)
error: error reading /usr/lib/libm.so; java.util.zip.ZipException: error in opening zip file
1 error
$ /usr/java/jdk1.5.0_02/bin/javac -J-showversion -classpath .:/usr/lib/libm.so Test.java
java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode, sharing)
error: error reading /usr/lib/libm.so; java.util.zip.ZipException: error in opening zip file
1 error
xxxxx@xxxxx 2005-07-12 02:59:31 GMT
|
|
Comments
|
Submitted On 28-OCT-2005
JonRWoods
I find the problem also exists in build 1.5.0_05-b05 (update 5) for Windows. The error reported above occurs even if the classpath contains only valid .class files:
>javac -J-showversion -classpath Test1.class Test2.java
java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode, sharing)
error: error reading Test1.class; error in opening zip file
1 error
Submitted On 16-FEB-2006
Testing
Any workaround to it.
Submitted On 20-JUL-2007
Has this issue been solved yet? I am having the same problem.
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |