RFR: 8301873: Avoid string decoding in ZipFile.Source.getEntryPos [v12]

Eirik Bjorsnos duke at openjdk.org
Wed Feb 15 09:57:55 UTC 2023


On Tue, 14 Feb 2023 23:12:38 GMT, Lance Andersen <lancea at 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



More information about the security-dev mailing list