RFR: 8340329: (fs) Message of NotLinkException thrown by FIles.readSymbolicLink does not include file name (win)

Brian Burkhalter bpb at openjdk.org
Tue Sep 17 23:55:04 UTC 2024


On Tue, 17 Sep 2024 23:37:40 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Add the file name of the Path passed to `Files.readSymbolicLink` to the message of the `NotLinkException` thrown when the path is not a reparse point which represents a symbolic link.

src/java.base/windows/classes/sun/nio/fs/WindowsLinkSupport.java line 308:

> 306:                 String filename = null;
> 307:                 try {
> 308:                     filename = GetFinalPathNameByHandle(handle);

One question is whether the string returned by `GetFinalPathNameByHandle` should be used as is, or converted to some other form.

test/jdk/java/nio/file/Files/Links.java line 135:

> 133:         }
> 134: 
> 135:         // Check message of NotLinkException

It might be that checking the message for just one single non-link, instead of both a file and a directory, is sufficient.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21047#discussion_r1764221658
PR Review Comment: https://git.openjdk.org/jdk/pull/21047#discussion_r1764222496


More information about the nio-dev mailing list