RFR: 8355342: File.getCanonicalPath on Java 24 resolves paths on network drives to UNC format [v6]
Brian Burkhalter
bpb at openjdk.org
Fri Oct 17 22:54:18 UTC 2025
On Fri, 17 Oct 2025 22:50:59 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> `File.getCanonicalPath` invokes `GetFinalPathNameByHandle` on the result of `canonicalize0` which causes the drive letter of a mapped drive to be converted to a UNC prefix. If such a substitution is detected, this request proposes to revert the conversion of drive letter to UNC prefix before returning the canonical path.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8355342: Do not check for backslash as third character of input pathname string
src/java.base/windows/classes/java/io/WinNTFileSystem.java line 504:
> 502: finalPath = fp;
> 503: }
> 504: } catch (IOException ignored) {
I don't know that there should be a `try-catch` here as it looks like `getFinalPath` throws (an `Error`) if any only if memory runs out, in which case we're done anyway.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27324#discussion_r2441409842
More information about the core-libs-dev
mailing list