RFR: 8293122: (fs) Use file cloning in macOS version of Files::copy method [v3]

Brian Burkhalter bpb at openjdk.org
Tue Sep 13 16:21:40 UTC 2022


On Sat, 10 Sep 2022 14:09:21 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8293122: remove volatile cloneFileNotSupported; unlink target on failure; remove getattrlist
>
> src/java.base/macosx/classes/sun/nio/fs/BsdFileSystem.java line 100:
> 
>> 98:             try {
>> 99:                 unlink(dst);
>> 100:             } catch (UnixException ignore) { }
> 
> My previous comment about the missing unlink was a comment on BsdFileSystem.copyFile where it will leave dst in place when the chown fails. The unlink you've added to clone is harmless but the right place is copyFile so that it attempts to cleanup/unlink when an exception is thrown.

Fixed in 96db8562fad4396500f8386c5f26c5fa98b7c373.

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

PR: https://git.openjdk.org/jdk/pull/10188


More information about the nio-dev mailing list