RFR: 8136895: Writer not closed with disk full error, file resource leaked

Andrey Turbanov aturbanov at openjdk.org
Tue Apr 18 16:45:02 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.

test/jdk/java/nio/channels/Channels/Close.java line 50:

> 48:                     (channel, StandardCharsets.UTF_8.newEncoder(), -1 )) {
> 49:                 writer.write(s);
> 50:             } catch(IOException ex) {

Suggestion:

            } catch (IOException ex) {

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13503#discussion_r1170309783


More information about the nio-dev mailing list