RFR: 8345431: Improve jar --validate to detect duplicate or invalid entries [v11]
Jaikiran Pai
jpai at openjdk.org
Wed May 21 16:44:58 UTC 2025
On Wed, 21 May 2025 15:49:29 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:
>
> Mismatched order is considered invalid
src/jdk.jartool/share/man/jar.md line 110:
> 108:
> 109: `--validate`
> 110: : Validate the contents of the jar archive.
Validate the contents of the JAR file.
src/jdk.jartool/share/man/jar.md line 111:
> 109: `--validate`
> 110: : Validate the contents of the jar archive.
> 111: See `Integrity of a jar Archive` section below for more details.
In recent times, both in code and in API specification, we have been using `JAR` and `ZIP` (upper case) to refer to the JAR/ZIP files. For the tool itself, using the lower case jar is appropriate. Furthermore, JAR itself means Java archive, so I think we can remove the "Archive" word from that sentence. Perhaps this (and the corresponding section) should be "Integrity of a JAR file".
src/jdk.jartool/share/man/jar.md line 221:
> 219:
> 220: ## Integrity of a jar Archive
> 221: As a jar archive is based on ZIP format, it is possible to create a jar archive using tools
Nit - As a JAR file is based on ZIP format, it is possible to create a JAR file ...
src/jdk.jartool/share/man/jar.md line 223:
> 221: As a jar archive is based on ZIP format, it is possible to create a jar archive using tools
> 222: other than the `jar` command. The --validate option may be used to perform the following
> 223: integrity checks against a jar archive:
Nit - "integrity checks against a JAR file:"
src/jdk.jartool/share/man/jar.md line 225:
> 223: integrity checks against a jar archive:
> 224:
> 225: - That there are no duplicate Zip Entry file names
Nit - "... ZIP entry file names"
src/jdk.jartool/share/man/jar.md line 226:
> 224:
> 225: - That there are no duplicate Zip Entry file names
> 226: - Verify that the Zip Entry file name:
Nit - ".... ZIP entry file name:"
src/jdk.jartool/share/man/jar.md line 237:
> 235: The jar tool returns a status code of 0 if there were no integrity issues encountered, otherwise
> 236: a non-zero status code would be returned.
> 237: When an integrity issue is reported, it will often require that the jar file is re-created by the
Nit - "... require that the JAR file is re-created by the original source of the JAR file."
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24430#discussion_r2100734549
PR Review Comment: https://git.openjdk.org/jdk/pull/24430#discussion_r2100733984
PR Review Comment: https://git.openjdk.org/jdk/pull/24430#discussion_r2100742813
PR Review Comment: https://git.openjdk.org/jdk/pull/24430#discussion_r2100743231
PR Review Comment: https://git.openjdk.org/jdk/pull/24430#discussion_r2100736667
PR Review Comment: https://git.openjdk.org/jdk/pull/24430#discussion_r2100737171
PR Review Comment: https://git.openjdk.org/jdk/pull/24430#discussion_r2100740992
More information about the core-libs-dev
mailing list