RFR: 8306308: (ch) Writer created by Channels::newWriter may lose data [v9]

Alan Bateman alanb at openjdk.org
Sat Oct 21 08:41:47 UTC 2023


On Fri, 20 Oct 2023 17:56:10 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Change `Channels.newWriter` to return a `Writer` created by first wrapping the `WritableByteChannel` in an `OutputStream` using `Channels.newOutputStream` and then wrapping the result in an `OutputStreamWriter`. With this change in place, the problems reported in the issue do not occur.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8306308: Make EXPECTED less unexpected

test/jdk/java/nio/channels/Channels/NewWriter.java line 96:

> 94:                     StandardCharsets.UTF_8)) {
> 95:                     for (int i = 1; i < Integer.MAX_VALUE; i++) {
> 96:                         writer.write("test" + i);

There's no need to set SO_SNDBUF here, the IBME should be thrown then the writer attempts to flush.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16207#discussion_r1367690958


More information about the nio-dev mailing list