Integrated: 8343307: Throw ZipException instead of IAE in ZipFile.Source::initCEN

Eirik Bjørsnøs eirbjo at openjdk.org
Thu Oct 31 08:35:33 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.

This pull request has now been integrated.

Changeset: 2f1ba5ef
Author:    Eirik Bjørsnøs <eirbjo at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/2f1ba5ef09441ed9e505fe2e17c57ccb1771f777
Stats:     1 line in 1 file changed: 0 ins; 0 del; 1 mod

8343307: Throw ZipException instead of IAE in ZipFile.Source::initCEN

Reviewed-by: lancea, jpai

-------------

PR: https://git.openjdk.org/jdk/pull/21791


More information about the core-libs-dev mailing list