if(e.getResponseCode() == 403) { if(log.isDebugEnabled()) { log.debug("Bucket named '" + bucketName + "' exists but is inaccessible, " else if(e.getResponseCode() == 404) { if(log.isDebugEnabled()) { log.debug("Bucket does not exist: " + bucketName, e);
if(e.getResponseCode() == 403) { if(log.isDebugEnabled()) { log.debug("Bucket named '" + bucketName + "' exists but is inaccessible, " else if(e.getResponseCode() == 404) { if(log.isDebugEnabled()) { log.debug("Bucket does not exist: " + bucketName, e);
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; }
getObjectDetails(bucketName, objectKey); } catch (ServiceException e) { if (404 == e.getResponseCode() || "NoSuchKey".equals(e.getErrorCode()) || "NoSuchBucket".equals(e.getErrorCode()))
getObjectDetails(bucketName, objectKey); } catch (ServiceException e) { if (404 == e.getResponseCode() || "NoSuchKey".equals(e.getErrorCode()) || "NoSuchBucket".equals(e.getErrorCode()))
log.error(outerException, "Exception while listing on %s", uri); if (outerException.getResponseCode() == 403) {
if (404 == e.getResponseCode() || "NoSuchKey".equals(e.getErrorCode()) || "NoSuchBucket".equals(e.getErrorCode())) {
this.append(buffer, e.getMessage()); switch(e.getResponseCode()) { case HttpStatus.SC_FORBIDDEN: if(StringUtils.isNotBlank(e.getErrorCode())) { return new InteroperabilityException(buffer.toString(), e); return new HttpResponseExceptionMappingService().map(new HttpResponseException(e.getResponseCode(), buffer.toString()));
/** * Wrap a ServiceException as an S3ServiceException. * @param se */ public S3ServiceException(ServiceException se) { super(se.getMessage(), se.getXmlMessage(), se.getCause()); this.setResponseHeaders(se.getResponseHeaders()); this.setResponseCode(se.getResponseCode()); this.setResponseStatus(se.getResponseStatus()); this.setResponseDate(se.getResponseDate()); this.setRequestVerb(se.getRequestVerb()); this.setRequestPath(se.getRequestPath()); this.setRequestHost(se.getRequestHost()); }
/** * Wrap a ServiceException as an S3ServiceException. * @param se */ public S3ServiceException(ServiceException se) { super(se.getMessage(), se.getXmlMessage(), se.getCause()); this.setResponseHeaders(se.getResponseHeaders()); this.setResponseCode(se.getResponseCode()); this.setResponseStatus(se.getResponseStatus()); this.setResponseDate(se.getResponseDate()); this.setRequestVerb(se.getRequestVerb()); this.setRequestPath(se.getRequestPath()); this.setRequestHost(se.getRequestHost()); }