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

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


The following commit(s) were added to refs/heads/camel-4.8.x by this push:
     new 26e97bf83e2 CAMEL-21562. It's not a problem if the client is not 
allowed to do HeadBucket (#16625) (#16626)
26e97bf83e2 is described below

commit 26e97bf83e2db72a612c1d79e4c1e34da3794cf5
Author: Andrea Cosentino <[email protected]>
AuthorDate: Fri Dec 20 15:16:07 2024 +0100

    CAMEL-21562. It's not a problem if the client is not allowed to do 
HeadBucket (#16625) (#16626)
    
    * This may fix  CAMEL-18022
    
    * Formatted correctly.
    
    Co-authored-by: Michiel Meeuwissen <[email protected]>
---
 .../java/org/apache/camel/component/aws2/s3/AWS2S3Endpoint.java     | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git 
a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Endpoint.java
 
b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Endpoint.java
index f466fb0c23c..06c174ed378 100644
--- 
a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Endpoint.java
+++ 
b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Endpoint.java
@@ -149,6 +149,12 @@ public class AWS2S3Endpoint extends ScheduledPollEndpoint 
implements EndpointSer
             LOG.trace("Bucket [{}] already exists", bucketName);
             return;
         } catch (AwsServiceException ase) {
+            if (ase.statusCode() == 403) { // means we can't check if the 
bucket exists
+                if (!getConfiguration().isAutoCreateBucket()) {
+                    // We are not requested to create it if it doesn't, so we 
can only assume that it does
+                    return;
+                }
+            }
             /* 404 means the bucket doesn't exist */
             if (!(ase.awsErrorDetails().sdkHttpResponse().statusCode() == 
404)) {
                 throw ase;

Reply via email to