You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Slawomir Pasieczny (Jira)" <ji...@apache.org> on 2020/02/07 11:29:00 UTC

[jira] [Commented] (IO-544) Should FileUtils.copyFile be flushed and synced before comparing file sizes?

    [ https://issues.apache.org/jira/browse/IO-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17032315#comment-17032315 ] 

Slawomir Pasieczny commented on IO-544:
---------------------------------------

Hi,

currently I'm using Windows 10 and VisualSutdioCode to run 'devcontainers' - I have my java code on windows, and VSCode setup docker container with linux on which I can develop and so on. This docker container has access to workspace on Windows File System by mounted directory with mount type CIFS. During running maven install I'm getting (only in java projects which use maven resources):
{code:java}
Caused by: java.io.IOException: Failed to copy full contents from <SRC> to <DEST>
 at org.codehaus.plexus.util.FileUtils.copyFile (FileUtils.java:1018)
 at org.codehaus.plexus.util.FileUtils.copyFile (FileUtils.java:2234)
at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile (DefaultMavenFileFilter.java:122){code}
So I assume that's connected to this issue. This problem makes it impossible to use DevContainer at all. Is there any chance to fix this as [~seanpltr] proposed in comment from 06/Jul/17 01:27?

Thanks in advance for answer.

 

> Should FileUtils.copyFile be flushed and synced before comparing file sizes?
> ----------------------------------------------------------------------------
>
>                 Key: IO-544
>                 URL: https://issues.apache.org/jira/browse/IO-544
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.5
>         Environment: Win Server 2008, x86
>            Reporter: Sean Poulter
>            Priority: Major
>
> I've been struggling to troubleshoot intermittent {{IOExceptions}} thrown from {{FileUtils.doCopyFile}} when copying 2-4KB files from a local temporary file to a network drive. Despite the error, the file appears on the network drive when I check. Should the output channel/buffer be forced/flushed before closing, and synchronized before comparing the file lengths? It's a rather intermittent issue on a relatively high throughput PC so I'd expect there to be more IO latency than normal.
> I found myself referencing:
> * [The source code for FileUtils v2.5|https://commons.apache.org/proper/commons-io/javadocs/api-2.5/src-html/org/apache/commons/io/FileUtils.html]
> * [FileChannel#force(boolean)|https://docs.oracle.com/javase/8/docs/api/java/nio/channels/FileChannel.html#force-boolean-]
> * [IO-443 - FileUtils.copyFile methods throw an unnecessary "Failed to copy full contents from" exception|https://issues.apache.org/jira/browse/IO-443]
> Thanks,
> Sean



--
This message was sent by Atlassian Jira
(v8.3.4#803005)