You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/09/13 19:01:07 UTC

[camel] branch camel-3.4.x updated: close ResponseInputStream when not included (#4210)

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

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


The following commit(s) were added to refs/heads/camel-3.4.x by this push:
     new 2c1a96c  close ResponseInputStream when not included (#4210)
2c1a96c is described below

commit 2c1a96c38b4b7ec656d5a680596bd65817cbe185
Author: Filipe Portes <om...@gmail.com>
AuthorDate: Sun Sep 13 21:00:48 2020 +0200

    close ResponseInputStream when not included (#4210)
---
 .../java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java     | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java b/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java
index b99fe70..045567c 100644
--- a/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java
+++ b/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java
@@ -136,6 +136,12 @@ public class AWS2S3Consumer extends ScheduledBatchPollingConsumer {
                     s3Objects.add(s3Object);
                     Exchange exchange = getEndpoint().createExchange(s3Object, s3ObjectSummary.key());
                     answer.add(exchange);
+                } else {
+                    /**
+                     * If includeFolders != true and the object is not included, it is safe to close the object here. 
+                     * If includeFolders == true, the exchage will close the object.
+                     */
+                    IOHelper.close(s3Object);
                 }
             }
         } catch (Throwable e) {