RFR: 8343307: Throw ZipException instead of IAE in ZipFile.Source::initCEN
Jaikiran Pai
jpai at openjdk.org
Thu Oct 31 06:43:29 UTC 2024
On Wed, 30 Oct 2024 16:58:40 GMT, Eirik Bjørsnøs <eirbjo at openjdk.org> wrote:
> 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.
Thank you Eirik for the update, this looks good to me.
-------------
Marked as reviewed by jpai (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/21791#pullrequestreview-2407009410
More information about the core-libs-dev
mailing list