Use try-with-resource when opening stream
Change-Id: Ie83c3f5ef629b49bec5984c1c7f47433673fb4df
This commit is contained in:
		@@ -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));
 | 
			
		||||
    bin.writeTo(encoded);
 | 
			
		||||
    encoded.close();
 | 
			
		||||
    try (OutputStream encoded = BaseEncoding.base64().encodingStream(
 | 
			
		||||
        new OutputStreamWriter(buf, ISO_8859_1))) {
 | 
			
		||||
      bin.writeTo(encoded);
 | 
			
		||||
    }
 | 
			
		||||
    return asBinaryResult(buf);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user