8207395: jar has issues with UNC-path arguments for the jar -C parameter [windows]
authormbaesken
Thu, 19 Jul 2018 11:04:46 +0200
changeset 51188 630b5e06a947
parent 51187 e55d46250431
child 51189 0ce279d8c9cd
8207395: jar has issues with UNC-path arguments for the jar -C parameter [windows] Reviewed-by: goetz, sherman
src/jdk.jartool/share/classes/sun/tools/jar/Main.java
--- a/src/jdk.jartool/share/classes/sun/tools/jar/Main.java	Mon Jul 23 22:07:55 2018 -0700
+++ b/src/jdk.jartool/share/classes/sun/tools/jar/Main.java	Thu Jul 19 11:04:46 2018 +0200
@@ -633,10 +633,15 @@
                         dir = (dir.endsWith(File.separator) ?
                                dir : (dir + File.separator));
                         dir = dir.replace(File.separatorChar, '/');
+
+                        boolean hasUNC = (File.separatorChar == '\\'&&  dir.startsWith("//"));
                         while (dir.indexOf("//") > -1) {
                             dir = dir.replace("//", "/");
                         }
-                        pathsMap.get(version).add(dir.replace(File.separatorChar, '/'));
+                        if (hasUNC) { // Restore Windows UNC path.
+                            dir = "/" + dir;
+                        }
+                        pathsMap.get(version).add(dir);
                         nameBuf[k++] = dir + args[++i];
                     } else if (args[i].startsWith("--release")) {
                         int v = BASE_VERSION;