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

Alan Bateman alanb at openjdk.org
Tue Sep 9 13:25:48 UTC 2025


On Tue, 9 Sep 2025 00:30:43 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).
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8365626: Incorporate suggestions from review comments

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

> 462:                 LinkAttributes linkAttr = new LinkAttributes(attrs, h);
> 463:                 if (!fileAttrs.add(linkAttr))
> 464:                     throw new FileSystemLoopException("Looping symbolic link");

The parameter to FileSystemLoopException is the file that caused the loop rather than a message.

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

> 469:                 path = WindowsPath.parse(path.getFileSystem(), target);
> 470:             }
> 471:         } catch (Exception e) {

I assume this should IOException|WindowsException rather than Exception.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27079#discussion_r2333584595
PR Review Comment: https://git.openjdk.org/jdk/pull/27079#discussion_r2333589764


More information about the nio-dev mailing list