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

Alan Bateman alanb at openjdk.java.net
Tue Oct 5 17:13:13 UTC 2021


On Tue, 5 Oct 2021 14:46:26 GMT, Florian Weimer <fweimer at openjdk.org> wrote:

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

test/jdk/java/nio/channels/Channels/ReadXBytes.java line 32:

> 30:  * @build jdk.test.lib.RandomFactory
> 31:  * @modules java.base/jdk.internal.util
> 32:  * @run testng/othervm/timeout=3600 -Xmx8G ReadXBytes

Are you running the tests with the make target or jtreg without -timeoutFactor?

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.

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

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


More information about the nio-dev mailing list