fix(S3): use doesBucketExist() to evaluate bucket existance

This commit is contained in:
Manuel Jenny 2021-04-29 13:04:41 +02:00
parent 2f1f9faeae
commit c55dc62d16
No known key found for this signature in database
GPG Key ID: 1C80FE62B2BEAA18

View File

@ -110,17 +110,10 @@ class S3Impl {
}
public boolean bucketExists() throws BackendException {
try {
client().listObjectsV2(cloud.s3Bucket());
} catch(AmazonS3Exception ex) {
if (ex.getErrorCode().equals(S3CloudApiExceptions.S3CloudApiErrorCodes.NO_SUCH_BUCKET.getValue())) {
if (client().doesBucketExist(cloud.s3Bucket())) {
throw new NoSuchBucketException(cloud.s3Bucket());
} else {
throw new FatalBackendException(ex);
}
}
return true;
return true;
}
public boolean exists(S3Node node) {