VelocityStaticServlet: Open OutputStream in try-with-resource

Change-Id: I16bffb6b6e09586722509a0ab9c3b8624b8bb07b
diff --git a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/velocity/VelocityStaticServlet.java b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/velocity/VelocityStaticServlet.java
index 4139adf..15b698b 100644
--- a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/velocity/VelocityStaticServlet.java
+++ b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/velocity/VelocityStaticServlet.java
@@ -73,16 +73,11 @@
   }
 
   private static byte[] readResource(final Resource p) throws IOException {
-    final InputStream in = p.getResourceLoader().getResourceStream(p.getName());
-    ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
-    try {
+    try (InputStream in = p.getResourceLoader().getResourceStream(p.getName());
+        ByteArrayOutputStream byteOut = new ByteArrayOutputStream()) {
       IOUtils.copy(in, byteOut);
-    } finally {
-      in.close();
-      byteOut.close();
+      return byteOut.toByteArray();
     }
-
-    return byteOut.toByteArray();
   }
 
   private static byte[] compress(final byte[] raw) throws IOException {
@@ -161,11 +156,8 @@
     rsp.setDateHeader("Last-Modified", p.getLastModified());
     rsp.setContentType(type);
     rsp.setContentLength(tosend.length);
-    final OutputStream out = rsp.getOutputStream();
-    try {
+    try (OutputStream out = rsp.getOutputStream()) {
       out.write(tosend);
-    } finally {
-      out.close();
     }
   }
 }