List of usage examples for com.amazonaws.services.s3.model AmazonS3Exception getErrorResponseXml
public String getErrorResponseXml()
From source file:com.greglturnquist.springagram.fileservice.s3.FileService.java
License:Apache License
/** * Parse the {@link AmazonS3Exception} error result to capture the endpoint for * redirection.// ww w.j a va 2 s . c o m * * @param e */ private void updateEndpoint(AmazonS3Exception e) { try { Document errorResponseDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder() .parse(new StringInputStream(e.getErrorResponseXml())); XPathExpression endpointXpathExtr = XPathFactory.newInstance().newXPath().compile("/Error/Endpoint"); this.s3Client.setEndpoint(endpointXpathExtr.evaluate(errorResponseDoc)); } catch (Exception ex) { throw new RuntimeException(e); } }
From source file:ubicrypt.core.provider.s3.S3Provider.java
License:Open Source License
private void error(String pid, Subscriber subscriber, AmazonS3Exception e) { S3Error error = S3Error.from(e.getErrorResponseXml()); switch (error.getCode()) { case "NoSuchKey": subscriber.onError(new NotFoundException(pid)); break;/*from w w w.j a v a 2s. com*/ default: subscriber.onError(e); } }