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

Henry Jen henryjen at openjdk.org
Fri Apr 4 16:08:58 UTC 2025


On Fri, 4 Apr 2025 15:59:47 GMT, Henry Jen <henryjen at openjdk.org> wrote:

>> src/jdk.jartool/share/classes/sun/tools/jar/Validator.java line 99:
>> 
>>> 97:                 if (!entryNames.contains(entryName)) {
>>> 98:                     missingEntryNames.add(entryName);
>>> 99:                 }
>> 
>> It looks like you are checking to see if the LOC entry contains within the CEN but I don't see if you are checking if the CEN entry is contained in the LOC
>> 
>> Another facet of validation is to compare the ordering of entries between the LOC and CEN
>
> Is the ordering required by ZIP or Jar format? We can certainly do that if that's under spec and not an implementation detail.

As we checking entry uniqueness and  the size match, and all LOC entries should be in CEN, that would means all CEN entries in LOC.
But if we would like to be specific about the inconsistency, then we will have to do a little more work.

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

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


More information about the core-libs-dev mailing list