You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2022/08/08 14:35:00 UTC

[jira] [Resolved] (IO-443) FileUtils.copyFile methods throw an unnecessary "Failed to copy full contents from" exception

     [ https://issues.apache.org/jira/browse/IO-443?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory resolved IO-443.
--------------------------------
    Fix Version/s: 2.12.0
       Resolution: Fixed

The implementation now uses Files.copy(Path,Path,CopyOptions) and the size check is gone.

> FileUtils.copyFile methods throw an unnecessary "Failed to copy full contents from" exception 
> ----------------------------------------------------------------------------------------------
>
>                 Key: IO-443
>                 URL: https://issues.apache.org/jira/browse/IO-443
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.4
>         Environment: Win x86  32 bit
>            Reporter: Sami Nieminen
>            Priority: Major
>             Fix For: 2.12.0
>
>
> The private doCopyFile method of FileUtils does a comparison between the source and destination file sizes after the data has been copied. 
> If the destination file has been removed, renamed, or otherwise no more accessible (remote share no more available) between the finally block and the size comparison the destFile.length() returns zero. If the source file is not zero bytes in size an exception with the message "Failed to copy full contents from '" + srcFile + "' to '" + destFile " will be thrown.
> Regards
> Sami



--
This message was sent by Atlassian Jira
(v8.20.10#820010)