-
Bug
-
Resolution: Not an Issue
-
P3
-
7
-
x86
-
windows_vista
In JDK6 (6u14 b03 promotion for example), ZipOutputStream.finish() will throw a ZipException if no ZipEntry has been added. However, this is not the case in JDK7 (7 b52 promotion for example). And there's is no doc change for this behaviour change.
The following are tese code, along with output for 6u14 b03 promotion bundle and 7 b52 promotion bundle, respectively.
=======Begin of the code=============
import java.util.zip.*;
public class CloseTest_ZipOutputStream{
public static void main(String args[]) throws Exception {
ZipOutputStream zos = new ZipOutputStream(System.out);
zos.close();
}
}
=====End of the Code=========
// Output for JDK6u14 b03 promotion bundle
Exception in thread "main" java.util.zip.ZipException: ZIP file must have at least one entry
at java.util.zip.ZipOutputStream.finish(Unknown Source)
at java.util.zip.DeflaterOutputStream.close(Unknown Source)
at java.util.zip.ZipOutputStream.close(Unknown Source)
at CloseTest_ZipOutputStream.main(CloseTest_ZipOutputStream.java:7)
// Output for jdk7 b52 promotion bundle (XXX are some unrecognizable characters)
PKXXXXXXXXXXXXXXXXXXXX
The following are tese code, along with output for 6u14 b03 promotion bundle and 7 b52 promotion bundle, respectively.
=======Begin of the code=============
import java.util.zip.*;
public class CloseTest_ZipOutputStream{
public static void main(String args[]) throws Exception {
ZipOutputStream zos = new ZipOutputStream(System.out);
zos.close();
}
}
=====End of the Code=========
// Output for JDK6u14 b03 promotion bundle
Exception in thread "main" java.util.zip.ZipException: ZIP file must have at least one entry
at java.util.zip.ZipOutputStream.finish(Unknown Source)
at java.util.zip.DeflaterOutputStream.close(Unknown Source)
at java.util.zip.ZipOutputStream.close(Unknown Source)
at CloseTest_ZipOutputStream.main(CloseTest_ZipOutputStream.java:7)
// Output for jdk7 b52 promotion bundle (XXX are some unrecognizable characters)
PKXXXXXXXXXXXXXXXXXXXX
- relates to
-
JDK-6440786 Cannot create a ZIP file containing zero entries
-
- Closed
-