RFR: 8343307: Throw ZipException instead of IAE in ZipFile.Source::initCEN
Eirik Bjørsnøs
eirbjo at openjdk.org
Wed Oct 30 17:43:38 UTC 2024
Please review this PR which makes `ZipFile.Source::initCEN` throw `java.util.zip.ZipException` instead of `java.lang.IllegalArgumentException` when calling `ZipCoder::checkedHash` during `META-INF/versions/` parsing.
This is a follow-up to #21489 where the IAE was introduced on the premise that the earlier call to `ZipCoder::checkedHash` in `checkAndAddEntry` would already have thrown `ZipException`, so this was more of a "will never happen" assertion.
However, it's better to just be consistent and throw `ZipException`.
Testing: Added `noreg-cleanup` to the JBS. Unclear how this exception could be tested since it's shadowed by the earlier invocation of `checkedHash`. ZIP tests run green locally, GHA pending.
-------------
Commit messages:
- Throw ZipException instead of IAE when ZipCoder::checkedHash fails with exception
Changes: https://git.openjdk.org/jdk/pull/21791/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21791&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8343307
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/21791.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/21791/head:pull/21791
PR: https://git.openjdk.org/jdk/pull/21791
More information about the core-libs-dev
mailing list