Use try-with-resource when opening stream
Change-Id: Ie83c3f5ef629b49bec5984c1c7f47433673fb4df
This commit is contained in:
parent
1eb09cb980
commit
cd63bcaff5
@ -1062,10 +1062,10 @@ public class RestApiServlet extends HttpServlet {
|
||||
int maxSize = base64MaxSize(bin.getContentLength());
|
||||
int estSize = Math.min(base64MaxSize(HEAP_EST_SIZE), maxSize);
|
||||
TemporaryBuffer.Heap buf = heap(estSize, maxSize);
|
||||
OutputStream encoded = BaseEncoding.base64().encodingStream(
|
||||
new OutputStreamWriter(buf, ISO_8859_1));
|
||||
try (OutputStream encoded = BaseEncoding.base64().encodingStream(
|
||||
new OutputStreamWriter(buf, ISO_8859_1))) {
|
||||
bin.writeTo(encoded);
|
||||
encoded.close();
|
||||
}
|
||||
return asBinaryResult(buf);
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 730613516a733fa33f684cbe03fe22ecf811216e
|
||||
Subproject commit b9d3ca8a65030071e28be19296ba867ab424fbbf
|
Loading…
Reference in New Issue
Block a user