Files.copy() under Linux at least will remove the existing destination even if the source cannot be read...
Alan Bateman
Alan.Bateman at oracle.com
Wed Feb 11 21:58:39 UTC 2015
On 11/02/2015 21:40, Francis Galiegue wrote:
> :
> Not sure what you mean by "test the source file" here. Test its
> existence? That read access is granted?
It stats the file to check it exists and to see the file type. This
isn't good enough here.
>
> Note: I had someone run the code on a Windows machine and in this case
> the destination file was left intact, as, well, expected; except that
> the documentation of Files.copy() itself indeed makes no guarantee as
> to the integrity of the destination file in such a scenario :/
>
The Windows implementation is very different but it should be craft an
ACL to get similar behavior.
Yes on the javadoc, it doesn't make any guarantees for when it fails.
-Alan
More information about the nio-dev
mailing list