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

Brian Burkhalter bpb at openjdk.org
Tue Aug 12 01:22:11 UTC 2025


On Tue, 12 Aug 2025 01:15:35 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> This request proposes to broaden the definition of which paths are considered to be the same by `java.nio.file.Files.isSameFile()`. A new test is added to cover many comparisons.

In the current implementation, files are considered to be the same only if their (possibly unnormalized) path strings are equal or, when following links, they represent two existing files that have the same file key. In the proposed implementation, the comparison is extended to deem two files equal if their paths when not following links both exist and have a link in common, or if neither file exists but their normalized path strings are equal.

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

PR Comment: https://git.openjdk.org/jdk/pull/26736#issuecomment-3177380315


More information about the nio-dev mailing list