RFR: 8355342: File.getCanonicalPath on Java 24 resolves paths on network drives to UNC format [v6]
Brian Burkhalter
bpb at openjdk.org
Mon Oct 20 16:08:03 UTC 2025
On Sun, 19 Oct 2025 08:30:16 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> This is a tricky issue as the current implementation isn't wrong, it's just surprising (and in the case of the bug report, awkward when attempting to use the real path as a working directory for a subprocess).
I think the problem both here and in [JDK-8368165](https://bugs.openjdk.org/browse/JDK-8368165) is the same: `GetFinalPathNameByHandle` either fails outright or gives an unexpected result. To me, the correct approach in these cases, insofar as one can detect them, is to fall back to the logic implemented by `WindowsLinkSupport.resolveAllLinks`, which appears to provide what is wanted but is slower.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27324#issuecomment-3422754338
More information about the core-libs-dev
mailing list