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 665d58302dd CAMEL-20727: camel-azure - Data lake upload should not 
read content into memory (#13993)
665d58302dd is described below

commit 665d58302dd5032fe7b393a42d8e4cd68c4fbfda
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Tue Apr 30 15:23:53 2024 +0200

    CAMEL-20727: camel-azure - Data lake upload should not read content into 
memory (#13993)
---
 .../camel/component/azure/storage/datalake/DataLakeProducer.java    | 4 +---
 .../azure/storage/datalake/operations/DataLakeFileOperations.java   | 6 +++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git 
a/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/DataLakeProducer.java
 
b/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/DataLakeProducer.java
index 8860252b9d4..ab0af314c6e 100644
--- 
a/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/DataLakeProducer.java
+++ 
b/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/DataLakeProducer.java
@@ -16,8 +16,6 @@
  */
 package org.apache.camel.component.azure.storage.datalake;
 
-import java.io.IOException;
-
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import 
org.apache.camel.component.azure.storage.datalake.client.DataLakeDirectoryClientWrapper;
@@ -50,7 +48,7 @@ public class DataLakeProducer extends DefaultProducer {
     }
 
     @Override
-    public void process(Exchange exchange) throws IllegalArgumentException, 
IOException {
+    public void process(Exchange exchange) throws Exception {
         DataLakeOperationsDefinition operation = determineOperation(exchange);
         switch (operation) {
             case listFileSystem:
diff --git 
a/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/operations/DataLakeFileOperations.java
 
b/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/operations/DataLakeFileOperations.java
index dcdd6fa4938..72ab8856a89 100644
--- 
a/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/operations/DataLakeFileOperations.java
+++ 
b/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/operations/DataLakeFileOperations.java
@@ -203,15 +203,15 @@ public class DataLakeFileOperations {
         return new DataLakeOperationResponse(true);
     }
 
-    public DataLakeOperationResponse upload(final Exchange exchange) throws 
IOException {
+    public DataLakeOperationResponse upload(final Exchange exchange) throws 
Exception {
         final FileCommonRequestOptions commonRequestOptions = 
getCommonRequestOptions(exchange);
         final ParallelTransferOptions transferOptions = 
configurationProxy.getParallelTransferOptions(exchange);
-        final FileStreamAndLength fileStreamAndLength = 
FileStreamAndLength.createFileStreamAndLengthFromExchangeBody(exchange);
+        final InputStream is = 
exchange.getMessage().getMandatoryBody(InputStream.class);
         final String permission = configurationProxy.getPermission(exchange);
         final String umask = configurationProxy.getUmask(exchange);
 
         final FileParallelUploadOptions uploadOptions
-                = new 
FileParallelUploadOptions(fileStreamAndLength.getInputStream())
+                = new FileParallelUploadOptions(is)
                         
.setHeaders(commonRequestOptions.getPathHttpHeaders()).setParallelTransferOptions(transferOptions)
                         
.setMetadata(commonRequestOptions.getMetadata()).setPermissions(permission)
                         
.setRequestConditions(commonRequestOptions.getRequestConditions())

Reply via email to