RFR: 8268613: jar --validate should check inital entries of a JAR file [v3]

Lance Andersen lancea at openjdk.org
Wed Nov 12 15:16:45 UTC 2025


On Wed, 12 Nov 2025 07:06:21 GMT, Christian Stein <cstein at openjdk.org> wrote:

>> test/jdk/tools/jar/ValidatorTest.java line 342:
>> 
>>> 340:     }
>>> 341: 
>>> 342:     private void testWrongManifestPosition(
>> 
>> This new test only validates that  the LOC MANIFEST.MF entries are where they need to be.  It does not do a similar CEN check in the event that the LOC and CEN entries do not match.  
>> 
>> If you change your validation order so that Validator checks the MANIFEST location after it checks the order, then you should be covered.
>> 
>> I would also add a comment to the test to help future maintainers to the test ...
>
> I'll add such a comment.
> 
> The existing tests for LOC-CEN related mismatches should already cover those cases. In addition, the results of the checks in `Validator` are accumulated - so their order is not important, right?

With moving the location check for the Manifest in Validator to be the last check, we are in good shape

Would it have been nice to do the same type of check using the CEN(via JarFile::stream or JarFile::entries)? Sure, but not a must

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28154#discussion_r2518683457


More information about the compiler-dev mailing list