RFR: 8325302: Files.move(REPLACE_EXISTING) throws NoSuchFileException on deleted target

Brian Burkhalter bpb at openjdk.org
Wed Feb 7 00:35:03 UTC 2024


On Wed, 7 Feb 2024 00:28:25 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> When replacing an existing file as part of a non-atomic copy (`Files.copy`) or move (`Files.move`), ignore any file not found error encountered while trying to delete the target file.

A target file being replaced might be verified to exist at a point in time prior to when an attempt is actually made to delete it, so if the file is deleted by some other entity in the intervening time, a file not found error will occur during the deletion call. In this case, an error indicating that the file does not exist (cannot be found) should simply be ignored.

The correctness of the changes were verified manually.

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

PR Comment: https://git.openjdk.org/jdk/pull/17740#issuecomment-1931020438


More information about the nio-dev mailing list