diff --git a/jdk/src/windows/classes/java/io/Win32FileSystem.java b/jdk/src/windows/classes/java/io/Win32FileSystem.java index 2e62cf804d..c71e524ff6 100644 --- a/jdk/src/windows/classes/java/io/Win32FileSystem.java +++ b/jdk/src/windows/classes/java/io/Win32FileSystem.java @@ -359,9 +359,12 @@ class Win32FileSystem extends FileSystem { // is a ":" at position 1 and the first character is not a letter String pathname = f.getPath(); int lastColon = pathname.lastIndexOf(":"); - if (lastColon > 1 || - (lastColon == 1 && !isLetter(pathname.charAt(0)))) - return true; + + // Valid if there is no ":" present or if the last ":" present is + // at index 1 and the first character is a latter + if (lastColon < 0 || + (lastColon == 1 && isLetter(pathname.charAt(0)))) + return false; // Invalid if path creation fails Path path = null;