RFR: 8287843: File::getCanonicalFile doesn't work for \\?\C:\ style paths DOS device paths [v7]

Alan Bateman alanb at openjdk.org
Sat Nov 11 11:22:01 UTC 2023


On Wed, 4 Oct 2023 20:35:25 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> In the Windows implementation of java.io.File.getCanonicalPath, strip any long path or UNC prefix before canonicalizing the remainder of the pathname.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8287843: Remove unused constant and method from WindowsPrefixes test

Implementation change looks fine. I see CSR is approved. We'll need to RN this change too.

test/jdk/java/io/File/GetAbsolutePath.java line 76:

> 74:     public void windows(String path, String absolute) throws IOException {
> 75:         assertEquals(absolute.toLowerCase(),
> 76:                      new File(path).getAbsolutePath().toLowerCase());

WinNTFileSystem.compareTo uses compareToIgnoreCase so this test should probably do the same.

test/jdk/java/io/File/WindowsPrefixes.java line 27:

> 25:  * @bug 8287843
> 26:  * @summary Basic test for Windows path prefixes
> 27:  * @requires (os.family == "windows")

Given the `@requires` then I assume `@EnabledOnOs(OS.WINDOWS)` can be dropped from the test methods.

test/jdk/java/io/File/WindowsPrefixes.java line 54:

> 52:                          Arguments.of("C:\\foo"),
> 53:                          Arguments.of("C:foo"),
> 54:                          Arguments.of("C:\\foo\\bar"));

I suppose this should include `\foo` in the list too.

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

PR Review: https://git.openjdk.org/jdk/pull/15603#pullrequestreview-1726039058
PR Review Comment: https://git.openjdk.org/jdk/pull/15603#discussion_r1390204239
PR Review Comment: https://git.openjdk.org/jdk/pull/15603#discussion_r1390203019
PR Review Comment: https://git.openjdk.org/jdk/pull/15603#discussion_r1390203853


More information about the core-libs-dev mailing list