--- old/test/java/util/zip/ZipFile/CopyJar.java 2011-02-23 19:50:03.712421299 -0800 +++ new/test/java/util/zip/ZipFile/CopyJar.java 2011-02-23 19:50:03.380222279 -0800 @@ -31,18 +31,18 @@ public class CopyJar { public static void main(String args[]) throws Exception { - ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), - "input.jar")); - ZipEntry ze = zf.getEntry("ReleaseInflater.java"); - ZipOutputStream zos = new ZipOutputStream(new ByteArrayOutputStream()); - InputStream in = zf.getInputStream(ze); - byte[] b = new byte[128]; - int n; - zos.putNextEntry(ze); - while((n = in.read(b)) != -1) { - zos.write(b, 0, n); + try (ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), + "input.jar"))) { + ZipEntry ze = zf.getEntry("ReleaseInflater.java"); + ZipOutputStream zos = new ZipOutputStream(new ByteArrayOutputStream()); + InputStream in = zf.getInputStream(ze); + byte[] b = new byte[128]; + int n; + zos.putNextEntry(ze); + while((n = in.read(b)) != -1) { + zos.write(b, 0, n); + } + zos.close(); } - zos.close(); - zf.close(); } }