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 15:53:36 UTC 2023


On Fri, 4 Aug 2023 12:14:20 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> 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.

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.

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

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


More information about the nio-dev mailing list