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

Brian Burkhalter bpb at openjdk.org
Tue Sep 9 20:39:21 UTC 2025


On Tue, 9 Sep 2025 13:26:05 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> 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 429:
> 
>> 427:                 return true;
>> 428:             if (obj instanceof LinkAttributes other)
>> 429:                 return WindowsFileAttributes.isSameFile(attrs, other.attrs());
> 
> It's not obvious that this consistent with hashCode. It might be better to have this check the that the 3 values are equal.

Fixed in bd4b94d.

> 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.

Fixed in bd4b94d.

> 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.

Fixed in bd4b94d.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27079#discussion_r2334714487
PR Review Comment: https://git.openjdk.org/jdk/pull/27079#discussion_r2334713254
PR Review Comment: https://git.openjdk.org/jdk/pull/27079#discussion_r2334714190


More information about the nio-dev mailing list