From c6619c912d65c655a3c665d43951971de1f5cbc2 Mon Sep 17 00:00:00 2001 From: Philippe Marschall Date: Mon, 20 May 2013 11:56:46 -0700 Subject: [PATCH] 8004789: (zipfs) zip provider doesn't work correctly with file systems providers rather than the default To use Files.createTempFile(...) to create the temp file on the same fs as the targeted path. Reviewed-by: alanb, sherman --- .../demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java index b872a59b501..07c71bb5d46 100644 --- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java +++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java @@ -1085,13 +1085,13 @@ public class ZipFileSystem extends FileSystem { } // Creates a new empty temporary file in the same directory as the - // specified file. A variant of File.createTempFile. + // specified file. A variant of Files.createTempFile. private Path createTempFileInSameDirectoryAs(Path path) throws IOException { Path parent = path.toAbsolutePath().getParent(); - String dir = (parent == null)? "." : parent.toString(); - Path tmpPath = File.createTempFile("zipfstmp", null, new File(dir)).toPath(); + Path dir = (parent == null) ? path.getFileSystem().getPath(".") : parent; + Path tmpPath = Files.createTempFile(dir, "zipfstmp", null); tmppaths.add(tmpPath); return tmpPath; }