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

Daniel Jeliński djelinski at openjdk.org
Thu Oct 19 08:05:13 UTC 2023


On Wed, 18 Oct 2023 20:40:23 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: Add some code to dispense with lock

LGTM

src/java.base/share/classes/sun/nio/cs/StreamEncoder.java line 1:

> 1: /*

There's a couple of null checks that can be removed now:
https://github.com/openjdk/jdk/blob/366e42c54ef8f04f542f93b5a73a8ad41e60a322/src/java.base/share/classes/sun/nio/cs/StreamEncoder.java#L393
https://github.com/openjdk/jdk/blob/366e42c54ef8f04f542f93b5a73a8ad41e60a322/src/java.base/share/classes/sun/nio/cs/StreamEncoder.java#L415

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

Marked as reviewed by djelinski (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/16207#pullrequestreview-1686980026
PR Review Comment: https://git.openjdk.org/jdk/pull/16207#discussion_r1365075364


More information about the nio-dev mailing list