src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystemProvider.java

Print this page

        

@@ -63,12 +63,13 @@
         }
         try {
             // only support legacy JAR URL syntax  jar:{uri}!/{entry} for now
             String spec = uri.getRawSchemeSpecificPart();
             int sep = spec.indexOf("!/");
-            if (sep != -1)
+            if (sep != -1) {
                 spec = spec.substring(0, sep);
+            }
             return Paths.get(new URI(spec)).toAbsolutePath();
         } catch (URISyntaxException e) {
             throw new IllegalArgumentException(e.getMessage(), e);
         }
     }

@@ -105,10 +106,13 @@
                 if (pname.endsWith(".zip") || pname.endsWith(".jar"))
                     throw ze;
                 // assume NOT a zip/jar file
                 throw new UnsupportedOperationException();
             }
+            if (realPath == null) {  // newly created
+                realPath = path.toRealPath();
+            }
             filesystems.put(realPath, zipfs);
             return zipfs;
         }
     }
 

@@ -130,11 +134,10 @@
         }
     }
 
     @Override
     public Path getPath(URI uri) {
-
         String spec = uri.getSchemeSpecificPart();
         int sep = spec.indexOf("!/");
         if (sep == -1)
             throw new IllegalArgumentException("URI: "
                 + uri