RFR: 8274780: ChannelInputStream.readNBytes(int) incorrectly calls readAllBytes()

Florian Weimer fweimer at openjdk.java.net
Tue Oct 5 17:39:08 UTC 2021


On Tue, 5 Oct 2021 15:06:39 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> 8274780: ChannelInputStream.readNBytes(int) incorrectly calls readAllBytes()
>
> test/jdk/java/nio/channels/Channels/ReadXBytes.java line 163:
> 
>> 161:             f.test(length, cis, fis);
>> 162:         } finally {
>> 163:             Files.delete(file);
> 
> I'd like to see this cleaned up a bit. The line break at L154 make it hard to read. Having 4 resources in the same try-with-resources is also hard to read. The comment "relationship is obscured" will confuse further maintainers.

How important is exception correctness in the test code? Is it acceptable to leak resources on VM errors?

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

PR: https://git.openjdk.java.net/jdk/pull/5824


More information about the nio-dev mailing list