This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch fix/CAMEL-24089
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 51c1fbc071ab7829f7bde02f06dd63ac4f62b9b0
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Jul 15 18:44:24 2026 +0200

    CAMEL-24089: camel-file - Loop transferTo to handle files larger than 2 GB 
with readLock=fileLock
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../main/java/org/apache/camel/component/file/FileOperations.java   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/components/camel-file/src/main/java/org/apache/camel/component/file/FileOperations.java
 
b/components/camel-file/src/main/java/org/apache/camel/component/file/FileOperations.java
index a632579bc527..6bd74b8bdd61 100644
--- 
a/components/camel-file/src/main/java/org/apache/camel/component/file/FileOperations.java
+++ 
b/components/camel-file/src/main/java/org/apache/camel/component/file/FileOperations.java
@@ -522,7 +522,11 @@ public class FileOperations implements 
GenericFileOperations<File> {
             try (FileOutputStream fos = new FileOutputStream(target);
                  FileChannel out = fos.getChannel()) {
                 LOG.trace("writeFileByFile using FileChannel: {} -> {}", 
source, target);
-                channel.transferTo(0, channel.size(), out);
+                long size = channel.size();
+                long position = 0;
+                while (position < size) {
+                    position += channel.transferTo(position, size - position, 
out);
+                }
             }
         } else {
             // use regular file copy

Reply via email to