Skip to content

Commit cf88797

Browse files
groldanaaime
authored andcommitted
Fix Azure blobstore error instantiating AzureClient
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.
1 parent e612a2a commit cf88797

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureClient.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,13 @@ public AzureClient(AzureBlobStoreData configuration) throws StorageException {
9393
this.container = serviceURL.createContainerURL(containerName);
9494
// no way to see if the containerURL already exists, try to create and see if
9595
// we get a 409 CONFLICT
96+
int status;
97+
try {
98+
status = this.container.getProperties().blockingGet().statusCode();
99+
} catch (com.microsoft.azure.storage.blob.StorageException se) {
100+
status = se.statusCode();
101+
}
96102
try {
97-
int status = this.container.getProperties().blockingGet().statusCode();
98103
if (status == HttpStatus.NOT_FOUND.value()) {
99104
status = this.container.create(null, null, null).blockingGet().statusCode();
100105
if (!HttpStatus.valueOf(status).is2xxSuccessful()

0 commit comments

Comments
 (0)