RFR: 8154364: Files.isSameFile() throws NoSuchFileException with broken symbolic links

Brian Burkhalter bpb at openjdk.org
Tue Aug 12 16:31:14 UTC 2025


On Tue, 12 Aug 2025 06:42:52 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> normalize is to deal with user input, I don't think we should be using it here.

This was intended to handle comparing paths with `..` and `.` like "a/b/c/../d/e" with "a/b/d/e" as there is no closer `Path` equivalent that I could see to `File.getCanonicalPath` that does not access the file system, i.e., to avoid `Path.toRealPath` and a consequent `NoSuchFileException`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26736#discussion_r2270504514


More information about the nio-dev mailing list