RFR: 8356678: (fs) Files.readAttributes should map ENOTDIR to NoSuchFileException where possible (unix) [v2]

Brian Burkhalter bpb at openjdk.org
Wed May 14 17:21:14 UTC 2025


On Wed, 14 May 2025 05:37:39 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8356678: Add more checks in copy and move; beef up test
>
> src/java.base/unix/classes/sun/nio/fs/UnixFileSystem.java line 487:
> 
>> 485:             if (x.errno() == ENOTDIR) {
>> 486:                 x.setError(ENOENT);
>> 487:             }
> 
> This is the mkdir to create the target so I don't think we should change this as it would be very confusing to see NoSuchFileException here.

Reverted in 0908e75.

> src/java.base/unix/classes/sun/nio/fs/UnixFileSystem.java line 638:
> 
>> 636:                 if (x.errno() == ENOTDIR) {
>> 637:                     x.setError(ENOENT);
>> 638:                 }
> 
> This is also the target so I don't think this should be changed.

Reverted in 0908e75.

> src/java.base/unix/classes/sun/nio/fs/UnixFileSystem.java line 829:
> 
>> 827:                         x.errorString());
>> 828:                 } else if (x.errno() == ENOTDIR) {
>> 829:                     x.setError(ENOENT);
> 
> This is rename where the issue might be the source or target path. So I think we have to drop this change too.

Reverted in 0908e75.

> src/java.base/unix/classes/sun/nio/fs/UnixFileSystem.java line 904:
> 
>> 902:                 if (x.errno() == ENOTDIR) {
>> 903:                     x.setError(ENOENT);
>> 904:                 }
> 
> This is also a rename so need to drop this change too.

Reverted in 0908e75.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25191#discussion_r2089398071
PR Review Comment: https://git.openjdk.org/jdk/pull/25191#discussion_r2089398290
PR Review Comment: https://git.openjdk.org/jdk/pull/25191#discussion_r2089398500
PR Review Comment: https://git.openjdk.org/jdk/pull/25191#discussion_r2089398714


More information about the nio-dev mailing list