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

Henry Jen henryjen at openjdk.org
Mon Apr 28 23:46:44 UTC 2025


On Fri, 4 Apr 2025 16:41:52 GMT, Lance Andersen <lancea at openjdk.org> wrote:

>> Yes, in a perfect world there will be a 1 to 1 match but either way we should sanity check it in case something happened
>
>> Is the ordering required by ZIP or Jar format? We can certainly do that if that's under spec and not an implementation detail.
> 
> The Zip Spec states the following:
> 
> 
>> 4.3.2 Each file placed into a ZIP file MUST be preceded by  a "local 
>>    file header" record for that file.  Each "local file header" MUST be 
>>    accompanied by a corresponding "central directory header" record within 
>>    the central directory section of the ZIP file.
> 
> That being said I am not aware of any implementations  where the order is different given you have to generate the LOC prior to the CEN and End of CEN

I had add a warning on ordering mismatch, but still consider the jar valid.

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

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


More information about the compiler-dev mailing list