Summary
Creation of a Path
from a String
using java.nio.file.Path.of(String)
is now changed to accept strings with the long path prefix \\?\
and the long UNC path prefix \\?\UNC\
on Windows.
Problem
On Windows, Path::of
accepts a long absolute path string, but rejects the same string when prefixed with \\?\
. The same situation applies to long UNC path strings which instead use the prefix \\?\UNC\
.
Solution
If a long path prefix \\?\
or long UNC path prefix \\?\UNC\
is detected, then do not reject the string a priori, but instead strip the prefix, examine the remainder of the string, and accept it if it represents an absolute path in the former case, or a UNC path in the latter.
Specification
There is no visible change to the specification.
- csr of
-
JDK-8298478 (fs) Path.of should allow input to include long path prefix
-
- Resolved
-