Skip to content

Commit

Permalink
Properly close stream writer
Browse files Browse the repository at this point in the history
Failing to close the streamwriter means it will not output its
trailer in all cases. Fix that.

Change-Id: I218cea9ff61fbc7c33ccab75638dda9a4f20b391
Signed-off-by: Robert Varga <[email protected]>
(cherry picked from commit bfe9193)
  • Loading branch information
rovarga committed Nov 4, 2019
1 parent aaf133b commit feeb6b5
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ public void endNode() throws IOException {
LOG.warn("Error writing error response body", e);
}

try {
streamWriter.close();
} catch (IOException e) {
LOG.warn("Failed to close stream writer", e);
}

try {
return outStream.toString(StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
Expand Down

0 comments on commit feeb6b5

Please sign in to comment.