You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/11/18 05:42:30 UTC

[camel] branch main updated: [CAMEL-17204] Fix warning message for S3 multipart uploads (#6445)

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

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 608122a  [CAMEL-17204] Fix warning message for S3 multipart uploads (#6445)
608122a is described below

commit 608122ac13573352313d665dbaccf9fdb253e89e
Author: Joe O'Connor <jo...@toasttab.com>
AuthorDate: Thu Nov 18 05:41:39 2021 +0000

    [CAMEL-17204] Fix warning message for S3 multipart uploads (#6445)
    
    * Fix warning message for S3 multipart uploads
    
    Don't log a warning if this is the first part of a multipart upload
    
    * CAMEL-17204  whitespace fixes
---
 .../java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java   | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
index 19aa092..6412320 100644
--- a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
+++ b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
@@ -209,9 +209,11 @@ public class AWS2S3Producer extends DefaultProducer {
 
                 LOG.trace("Uploading part [{}] for {}", part, keyName);
                 try (InputStream fileInputStream = new FileInputStream(filePayload)) {
-                    long skipped = fileInputStream.skip(filePosition);
-                    if (skipped == 0) {
-                        LOG.warn("While trying to upload the file {} file, 0 bytes were skipped", keyName);
+                    if (filePosition > 0) {
+                        long skipped = fileInputStream.skip(filePosition);
+                        if (skipped == 0) {
+                            LOG.warn("While trying to upload the file {} file, 0 bytes were skipped", keyName);
+                        }
                     }
 
                     String etag = getEndpoint().getS3Client()