提交 fa156588 编写于 作者: S sherman

7017840: (zipfs) test/demo/zipfs/basic.sh needs to be updated due to 7013420

Summary: updated try-with-resourcse usage in test/demo code
Reviewed-by: alanb
上级 1ee3e817
...@@ -156,7 +156,6 @@ public class Demo { ...@@ -156,7 +156,6 @@ public class Demo {
if (action == Action.create) if (action == Action.create)
env.put("create", "true"); env.put("create", "true");
try (FileSystem fs = provider.newFileSystem(Paths.get(args[1]), env)) { try (FileSystem fs = provider.newFileSystem(Paths.get(args[1]), env)) {
FileSystem fs2;
Path path, src, dst; Path path, src, dst;
boolean isRename = false; boolean isRename = false;
switch (action) { switch (action) {
...@@ -201,12 +200,12 @@ public class Demo { ...@@ -201,12 +200,12 @@ public class Demo {
Files.copy(src, dst, COPY_ATTRIBUTES); Files.copy(src, dst, COPY_ATTRIBUTES);
break; break;
case zzmove: 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]); z2zmove(fs, fs2, args[3]);
} }
break; break;
case zzcopy: 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]); z2zcopy(fs, fs2, args[3]);
} }
break; break;
......
...@@ -72,7 +72,7 @@ public class ZipFSTester { ...@@ -72,7 +72,7 @@ public class ZipFSTester {
} }
} }
static void test1(FileSystem fs) static void test1(FileSystem fs0)
throws Exception throws Exception
{ {
Random rdm = new Random(); Random rdm = new Random();
...@@ -80,11 +80,11 @@ public class ZipFSTester { ...@@ -80,11 +80,11 @@ public class ZipFSTester {
Path tmpfsPath = getTempPath(); Path tmpfsPath = getTempPath();
Map<String, Object> env = new HashMap<String, Object>(); Map<String, Object> env = new HashMap<String, Object>();
env.put("create", "true"); env.put("create", "true");
FileSystem fs0 = newZipFileSystem(tmpfsPath, env); try (FileSystem copy = newZipFileSystem(tmpfsPath, env)) {
z2zcopy(fs, fs0, "/", 0); z2zcopy(fs0, copy, "/", 0);
fs0.close(); // sync to file }
try (fs = newZipFileSystem(tmpfsPath, new HashMap<String, Object>())) { try (FileSystem fs = newZipFileSystem(tmpfsPath, new HashMap<String, Object>())) {
FileSystemProvider provider = fs.provider(); FileSystemProvider provider = fs.provider();
// newFileSystem(path...) should not throw exception // newFileSystem(path...) should not throw exception
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
# questions. # questions.
# #
# @test # @test
# @bug 6990846 7009092 7009085 7015391 7014948 7005986 # @bug 6990846 7009092 7009085 7015391 7014948 7005986 7017840
# @summary Test ZipFileSystem demo # @summary Test ZipFileSystem demo
# @build Basic PathOps ZipFSTester # @build Basic PathOps ZipFSTester
# @run shell basic.sh # @run shell basic.sh
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册