RFR: 8355342: File.getCanonicalPath on Java 24 resolves paths on network drives to UNC format [v4]
Alan Bateman
alanb at openjdk.org
Sat Sep 20 06:55:15 UTC 2025
On Wed, 17 Sep 2025 00:32:37 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: Corrected a comment
This issue is going to require stepping back and re-visiting the question as to what is the canonical path when a file is located with a UNC path. We wrestled with this in JDK 7 and I thought got to the best answer with toRealPath but it seems we may have to re-visit this now.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27324#issuecomment-3314653507
More information about the core-libs-dev
mailing list