src/windows/classes/sun/nio/fs/WindowsPathParser.java

Print this page

        

@@ -118,16 +118,21 @@
                     throw new InvalidPathException(input, "UNC path is missing sharename");
                 root = "\\\\" + host + "\\" + input.substring(off, next) + "\\";
                 off = next;
             } else {
                 if (isLetter(c0) && c1 == ':') {
-                    root = input.substring(0, 2);
-                    if (len > 2 && isSlash(input.charAt(2))) {
+                    char c2 = input.charAt(2);
+                    if (len > 2 && isSlash(c2)) {
+                        if (c2 == '\\') {
+                            root = input.substring(0, 3);
+                        } else {
+                            root = input.substring(0, 2)+'\\';
+                        }
                         off = 3;
-                        root += "\\";
                         type = WindowsPathType.ABSOLUTE;
                     } else {
+                        root = input.substring(0, 2);
                         off = 2;
                         type = WindowsPathType.DRIVE_RELATIVE;
                     }
                 }
             }