RFR: 8345431: Improve jar --validate to detect duplicate or invalid entries [v12]
Jaikiran Pai
jpai at openjdk.org
Thu May 22 11:26:58 UTC 2025
On Thu, 22 May 2025 01:29:12 GMT, Henry Jen <henryjen at openjdk.org> wrote:
>> This PR check the jar file to ensure entries are consistent from the central directory and local file header. Also check there is no duplicate entry names that could override the desired content by accident.
>
> Henry Jen has updated the pull request incrementally with one additional commit since the last revision:
>
> Validator to take a file, use term JAR file
src/jdk.jartool/share/classes/sun/tools/jar/Validator.java line 185:
> 183: // Encounter order in CEN, step by 1 on each new entry
> 184: int cenEncounterOrder = 0;
> 185: // Encounter order in LOC, step by 1 for new LOC entry exist in CEN
Nit - "for new LOC entry that exists in CEN"
src/jdk.jartool/share/classes/sun/tools/jar/Validator.java line 208:
> 206: /**
> 207: * Record an entry apperance in LOC
> 208: * We compare entry order based on the CEN. Thus do not step LOC
Nit - would "Thus do not increment LOC ..." be easier to understand? You don't have to do the change if you prefer it this way (I see that we use the same term on the comment of the `cenEncounterOrder` and `locEncounterOrder` fields.
src/jdk.jartool/share/classes/sun/tools/jar/Validator.java line 238:
> 236: /**
> 237: * Validation per entry observed.
> 238: * Each entry must appeared at least oncee in CEN or LOC.
A couple of typos - "Each entry must appear at least once in the CEN or LOC"
src/jdk.jartool/share/classes/sun/tools/jar/Validator.java line 265:
> 263:
> 264: /**
> 265: * Validate the jar entries by check each entry in encounter order
Typo - "by checking ..."
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24430#discussion_r2102312203
PR Review Comment: https://git.openjdk.org/jdk/pull/24430#discussion_r2102312688
PR Review Comment: https://git.openjdk.org/jdk/pull/24430#discussion_r2102316444
PR Review Comment: https://git.openjdk.org/jdk/pull/24430#discussion_r2102321661
More information about the core-libs-dev
mailing list