bodewig commented on a change in pull request #145:
URL: https://github.com/apache/ant/pull/145#discussion_r593741717



##########
File path: src/tests/junit/org/apache/tools/zip/ZipOutputStreamTest.java
##########
@@ -70,4 +76,17 @@ public void testAdjustToLong() {
                      ZipUtil.adjustToLong(2 * Integer.MAX_VALUE));
     }
 
+    @Test
+    public void testWriteAndReadManifest() throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ZipOutputStream zos = new ZipOutputStream(baos);
+        zos.putNextEntry(new ZipEntry(JarFile.MANIFEST_NAME));
+        new Manifest().write(zos);
+        zos.close();
+        ByteArrayInputStream bais = new 
ByteArrayInputStream(baos.toByteArray());
+        ZipInputStream zis = new ZipInputStream(bais);
+        zis.getNextEntry();
+        zis.closeEntry();
+        zis.close();
+    }

Review comment:
       please use try-with-resources for all streams even though we are only 
writing to memory.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Reply via email to