Narrow exception handling scope

pull/50/head
Andrew Gaul 2015-03-13 18:58:27 -07:00
rodzic 27900bf4de
commit 209f3e60e4
1 zmienionych plików z 7 dodań i 6 usunięć

Wyświetl plik

@ -750,17 +750,18 @@ final class S3ProxyHandler extends AbstractHandler {
}
}
boolean created;
try {
if (blobStore.createContainerInLocation(location, containerName,
options)) {
return;
}
created = blobStore.createContainerInLocation(location,
containerName, options);
} catch (AuthorizationException ae) {
throw new S3Exception(S3ErrorCode.BUCKET_ALREADY_EXISTS, ae);
}
if (!created) {
S3ErrorCode errorCode = S3ErrorCode.BUCKET_ALREADY_OWNED_BY_YOU;
sendSimpleErrorResponse(response,
errorCode, errorCode.getMessage(), "BucketName",
containerName);
} catch (AuthorizationException ae) {
throw new S3Exception(S3ErrorCode.BUCKET_ALREADY_EXISTS, ae);
}
}