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

Alan Bateman alanb at openjdk.org
Wed Sep 17 08:02:40 UTC 2025


On Tue, 16 Sep 2025 15:29:56 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Now back to the question from a few days ago, is the handle closed if linkAttrs.add(linkAttr) fails and FileSystemLoopException is thrown?
>
>> [...] is the handle closed if linkAttrs.add(linkAttr) fails and FileSystemLoopException is thrown?
> 
> I was mistakenly thinking that if the object was not added to the set, then it will have the same handle as one of the objects already in the set, but this is patently untrue. I should check whether two different handles referring to the same file actually end up with equal volume serial numbers and file indexes, which is what one would expect. As to the specific question, I think an explicit CloseHandle is called for here as well.

Okay, I think the code is correct now but I worried that the changes to WindowsFileSystemProvider aren't very maintainable. lastLinkAttributes has too many exit paths so very error prone, and isSameFile has too many branches and try/catch.So  my preference would be to see some re-work of the change before integrating.

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

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


More information about the nio-dev mailing list