-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
b37
-
x86
-
windows_xp
-
Not verified
FULL PRODUCT VERSION :
1.5.0_07
1.6.0-beta2-b85
A DESCRIPTION OF THE PROBLEM :
Using a ZipOutputStream, I cannot create a ZIP file which contains no entries. This should be allowed (see bug 6334003).
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.util.zip.ZipException: ZIP file must have at least one entry
at java.util.zip.ZipOutputStream.finish(ZipOutputStream.java:304)
at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:146)
at java.util.zip.ZipOutputStream.close(ZipOutputStream.java:321)
at Test.main(Test.java:9)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
// Try to create a ZIP file with no entries. This will fail with
// the following exception: "ZIP file must have at least one entry".
// See also bug 6334003.
import java.io.FileOutputStream;
import java.util.zip.ZipOutputStream;
public class Test {
public static void main(String[] args) {
try {
ZipOutputStream zip = new ZipOutputStream(new FileOutputStream("test.zip"));
zip.close();
}
catch(Exception ex) {
ex.printStackTrace();
}
}
}
---------- END SOURCE ----------
1.5.0_07
1.6.0-beta2-b85
A DESCRIPTION OF THE PROBLEM :
Using a ZipOutputStream, I cannot create a ZIP file which contains no entries. This should be allowed (see bug 6334003).
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.util.zip.ZipException: ZIP file must have at least one entry
at java.util.zip.ZipOutputStream.finish(ZipOutputStream.java:304)
at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:146)
at java.util.zip.ZipOutputStream.close(ZipOutputStream.java:321)
at Test.main(Test.java:9)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
// Try to create a ZIP file with no entries. This will fail with
// the following exception: "ZIP file must have at least one entry".
// See also bug 6334003.
import java.io.FileOutputStream;
import java.util.zip.ZipOutputStream;
public class Test {
public static void main(String[] args) {
try {
ZipOutputStream zip = new ZipOutputStream(new FileOutputStream("test.zip"));
zip.close();
}
catch(Exception ex) {
ex.printStackTrace();
}
}
}
---------- END SOURCE ----------
- relates to
-
JDK-6334003 ZipFile throws ZipException on open a empty zipfile from winzip
-
- Closed
-
-
JDK-8048990 ZipFile.entries() can't handle empty zip entry names
-
- Closed
-
-
JDK-6828159 The ZipOutputStream.finish() method changed without corresponding modification in jdk7 doc
-
- Closed
-
-
JDK-4971117 ZipException thrown when empty jar file in classpath
-
- Closed
-