On Mon, 6 Feb 2023 09:16:45 GMT, Eirik Bjorsnos <[email protected]> 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