jdk/test/demo/zipfs/ZipFSTester.java
changeset 8190 c8cdf811a171
parent 8165 b67d8b1f4e46
child 8386 4a1a689a32e0
--- a/jdk/test/demo/zipfs/ZipFSTester.java	Tue Feb 08 19:31:44 2011 +0000
+++ b/jdk/test/demo/zipfs/ZipFSTester.java	Tue Feb 08 13:30:30 2011 -0800
@@ -72,7 +72,7 @@
         }
     }
 
-    static void test1(FileSystem fs)
+    static void test1(FileSystem fs0)
         throws Exception
     {
         Random rdm = new Random();
@@ -80,11 +80,11 @@
         Path tmpfsPath = getTempPath();
         Map<String, Object> env = new HashMap<String, Object>();
         env.put("create", "true");
-        FileSystem fs0 = newZipFileSystem(tmpfsPath, env);
-        z2zcopy(fs, fs0, "/", 0);
-        fs0.close();                // sync to file
+        try (FileSystem copy = newZipFileSystem(tmpfsPath, env)) {
+            z2zcopy(fs0, copy, "/", 0);
+        }
 
-        try (fs = newZipFileSystem(tmpfsPath, new HashMap<String, Object>())) {
+        try (FileSystem fs = newZipFileSystem(tmpfsPath, new HashMap<String, Object>())) {
 
             FileSystemProvider provider = fs.provider();
             // newFileSystem(path...) should not throw exception