-
Enhancement
-
Resolution: Fixed
-
P4
-
None
-
b13
The ZipFile test TestZipError.java has fallen out of sync with its original and stated purpose as described in its @summary tag, code comments and also its name.
The test was initially added inJDK-4615343 (Java 6) to exercise code paths which caused ZipFile entry enumeration to throw a ZipError (a subclass of InternalError).
With the rewrite of the ZipFile from native to Java inJDK-8145260 (JDK 9), the code tested would no longer throw ZipError and the ZipError class fell completely out of use in OpenJDK.
JDK-8145260 also updated the TestZipError.java to catch ZipException instead of ZipError for the expected/passing case. Interestingly, a line was added which cases the test to not only enumerate the entries of the updated ZipFile, but to actually consume the input stream of the entries.
This added line causes ZipFileInputStream.initDataOffset to throw a ZipException when the CEN local header offset does not contain the expected LOC header, resulting in a ZipException with the message "ZipFile invalid LOC header (bad signature)". This subtle updated caused the test to (accidentally?) test something which is actually quite different than its original purpose.
The "invalid LOC header" scenario is currently better tested by the ZipSourceCache test, which also runs on non-windows platforms.
Instead of trying to fix the name, summary, code comments of the currently confusing TestZipError.java test, I suggest that we simply retire it in favor of ZipSourceCache, which is a JUnit test and also runs on non-Windows platforms.
The test was initially added in
With the rewrite of the ZipFile from native to Java in
This added line causes ZipFileInputStream.initDataOffset to throw a ZipException when the CEN local header offset does not contain the expected LOC header, resulting in a ZipException with the message "ZipFile invalid LOC header (bad signature)". This subtle updated caused the test to (accidentally?) test something which is actually quite different than its original purpose.
The "invalid LOC header" scenario is currently better tested by the ZipSourceCache test, which also runs on non-windows platforms.
Instead of trying to fix the name, summary, code comments of the currently confusing TestZipError.java test, I suggest that we simply retire it in favor of ZipSourceCache, which is a JUnit test and also runs on non-Windows platforms.
- relates to
-
JDK-8336843 Deprecate java.util.zip.ZipError for removal
- Resolved
- links to
-
Commit(master) openjdk/jdk/b6700095
-
Review(master) openjdk/jdk/20660