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

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


The following commit(s) were added to refs/heads/master by this push:
     new 3305678  CAMEL-16423 - Camel-Minio converts any body consumed to String
3305678 is described below

commit 3305678a8ad055efa4afe5a16fc7cd12b6853b63
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Mon Mar 29 14:01:49 2021 +0200

    CAMEL-16423 - Camel-Minio converts any body consumed to String
---
 components/camel-minio/pom.xml                                       | 5 +++++
 .../main/java/org/apache/camel/component/minio/MinioConsumer.java    | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/components/camel-minio/pom.xml b/components/camel-minio/pom.xml
index 854f4c7..e803318 100644
--- a/components/camel-minio/pom.xml
+++ b/components/camel-minio/pom.xml
@@ -45,6 +45,11 @@
             <artifactId>minio</artifactId>
             <version>${minio-version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-compress</artifactId>
+            <version>${commons-compress-version}</version>
+        </dependency>
 
         <!-- logging -->
         <dependency>
diff --git 
a/components/camel-minio/src/main/java/org/apache/camel/component/minio/MinioConsumer.java
 
b/components/camel-minio/src/main/java/org/apache/camel/component/minio/MinioConsumer.java
index 6430df9..f82d5fd 100644
--- 
a/components/camel-minio/src/main/java/org/apache/camel/component/minio/MinioConsumer.java
+++ 
b/components/camel-minio/src/main/java/org/apache/camel/component/minio/MinioConsumer.java
@@ -49,6 +49,7 @@ import org.apache.camel.support.SynchronizationAdapter;
 import org.apache.camel.util.CastUtils;
 import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.URISupport;
+import org.apache.commons.compress.utils.IOUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -415,7 +416,7 @@ public class MinioConsumer extends 
ScheduledBatchPollingConsumer {
         getEndpoint().getObjectStat(objectName, message);
 
         if (getConfiguration().isIncludeBody()) {
-            message.setBody(getEndpoint().readInputStream(minioObject));
+            message.setBody(IOUtils.toByteArray(minioObject));
             if (getConfiguration().isAutoCloseBody()) {
                 exchange.adapt(ExtendedExchange.class).addOnCompletion(new 
SynchronizationAdapter() {
                     @Override

Reply via email to