RFR: 8307887: (fs) Files.createSymbolicLink throws less specific exception when in developer mode and file already exists

Alan Bateman alanb at openjdk.org
Fri Jun 2 05:49:08 UTC 2023


On Thu, 1 Jun 2023 01:39:16 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> If the second attempt to create the link fails, throw the exception referring to the last error if it is anything other than due to lack of link creation privilege or failure to recognize the flag for unprivileged link creation.

src/java.base/windows/classes/sun/nio/fs/WindowsNativeDispatcher.java line 994:

> 992:                     int lastError = y.lastError();
> 993:                     if (lastError != ERROR_PRIVILEGE_NOT_HELD && lastError != ERROR_INVALID_PARAMETER)
> 994:                         throw y;

The methods that WindowsNativeDispatcher defines are meant to be 1-1 mapping to win32 calls. It looks like we put the changes for JDK-8221852 in the wrong place, they need to be the usage rather than here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14255#discussion_r1213948493


More information about the nio-dev mailing list