@Override public ObjectMetadata getObjectMetadata(GetObjectMetadataRequest getObjectMetadataRequest) { this.getObjectMetadataRequest = getObjectMetadataRequest; if (getObjectMetadataHttpCode != SC_OK) { AmazonS3Exception exception = new AmazonS3Exception("Failing getObjectMetadata call with " + getObjectMetadataHttpCode); exception.setStatusCode(getObjectMetadataHttpCode); throw exception; } return null; }
@Override public S3Object getObject(GetObjectRequest getObjectRequest) { if (getObjectHttpCode != SC_OK) { AmazonS3Exception exception = new AmazonS3Exception("Failing getObject call with " + getObjectHttpCode); exception.setStatusCode(getObjectHttpCode); throw exception; } return null; }
/** * Creates a new AmazonS3Exception object with the values set. */ public AmazonS3Exception build() { AmazonS3Exception s3Exception = errorResponseXml == null ? new AmazonS3Exception( errorMessage) : new AmazonS3Exception(errorMessage, errorResponseXml); s3Exception.setErrorCode(errorCode); s3Exception.setExtendedRequestId(extendedRequestId); s3Exception.setStatusCode(statusCode); s3Exception.setRequestId(requestId); s3Exception.setCloudFrontId(cloudFrontId); s3Exception.setAdditionalDetails(additionalDetails); s3Exception.setErrorType(errorTypeOf(statusCode)); return s3Exception; }
errorCode = getText(); } else if (name.equals("Message")) { ase = new AmazonS3Exception(getText()); } else if (name.equals("RequestId")) { requestId = getText();
String hostId = copyObjectResultHandler.getErrorHostId(); AmazonS3Exception ase = new AmazonS3Exception(errorMessage); ase.setErrorCode(errorCode); ase.setErrorType(ErrorType.Service);
/** * Used to create an {@link AmazonS3Exception} when we failed to read the * error response or parsed the error response as XML. */ private AmazonS3Exception newAmazonS3Exception(String errmsg, HttpResponse httpResponse) { final AmazonS3Exception ase = new AmazonS3Exception(errmsg); final int statusCode = httpResponse.getStatusCode(); ase.setErrorCode(statusCode + " " + httpResponse.getStatusText()); ase.setStatusCode(statusCode); ase.setErrorType(errorTypeOf(statusCode)); final Map<String, String> headers = httpResponse.getHeaders(); ase.setRequestId(headers.get(Headers.REQUEST_ID)); ase.setExtendedRequestId(headers.get(Headers.EXTENDED_REQUEST_ID)); ase.setCloudFrontId(headers.get(Headers.CLOUD_FRONT_ID)); final Map<String, String> additionalDetails = new HashMap<String, String>(); additionalDetails.put(Headers.S3_BUCKET_REGION, headers.get(Headers.S3_BUCKET_REGION)); ase.setAdditionalDetails(additionalDetails); return ase; }
String hostId = copyObjectResultHandler.getErrorHostId(); AmazonS3Exception ase = new AmazonS3Exception(errorMessage); ase.setErrorCode(errorCode); ase.setErrorType(ErrorType.Service);
errorCode = getText(); } else if (name.equals("Message")) { ase = new AmazonS3Exception(getText()); } else if (name.equals("RequestId")) { requestId = getText();
public void write(File file, String data, boolean append) { try { FileUtils.write(file, data, append); } catch (IOException e) { throw new AmazonS3Exception("Error writing to file", e); } }
public void write(File file, String data, boolean append) { try { FileUtils.write(file, data, append); } catch (IOException e) { throw new AmazonS3Exception("Error writing to file", e); } }
final String requestId = XpathUtils.asString("Error/RequestId", document); final String extendedRequestId = XpathUtils.asString("Error/HostId", document); final AmazonS3Exception ase = new AmazonS3Exception(message); final int statusCode = errorResponse.getStatusCode(); ase.setStatusCode(statusCode);
@Override public boolean exists(final String path) { try { return this.sessionFactory.getSession().exists(path); } catch (IOException e) { throw new AmazonS3Exception("Failed to check the path " + path, e); } }
@Override public S3Object getObject(String bucketName, String key) { File file = getFile(bucketName, key); if (file.isFile()) { return new OfflineS3Object(bucketName, key, file); } else { AmazonS3Exception amazonS3Exception = new AmazonS3Exception("Object does not exist."); amazonS3Exception.setStatusCode(404); throw amazonS3Exception; } }
@Override public ObjectMetadata getObjectMetadata(String bucketName, String key) throws AmazonClientException { if (getObjectMetadataHttpCode != SC_OK) { AmazonS3Exception exception = new AmazonS3Exception("Failing getObjectMetadata call with " + getObjectMetadataHttpCode); exception.setStatusCode(getObjectMetadataHttpCode); throw exception; } return null; }
@Override public ObjectMetadata getObjectMetadata(GetObjectMetadataRequest getObjectMetadataRequest) { this.getObjectMetadataRequest = getObjectMetadataRequest; if (getObjectMetadataHttpCode != SC_OK) { AmazonS3Exception exception = new AmazonS3Exception("Failing getObjectMetadata call with " + getObjectMetadataHttpCode); exception.setStatusCode(getObjectMetadataHttpCode); throw exception; } return null; }
@Override public ObjectMetadata getObjectMetadata(GetObjectMetadataRequest getObjectMetadataRequest) { this.getObjectMetadataRequest = getObjectMetadataRequest; if (getObjectMetadataHttpCode != HTTP_OK) { AmazonS3Exception exception = new AmazonS3Exception("Failing getObjectMetadata call with " + getObjectMetadataHttpCode); exception.setStatusCode(getObjectMetadataHttpCode); throw exception; } return null; }
@Override public S3Object getObject(GetObjectRequest getObjectRequest) { if (getObjectHttpCode != SC_OK) { AmazonS3Exception exception = new AmazonS3Exception("Failing getObject call with " + getObjectHttpCode); exception.setStatusCode(getObjectHttpCode); throw exception; } return null; }
@Override public ObjectMetadata getObjectMetadata(GetObjectMetadataRequest getObjectMetadataRequest) { this.getObjectMetadataRequest = getObjectMetadataRequest; if (getObjectMetadataHttpCode != HTTP_OK) { AmazonS3Exception exception = new AmazonS3Exception("Failing getObjectMetadata call with " + getObjectMetadataHttpCode); exception.setStatusCode(getObjectMetadataHttpCode); throw exception; } return null; }
final String hostId = copyObjectResultHandler.getErrorHostId(); final AmazonS3Exception ase = new AmazonS3Exception(errorMessage); ase.setErrorCode(errorCode); ase.setErrorType(ErrorType.Service);
final String hostId = copyObjectResultHandler.getErrorHostId(); final AmazonS3Exception ase = new AmazonS3Exception(errorMessage); ase.setErrorCode(errorCode); ase.setErrorType(ErrorType.Service);