RFR: 8136895: Writer not closed with disk full error, file resource leaked
Alan Bateman
alanb at openjdk.org
Tue Apr 18 07:31:43 UTC 2023
On Tue, 18 Apr 2023 02:03:19 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
> In`StreamEncoder::implClose`, move `flushLeftoverChar()` inside the `try` block and the closing of the underlying stream inside the `finally` block.
src/java.base/share/classes/sun/nio/cs/StreamEncoder.java line 439:
> 437: if (ch != null)
> 438: ch.close();
> 439: else {
If this encoder is for an OutputStreamWriter, and the flush of the left over characters fails, then the finally block will attempt to flush the underlying output stream again. Need to you think about that scenario a bit to decide if the underlying flush should be done for this case or not.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13503#discussion_r1169610766
More information about the nio-dev
mailing list