On Mon, 6 Feb 2023 04:09:29 GMT, Weijun Wang <wei...@openjdk.org> wrote:

>> Eirik Bjorsnos has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Add whitespace after "if"
>>   
>>   Co-authored-by: Andrey Turbanov <turban...@gmail.com>
>
> 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?

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

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

Reply via email to