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 { try {
if (blobStore.createContainerInLocation(location, containerName, created = blobStore.createContainerInLocation(location,
options)) { containerName, options);
return; } catch (AuthorizationException ae) {
} throw new S3Exception(S3ErrorCode.BUCKET_ALREADY_EXISTS, ae);
}
if (!created) {
S3ErrorCode errorCode = S3ErrorCode.BUCKET_ALREADY_OWNED_BY_YOU; S3ErrorCode errorCode = S3ErrorCode.BUCKET_ALREADY_OWNED_BY_YOU;
sendSimpleErrorResponse(response, sendSimpleErrorResponse(response,
errorCode, errorCode.getMessage(), "BucketName", errorCode, errorCode.getMessage(), "BucketName",
containerName); containerName);
} catch (AuthorizationException ae) {
throw new S3Exception(S3ErrorCode.BUCKET_ALREADY_EXISTS, ae);
} }
} }