From 36756e611b462b0b41bf5ff28158516a6d0fa29f Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Mon, 16 Dec 2013 08:27:00 -0800 Subject: [PATCH] S3Utils: Fix retry predicate --- .../main/java/io/druid/storage/s3/S3Utils.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/s3-extensions/src/main/java/io/druid/storage/s3/S3Utils.java b/s3-extensions/src/main/java/io/druid/storage/s3/S3Utils.java index 619ad737cfe..3ae7088d88f 100644 --- a/s3-extensions/src/main/java/io/druid/storage/s3/S3Utils.java +++ b/s3-extensions/src/main/java/io/druid/storage/s3/S3Utils.java @@ -21,7 +21,7 @@ package io.druid.storage.s3; import com.google.common.base.Predicate; import com.metamx.common.RetryUtils; -import org.jets3t.service.S3ServiceException; +import org.jets3t.service.ServiceException; import org.jets3t.service.impl.rest.httpclient.RestS3Service; import org.jets3t.service.model.S3Bucket; import org.jets3t.service.model.S3Object; @@ -61,9 +61,9 @@ public class S3Utils { if (e instanceof IOException) { return true; - } else if (e instanceof S3ServiceException) { + } else if (e instanceof ServiceException) { final boolean isIOException = e.getCause() instanceof IOException; - final boolean isTimeout = "RequestTimeout".equals(((S3ServiceException) e).getS3ErrorCode()); + final boolean isTimeout = "RequestTimeout".equals(((ServiceException) e).getErrorCode()); return isIOException || isTimeout; } else { return false; @@ -75,18 +75,18 @@ public class S3Utils } public static boolean isObjectInBucket(RestS3Service s3Client, String bucketName, String objectKey) - throws S3ServiceException + throws ServiceException { try { s3Client.getObjectDetails(new S3Bucket(bucketName), objectKey); } - catch (S3ServiceException e) { + catch (ServiceException e) { if (404 == e.getResponseCode() - || "NoSuchKey".equals(e.getS3ErrorCode()) - || "NoSuchBucket".equals(e.getS3ErrorCode())) { + || "NoSuchKey".equals(e.getErrorCode()) + || "NoSuchBucket".equals(e.getErrorCode())) { return false; } - if ("AccessDenied".equals(e.getS3ErrorCode())) { + if ("AccessDenied".equals(e.getErrorCode())) { // Object is inaccessible to current user, but does exist. return true; }