Skip to content

Commit

Permalink
fix(stream): use getBucketACL instead of headBucket to check if bucke…
Browse files Browse the repository at this point in the history
…t exist (#879)

Signed-off-by: SSpirits <[email protected]>
  • Loading branch information
ShadowySpirits authored Jan 4, 2024
1 parent 5a8f53e commit e10b95f
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ private void checkAvailable(S3Utils.S3Context s3Context) {
String multipartPath = String.format("check_available_multipart/%d", System.nanoTime());
try {
// Check network and bucket
readS3Client.headBucket(b -> b.bucket(bucket)).get(3, TimeUnit.SECONDS);
readS3Client.getBucketAcl(b -> b.bucket(bucket)).get(3, TimeUnit.SECONDS);

// Simple write/read/delete
this.write(path, Unpooled.wrappedBuffer(content)).get(30, TimeUnit.SECONDS);
Expand All @@ -619,7 +619,7 @@ private void checkAvailable(S3Utils.S3Context s3Context) {
LOGGER.error("Failed to write/read/delete object on S3 ", e);
String exceptionMsg = String.format("Failed to write/read/delete object on S3. You are using s3Context: %s.", s3Context);

Throwable cause = e.getCause();
Throwable cause = e.getCause() != null ? e.getCause() : e;
if (cause instanceof SdkClientException) {
if (cause.getMessage().contains("UnknownHostException")) {
Throwable rootCause = ExceptionUtils.getRootCause(cause);
Expand Down

0 comments on commit e10b95f

Please sign in to comment.