Add comment about AWS S3 "doesBucketExist()" method

This commit is contained in:
Tanguy Leroux 2015-08-03 11:02:16 +02:00
parent c76a279b31
commit 3537610760
1 changed files with 6 additions and 0 deletions

View File

@ -71,6 +71,12 @@ public class S3BlobStore extends AbstractComponent implements BlobStore {
} }
this.numberOfRetries = maxRetries; this.numberOfRetries = maxRetries;
// Note: the method client.doesBucketExist() may return 'true' is the bucket exists
// but we don't have access to it (ie, 403 Forbidden response code)
// Also, if invalid security credentials are used to execute this method, the
// client is not able to distinguish between bucket permission errors and
// invalid credential errors, and this method could return an incorrect result.
if (!client.doesBucketExist(bucket)) { if (!client.doesBucketExist(bucket)) {
if (region != null) { if (region != null) {
client.createBucket(bucket, region); client.createBucket(bucket, region);