8207395: jar has issues with UNC-path arguments for the jar -C parameter [windows]
Reviewed-by: goetz, sherman
--- 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;