RFR: 8321561: (fs) Clarify non-atomic behavior of Files.move [v2]

Alan Bateman alanb at openjdk.org
Fri Jan 12 12:13:21 UTC 2024


On Thu, 11 Jan 2024 19:15:41 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Make it clear that a `FileAlreadyExistsException` may be thrown by `Files.move` even if the `REPLACE_EXISTING` option is specified.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8321561: Update verbiage instead of adding API note

src/java.base/share/classes/java/nio/file/Files.java line 1414:

> 1412:      *          system operation, and a file is created at the target location
> 1413:      *          between the existence check and actually moving the source
> 1414:      *          <i>(optional specific exceptions)</i>

I think it might be better to split into two sentences. The second sentence could be "It may also be thrown when the REPLACE_EXISTING option is specified, the move is not atomic, and the target file is created by some other entity at around the same time that this method is called". Would that work for you?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17061#discussion_r1450349721


More information about the nio-dev mailing list