RFR: 8301167: Update VerifySignedJar to actually exercise and test verification [v2]

Weijun Wang weijun at openjdk.org
Mon Feb 6 15:40:57 UTC 2023


On Mon, 6 Feb 2023 09:16:45 GMT, Eirik Bjorsnos <duke at openjdk.org> wrote:

>> test/jdk/java/util/jar/JarFile/VerifySignedJar.java line 76:
>> 
>>> 74:             // Read entry by name
>>> 75:             ZipEntry ze = Objects.requireNonNull(jf.getEntry("getprop.class"));
>>> 76:             JarEntry je = Objects.requireNonNull(jf.getJarEntry("getprop.class"));
>> 
>> There is no need to store the outputs to variables.
>> 
>> Also, for the `Unreached` lines below, we have `jdk.test.lib.Utils::runAndCheckException` which is good at catching exceptions.
>> 
>>             Utils.runAndCheckException(() -> jf.getEntry(null), NullPointerException.class);
>>             Utils.runAndCheckException(() -> jf.getJarEntry(null), NullPointerException.class);
>>             Utils.runAndCheckException(() -> jf.getInputStream(null), NullPointerException.class);
>
> I've removed the local variables. Just in case there was some intent in showing that the methods excercise both ZipFile and JarFile, I updated the comment above slightly.
> 
> I also replaced the exception checking code as suggested. I opted for a static import, is that ok?

That's OK.

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

PR: https://git.openjdk.org/jdk/pull/12206



More information about the security-dev mailing list