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

Alan Bateman alanb at openjdk.org
Sun Jun 4 13:45:06 UTC 2023


On Fri, 2 Jun 2023 16:32:38 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.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8307887: Move unprivileged link creation logic to WindowsLinkSupport

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

> 61:             Files.deleteIfExists(pathTarget);
> 62:         }
> 63: 

I think it's confusing to have a test for sym links before testing if sym links are supported. I think it's okay to not include tests that target very specific cases like Windows "developer mode" but a test that the optional specific exception is thrown is okay, it just feels like it should be just one of the tests, rather than done before knowing the test can run, e.g. try this on a non-NTFS system and I assume createSymbolicLink will fail and cause the test to fail.

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

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


More information about the nio-dev mailing list