Skip to content

Commit

Permalink
Fix Azure blobstore error instantiating AzureClient
Browse files Browse the repository at this point in the history
commit 72ce566 "Avoid infinite number of calls to listBlobs when
doing prefix removals (e..g, gridset or layer removals)"
changed the gwc `AzureClient` check for container existence from an
attemp to create it to an attempt to get its properties before creating
it.

When the container doesn't exist, the blocking call throws
`com.microsoft.azure.storage.blob.StorageException`, which contains the
status code.

Wrap that call in a try-catch block and get the status code from the
exception.
  • Loading branch information
groldan authored and github-actions[bot] committed Aug 19, 2024
1 parent 1d54cc4 commit 046a83a
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,13 @@ public AzureClient(AzureBlobStoreData configuration) throws StorageException {
this.container = serviceURL.createContainerURL(containerName);
// no way to see if the containerURL already exists, try to create and see if
// we get a 409 CONFLICT
int status;
try {
status = this.container.getProperties().blockingGet().statusCode();
} catch (com.microsoft.azure.storage.blob.StorageException se) {
status = se.statusCode();
}
try {
int status = this.container.getProperties().blockingGet().statusCode();
if (status == HttpStatus.NOT_FOUND.value()) {
status = this.container.create(null, null, null).blockingGet().statusCode();
if (!HttpStatus.valueOf(status).is2xxSuccessful()
Expand Down

0 comments on commit 046a83a

Please sign in to comment.