On Tue, 14 Feb 2023 23:12:38 GMT, Lance Andersen <lan...@openjdk.org> wrote:

>> Eirik Bjorsnos has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Prefer expectThrows with asserts over test annotation regex
>
> test/jdk/java/util/zip/ZipFile/InvalidBytesInEntryNameOrComment.java line 91:
> 
>> 89:     public void shouldRejectInvalidName() throws IOException {
>> 90:         ZipException ex = expectThrows(ZipException.class, () -> {
>> 91:             openZipFile(invalidName);
> 
> You could just do
> 
> 
> ZipException ex = expectThrows(ZipException.class, () -> {
>              new ZipFile(invalidName.toFile())
> });
> 
> versus adding _openZipFile()_

The habit of opening resources in a TwR is hard to break, but I guess it's ok 
for a test like this. I have inlined the method and removed the TwR.

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

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

Reply via email to