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

Alan Bateman alanb at openjdk.org
Fri Aug 4 17:18:32 UTC 2023


On Fri, 4 Aug 2023 16:03:22 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: Add flags.replaceExisting to check for FileSystemException

test/jdk/java/nio/file/Files/CopyInterference.java line 143:

> 141:             results[i] = es.submit(copyTask);
> 142: 
> 143:         es.close();

You can use try-with-resources with ExecutorService to ensure that it is closed the event of an exception.

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

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


More information about the nio-dev mailing list