--- old/test/java/util/zip/ZipFile/Assortment.java 2011-02-23 19:50:00.715789047 -0800 +++ new/test/java/util/zip/ZipFile/Assortment.java 2011-02-23 19:50:00.392091668 -0800 @@ -201,13 +201,12 @@ //---------------------------------------------------------------- // Write zip file using ZipOutputStream //---------------------------------------------------------------- - ZipOutputStream zos = new ZipOutputStream( - new FileOutputStream(zipName)); - - for (Entry e : entries) - e.write(zos); - - zos.close(); + try (FileOutputStream fos = new FileOutputStream(zipName); + ZipOutputStream zos = new ZipOutputStream(fos)) + { + for (Entry e : entries) + e.write(zos); + } //---------------------------------------------------------------- // Verify zip file contents using JarFile class