public static boolean isServiceExceptionRecoverable(ServiceException ex) { final boolean isIOException = ex.getCause() instanceof IOException; final boolean isTimeout = "RequestTimeout".equals(((ServiceException) ex).getErrorCode()); return isIOException || isTimeout; }
public static boolean isObjectInBucket(RestS3Service s3Client, String bucketName, String objectKey) throws ServiceException { try { s3Client.getObjectDetails(bucketName, objectKey); } catch (ServiceException e) { if (404 == e.getResponseCode() || "NoSuchKey".equals(e.getErrorCode()) || "NoSuchBucket".equals(e.getErrorCode())) { return false; } if ("AccessDenied".equals(e.getErrorCode())) { // Object is inaccessible to current user, but does exist. return true; } // Something else has gone wrong throw e; } return true; }
} catch (ServiceException e) { if (404 == e.getResponseCode() || "NoSuchKey".equals(e.getErrorCode()) || "NoSuchBucket".equals(e.getErrorCode())) if ("AccessDenied".equals(e.getErrorCode()))
} catch (ServiceException e) { if (404 == e.getResponseCode() || "NoSuchKey".equals(e.getErrorCode()) || "NoSuchBucket".equals(e.getErrorCode())) if ("AccessDenied".equals(e.getErrorCode()))
private void handleServiceException(ServiceException e) throws IOException { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } else { if(LOG.isDebugEnabled()) { LOG.debug("Got ServiceException with Error code: " + e.getErrorCode() + ";and Error message: " + e.getErrorMessage()); } } }
/** * Create a service exception that includes a specific message, an optional XML error * document returned by service, and an optional underlying cause exception. * * @param message * @param xmlMessage * @param cause */ public ServiceException(String message, String xmlMessage, Throwable cause) { super(message, cause); if (xmlMessage != null) { parseXmlMessage(xmlMessage); } MxDelegate.getInstance().registerS3ServiceExceptionEvent(getErrorCode()); }
/** * Create a service exception that includes a specific message, an optional XML error * document returned by service, and an optional underlying cause exception. * * @param message * @param xmlMessage * @param cause */ public ServiceException(String message, String xmlMessage, Throwable cause) { super(message, cause); if (xmlMessage != null) { parseXmlMessage(xmlMessage); } MxDelegate.getInstance().registerS3ServiceExceptionEvent(getErrorCode()); }
|| "NoSuchKey".equals(e.getErrorCode()) || "NoSuchBucket".equals(e.getErrorCode())) { return Optional.absent(); } else {
ServiceException se = (ServiceException) thrown; LOG.debug("S3ServiceException: {}: {} : {}", se.getErrorCode(), se.toString(), se, se); result = new S3Exception(se); } else if (thrown instanceof IOException) {
else if("RequestTimeout".equals(exception.getErrorCode())) { if(requestTimeoutErrorCount >= retryMaxCount) { throw exception; else if("RequestTimeTooSkewed".equals(exception.getErrorCode())) { if(requestTimeTooSkewedErrorCount >= retryMaxCount) { throw exception; && "NoSuchKey".equals(exception.getErrorCode()) else if ("InvalidRequest".equals(exception.getErrorCode()) && exception.getErrorMessage().contains("Please use AWS4-HMAC-SHA256")) else if("AuthorizationHeaderMalformed".equals(exception.getErrorCode())) { String expectedRegion = null; try {
if(StringUtils.isNotBlank(e.getErrorCode())) { switch(e.getErrorCode()) { case "SignatureDoesNotMatch": case "InvalidAccessKeyId": if(StringUtils.isNotBlank(e.getErrorCode())) { switch(e.getErrorCode()) { case "RequestTimeout": return new ConnectionTimeoutException(buffer.toString(), e);
else if("RequestTimeout".equals(exception.getErrorCode())) { if(requestTimeoutErrorCount >= retryMaxCount) { throw exception; else if("RequestTimeTooSkewed".equals(exception.getErrorCode())) { if(requestTimeTooSkewedErrorCount >= retryMaxCount) { throw exception; && "NoSuchKey".equals(exception.getErrorCode()) else if ("InvalidRequest".equals(exception.getErrorCode()) && exception.getErrorMessage().contains("Please use AWS4-HMAC-SHA256")) else if("AuthorizationHeaderMalformed".equals(exception.getErrorCode())) { String expectedRegion = null; try {