RFR: 8361587: AssertionError in File.listFiles() when path is empty and -esa is enabled [v3]

Alan Bateman alanb at openjdk.org
Thu Jul 10 14:22:43 UTC 2025


On Wed, 9 Jul 2025 21:57:56 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Changes to address `File.listFiles` invoked on an empty path. This fixes an oversight in #22821.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8361587: Expand test coverage of File methods

The implementation change looks good, just a few minor comments on the test additions.

test/jdk/java/io/File/EmptyPath.java line 112:

> 110:     @Test
> 111:     public void getAbsoluteFile() {
> 112:         assertEquals(p.toAbsolutePath(), f.getAbsoluteFile().toPath());

I think it would be better to have the "actual" be f.getAbsoluteFile(), so the expected will be p.toAbsolutePath().toFile().

Same comment on the getCanonicalFile test.

test/jdk/java/io/File/EmptyPath.java line 229:

> 227:         child.deleteOnExit();
> 228: 
> 229:         assertTrue(Arrays.asList(f.list()).contains(child.getName()));

I think would be clearer to check that ioSet contains child.getName.

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

Marked as reviewed by alanb (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/26224#pullrequestreview-3005927479
PR Review Comment: https://git.openjdk.org/jdk/pull/26224#discussion_r2197873861
PR Review Comment: https://git.openjdk.org/jdk/pull/26224#discussion_r2197877410


More information about the core-libs-dev mailing list