Integrated: 8377461: Add ZipFile test for incorrect number of entries reported in ENDTOT
Eirik Bjørsnøs
eirbjo at openjdk.org
Wed Feb 11 16:47:04 UTC 2026
On Mon, 9 Feb 2026 12:27:31 GMT, Eirik Bjørsnøs <eirbjo at openjdk.org> wrote:
> Please review this PR introducing a test to verify that `ZipFile::size` reports the actual number of CEN entries in a ZIP file, despite an incorrect number being reported in the END header.
>
> Background:
>
> The `ZipFile` implementation treats `ENDTOT` as an indication, but falls back to counting CEN entries if this number is too low. After parsing the CEN, there is also code to adjust the total down to the actual count of CEN entries.
>
> The behavior of always reporting the actual number of CEN entries has no current test coverage in the JDK. It seems good to have tests excercising these code paths and protecting against regressions in this area.
>
> Verification:
>
> Verified that the new test catches introduced regressions in handling over- and underreported numbers in ENDTOT and that no existing test catches such regressions.
>
> Test-only change, `noreg-self`.
This pull request has now been integrated.
Changeset: b98899b4
Author: Eirik Bjørsnøs <eirbjo at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/b98899b441222ce9cd6a2a74e86193c091e088e6
Stats: 117 lines in 1 file changed: 117 ins; 0 del; 0 mod
8377461: Add ZipFile test for incorrect number of entries reported in ENDTOT
Reviewed-by: lancea
-------------
PR: https://git.openjdk.org/jdk/pull/29635
More information about the core-libs-dev
mailing list