RFR: 8356678: (fs) Files.readAttributes should map ENOTDIR to NoSuchFileException where possible (unix)
Alan Bateman
alanb at openjdk.org
Tue May 13 06:39:53 UTC 2025
On Mon, 12 May 2025 19:36:22 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
> Treat `ENOTDIR` as causing a `NoSuchFileException` instead of a `FileSystemExcception` in some places in order to handle cases such as a regular file named, for example, `foo/bar`.
The update to UnixFileSystem.copy looks good.
What about move? It looks like rename can fail with ENOTDIR. It looks like we'd want to map that to NoSuchFileException when a component in the source is not a directory, less clear for the target file. But maybe this is why you decided to not change it? (Not changing is okay).
test/jdk/java/nio/file/Files/NotADirectory.java line 27:
> 25: * @bug 8356678
> 26: * @requires (os.family != "windows")
> 27: * @summary Test behavior of Files methods for regular file "foo/bar"
I think the summary needs to say that it tests file operations when a component in the path is a regular rather than a directory.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25191#issuecomment-2875219945
PR Review Comment: https://git.openjdk.org/jdk/pull/25191#discussion_r2086028193
More information about the nio-dev
mailing list