changeset 51871:630b5e06a947

8207395: jar has issues with UNC-path arguments for the jar -C parameter [windows] Reviewed-by: goetz, sherman
author mbaesken
date Thu, 19 Jul 2018 11:04:46 +0200
parents e55d46250431
children 0ce279d8c9cd
files src/jdk.jartool/share/classes/sun/tools/jar/Main.java
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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;