RFR: 8003887: File.getCanonicalFile() does not resolve symlinks on MS Windows [v4]

Brian Burkhalter bpb at openjdk.org
Wed Sep 4 19:03:34 UTC 2024


On Wed, 4 Sep 2024 08:40:36 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8003887: Test getCanonicalPath when the path contains links
>
> src/java.base/windows/native/libjava/WinNTFileSystem_md.c line 347:
> 
>> 345: 
>> 346:     if (rv == NULL && !(*env)->ExceptionCheck(env)) {
>> 347:         JNU_ThrowIOExceptionWithLastError(env, "Bad pathname"); // XXX message?
> 
> That "not useful" exception message is probably okay because this is what canonicalize has always used.

Removed "XXX" note in 796a634.

> test/jdk/java/io/File/GetCanonicalPath.java line 129:
> 
>> 127:     }
>> 128: 
>> 129:     private static Path createPath(String pathname) throws IOException {
> 
> This method creates a File, returning a Path to the file, so maybe better method name needed here.

Changed to `createFile` and added a one line comment in 796a634.

> test/jdk/java/io/File/GetCanonicalPath.java line 135:
> 
>> 133:     }
>> 134: 
>> 135:     private static boolean testLinks = true;
> 
> It might be clearer to replace this with supportsLinks and have the tests Assumptions.asserTrue(supportsLinks) so they will be skipped when not supported.

Changed `testLinks` to `supportsLinks` and added use of `Assumptions.assumeTrue(supportsLinks, linkMessage)` in 796a634.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20801#discussion_r1744279977
PR Review Comment: https://git.openjdk.org/jdk/pull/20801#discussion_r1744280622
PR Review Comment: https://git.openjdk.org/jdk/pull/20801#discussion_r1744281779


More information about the core-libs-dev mailing list