RFR: 8345431: Detect duplicate entries in jar files with jar --validate [v2]

Chen Liang liach at openjdk.org
Tue Apr 29 00:08:47 UTC 2025


On Mon, 28 Apr 2025 23:40:11 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
> 
>  - Merge remote-tracking branch 'openjdk/master' into open
>  - Enhance validation output to be more specific
>  - 8345431: Detect duplicate entries in jar files with jar --validate

src/jdk.jartool/share/classes/sun/tools/jar/Validator.java line 89:

> 87: 
> 88:     // Check if CEN contains the LOC entry by name
> 89:     private boolean checkHasCenEntry(String locEntryName) {

This method name and comment does not indicate a match is removed like the name `Next` in `checkNextCenEntry` implies - I suggest some way to indicate that a match is removed, like `checkUnorderedCenEntry`. `Has` implies a read-only operation that performs no modification.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24430#discussion_r2065075115


More information about the compiler-dev mailing list