RFR: 8114830: (fs) Files.copy fails due to interference from something else changing the file system [v3]

Alan Bateman alanb at openjdk.org
Fri Aug 4 12:17:31 UTC 2023


On Thu, 3 Aug 2023 22:52:56 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Throw a `FileSystemException` if attempting to create the target file with `O_EXCL` fails with `EEXIST`.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8114830: Use single-arg FileSystemException ctor

src/java.base/unix/classes/sun/nio/fs/UnixFileSystem.java line 524:

> 522:         } catch (UnixException x) {
> 523:             if (x.errno() == EEXIST)
> 524:                 throw new FileSystemException(target.toString());

Shouldn't this be `if (x.errno() == EEXIST && !flags.replaceExisting)` as FileAlreadyExistsException is okay when REPLACE_EXISTING not specified.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15141#discussion_r1284350124


More information about the nio-dev mailing list