diff --git a/jdk/src/share/demo/nio/zipfs/Demo.java b/jdk/src/share/demo/nio/zipfs/Demo.java index 9f83633d128..dfe77b877ed 100644 --- a/jdk/src/share/demo/nio/zipfs/Demo.java +++ b/jdk/src/share/demo/nio/zipfs/Demo.java @@ -156,7 +156,6 @@ public class Demo { if (action == Action.create) env.put("create", "true"); try (FileSystem fs = provider.newFileSystem(Paths.get(args[1]), env)) { - FileSystem fs2; Path path, src, dst; boolean isRename = false; switch (action) { @@ -201,12 +200,12 @@ public class Demo { Files.copy(src, dst, COPY_ATTRIBUTES); break; case zzmove: - try (fs2 = provider.newFileSystem(Paths.get(args[2]), env)) { + try (FileSystem fs2 = provider.newFileSystem(Paths.get(args[2]), env)) { z2zmove(fs, fs2, args[3]); } break; case zzcopy: - try (fs2 = provider.newFileSystem(Paths.get(args[2]), env)) { + try (FileSystem fs2 = provider.newFileSystem(Paths.get(args[2]), env)) { z2zcopy(fs, fs2, args[3]); } break; diff --git a/jdk/test/demo/zipfs/ZipFSTester.java b/jdk/test/demo/zipfs/ZipFSTester.java index 71dfa8d26a2..14aebbdf685 100644 --- a/jdk/test/demo/zipfs/ZipFSTester.java +++ b/jdk/test/demo/zipfs/ZipFSTester.java @@ -72,7 +72,7 @@ public class ZipFSTester { } } - static void test1(FileSystem fs) + static void test1(FileSystem fs0) throws Exception { Random rdm = new Random(); @@ -80,11 +80,11 @@ public class ZipFSTester { Path tmpfsPath = getTempPath(); Map env = new HashMap(); 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())) { + try (FileSystem fs = newZipFileSystem(tmpfsPath, new HashMap())) { FileSystemProvider provider = fs.provider(); // newFileSystem(path...) should not throw exception diff --git a/jdk/test/demo/zipfs/basic.sh b/jdk/test/demo/zipfs/basic.sh index 4c4eddac920..832a75d4fb4 100644 --- a/jdk/test/demo/zipfs/basic.sh +++ b/jdk/test/demo/zipfs/basic.sh @@ -21,7 +21,7 @@ # questions. # # @test -# @bug 6990846 7009092 7009085 7015391 7014948 7005986 +# @bug 6990846 7009092 7009085 7015391 7014948 7005986 7017840 # @summary Test ZipFileSystem demo # @build Basic PathOps ZipFSTester # @run shell basic.sh