RFR: 8377461: Add ZipFile test for incorrect number of entries reported in ENDTOT [v2]

Eirik Bjørsnøs eirbjo at openjdk.org
Tue Feb 10 06:05:15 UTC 2026


> 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`.

Eirik Bjørsnøs has updated the pull request incrementally with two additional commits since the last revision:

 - Add case: Empty ZIP, correct ENDTOT
 - Copyright 2026 for new test

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/29635/files
  - new: https://git.openjdk.org/jdk/pull/29635/files/c499a9c5..5bc8b762

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=29635&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29635&range=00-01

  Stats: 3 lines in 1 file changed: 1 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/29635.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29635/head:pull/29635

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


More information about the core-libs-dev mailing list