RFR: 8365626: (fs) Improve handling of broken links in Files.isSameFile() (win)

Alan Bateman alanb at openjdk.org
Fri Sep 5 13:01:10 UTC 2025


On Thu, 4 Sep 2025 00:30:52 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Improve handling of broken symbolic links in `Files.isSameFile` on Windows as was done on Unix by the fix of [JDK-8154364](https://bugs.openjdk.org/browse/JDK-8154364).

src/java.base/windows/classes/sun/nio/fs/WindowsFileSystemProvider.java line 484:

> 482:         }
> 483: 
> 484:         if (h != 0L) {

I don't think it's possible for the handle to be 0L here.

src/java.base/windows/classes/sun/nio/fs/WindowsFileSystemProvider.java line 493:

> 491:             }
> 492: 
> 493:             if (attrs != null)

Same thing here, not possible for attrs to be null, at least not unless we have a bug in readAttributes.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27079#discussion_r2325026487
PR Review Comment: https://git.openjdk.org/jdk/pull/27079#discussion_r2325027207


More information about the nio-dev mailing list