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

Jorn Vernee jvernee at openjdk.org
Mon Nov 10 13:58:50 UTC 2025


On Wed, 5 Nov 2025 17:29:10 GMT, Christian Stein <cstein at openjdk.org> wrote:

> Please review this change to include a validation check for expecting an optional JAR manifest entry being the first or second entry in JAR file. As the second entry, it must be only preceeded by an entry for the `META-INF/` directory.

test/jdk/tools/jar/ValidatorTest.java line 354:

> 352:             jar("--validate --file " + path);
> 353:             fail("Expecting non-zero exit code validating: " + path);
> 354:         } catch (IOException e) {

It's just that `jar` method that throws the expected exception, right? Could you limit the length of the `try` block to not cover the nested try block? Otherwise, if `JarInputStream` starts throwing the same exception, this test would stop testing the `jar` method. (also I think it makes it a little clearer which line is expected to throw)

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

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


More information about the core-libs-dev mailing list