-
Bug
-
Resolution: Fixed
-
P4
-
8, 11, 17, 18, 19
-
b24
-
x86_64
-
windows
-
Verified
ADDITIONAL SYSTEM INFORMATION :
Windows 11
A DESCRIPTION OF THE PROBLEM :
File::getCanonicalFile incorrectly fails with "java.io.IOException: The handle is invalid" even though File::exists and File::listFiles (i.e. all other file system access method) all work just fine the file path is a \\?\ style file paths (https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats#dos-device-paths).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
File f = new File("\\\\?\\C:\\Users");
System.out.println(f.exists());
System.out.println(f.getCanonicalFile());
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
true
\\?\C:\Users
ACTUAL -
true
java.io.IOException: The handle is invalid
---------- BEGIN SOURCE ----------
import java.io.File;
public class Main {
public static void main(String[] args) throws Exception {
File f = new File("\\\\?\\C:\\Users");
System.out.println(f.exists());
System.out.println(f.getCanonicalFile());
}
}
---------- END SOURCE ----------
FREQUENCY : always
Windows 11
A DESCRIPTION OF THE PROBLEM :
File::getCanonicalFile incorrectly fails with "java.io.IOException: The handle is invalid" even though File::exists and File::listFiles (i.e. all other file system access method) all work just fine the file path is a \\?\ style file paths (https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats#dos-device-paths).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
File f = new File("\\\\?\\C:\\Users");
System.out.println(f.exists());
System.out.println(f.getCanonicalFile());
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
true
\\?\C:\Users
ACTUAL -
true
java.io.IOException: The handle is invalid
---------- BEGIN SOURCE ----------
import java.io.File;
public class Main {
public static void main(String[] args) throws Exception {
File f = new File("\\\\?\\C:\\Users");
System.out.println(f.exists());
System.out.println(f.getCanonicalFile());
}
}
---------- END SOURCE ----------
FREQUENCY : always
- csr for
-
JDK-8317555 File::getCanonicalFile doesn't work for \\?\C:\ style paths DOS device paths
- Closed
- relates to
-
JDK-8320348 test/jdk/java/io/File/GetAbsolutePath.windowsDriveRelative fails if working directory is not on drive C
- Resolved