jdk/src/windows/classes/sun/nio/fs/WindowsPathParser.java
changeset 10891 8c554ab7cfed
parent 9035 1255eb81cc2f
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsPathParser.java	Fri Oct 28 07:18:54 2011 -0700
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsPathParser.java	Sun Oct 30 14:53:43 2011 +0000
@@ -120,12 +120,18 @@
                 off = next;
             } else {
                 if (isLetter(c0) && c1 == ':') {
-                    root = input.substring(0, 2);
-                    if (len > 2 && isSlash(input.charAt(2))) {
+                    char c2;
+                    if (len > 2 && isSlash(c2 = input.charAt(2))) {
+                        // avoid concatenation when root is "D:\"
+                        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;
                     }