RFR: 8114830: (fs) Files.copy fails due to interference from something else changing the file system [v3]
Brian Burkhalter
bpb at openjdk.org
Fri Aug 4 17:41:37 UTC 2023
On Fri, 4 Aug 2023 15:50:19 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> 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.
>
> I suppose the target could be created on another thread between when it is deleted and the call to `open` so this version would be better.
So changed in bc43e5eb4579e8e5105d5af9d0a94ccdbb6b8eb1.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15141#discussion_r1284688454
More information about the nio-dev
mailing list