Files.copy() under Linux at least will remove the existing destination even if the source cannot be read...

Francis Galiegue fgaliegue at gmail.com
Wed Feb 11 21:40:00 UTC 2015


On Wed, Feb 11, 2015 at 10:35 PM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
[...]
>
> The implementation does test the the source file before removing the target
> but it should really have it open to avoid this scenario. Can you submit a
> bug on this?
>

Not sure what you mean by "test the source file" here. Test its
existence? That read access is granted?

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 :/

-- 
Francis Galiegue, fgaliegue at gmail.com, https://github.com/fge
JSON Schema in Java: http://json-schema-validator.herokuapp.com
Parsers in pure Java: https://github.com/fge/grappa


More information about the nio-dev mailing list