RFR: 8287843: File::getCanonicalFile doesn't work for \?\C:\ style paths DOS device paths [v3]

Brian Burkhalter bpb at openjdk.org
Wed Sep 20 18:50:41 UTC 2023


On Wed, 20 Sep 2023 18:42:31 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> File::isAbsolute, it looks like it will return true for input like `\\\?\\foo` but it will be treated by toAbsolutePath as a relative path.

Right on:

jshell> File f = new File("\\\?\\foo")
f ==> \?\foo

jshell> f.isAbsolute()
$2 ==> true

jshell> f.getAbsolutePath()
$3 ==> "C:\\Users\\bpb\\foo"

jshell> f.getCanonicalPath()
$4 ==> "C:\\Users\\bpb\\foo"

-------------

PR Comment: https://git.openjdk.org/jdk/pull/15603#issuecomment-1728260652


More information about the core-libs-dev mailing list