RFR: 8365626: (fs) Improve handling of broken links in Files.isSameFile() (win) [v4]
Alan Bateman
alanb at openjdk.org
Fri Sep 12 12:23:19 UTC 2025
On Thu, 11 Sep 2025 15:13:47 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> src/java.base/windows/classes/sun/nio/fs/WindowsFileSystemProvider.java line 483:
>>
>>> 481: EntryAttributes linkAttr = new EntryAttributes(attrs, h);
>>> 482: if (!linkAttrs.add(linkAttr))
>>> 483: throw new FileSystemLoopException(path.toString());
>>
>> Is this handle closed if FileSystemLoopException is thrown?
>
> I think so: `lastLinkAttributes.handle()` is closed in the catch block if `lastLinkAttributes` is not null, and any other handle in `linkAttrs` is closed in the finally block.
Let's go back to L477. If the readAttributes throws then here is the handle closed? The handle is local to the block and isn't encapsulated by an EntryAttributes at this point. I think it would leak but maybe I've missed something, do you mind checking?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27079#discussion_r2344076439
More information about the nio-dev
mailing list