public AtmosError parseAtmosErrorFromContent(HttpCommand command, HttpResponse response, InputStream content) throws HttpException { AtmosError error = factory.create(errorHandlerProvider.get()).parse(content); if (error.getCode() == 1032) { error.setStringSigned(signer.createStringToSign(command.getCurrentRequest())); } return error; }
public AtmosError getResult() { return new AtmosError(code, message); }
public AtmosResponseException(HttpCommand command, HttpResponse response, AtmosError error) { super(String.format("command %s failed with code %s, error: %s", command.getCurrentRequest() .getRequestLine(), response.getStatusCode(), error.toString()), command, response); this.setError(error); }
if (error != null && error.getCode() == 1016) { File file = new File(command.getCurrentRequest().getEndpoint().getPath()); exception = new KeyAlreadyExistsException(file.getParentFile().getAbsolutePath(), file.getName()); case 404: if (!command.getCurrentRequest().getMethod().equals("DELETE")) { String message = error != null ? error.getMessage() : String.format("%s -> %s", command.getCurrentRequest() .getRequestLine(), response.getStatusLine()); String path = command.getCurrentRequest().getEndpoint().getPath();
@Override public Boolean createOrPropagate(Throwable t) throws Exception { if (HttpUtils.contains404(t)) { return true; } AtmosResponseException exception = getFirstThrowableOfType(t, AtmosResponseException.class); if (exception != null && exception.getError().getCode() == AtmosErrorCode.DIRECTORY_NOT_EMPTY.getCode()) { return false; } throw propagate(t); } }
if (error != null && error.getCode() == 1016) { File file = new File(command.getCurrentRequest().getEndpoint().getPath()); exception = new KeyAlreadyExistsException(file.getParentFile().getAbsolutePath(), file.getName()); case 404: if (!command.getCurrentRequest().getMethod().equals("DELETE")) { String message = error != null ? error.getMessage() : String.format("%s -> %s", command.getCurrentRequest() .getRequestLine(), response.getStatusLine()); String path = command.getCurrentRequest().getEndpoint().getPath();
@Override public Boolean createOrPropagate(Throwable t) throws Exception { if (HttpUtils.contains404(t)) { return true; } AtmosResponseException exception = getFirstThrowableOfType(t, AtmosResponseException.class); if (exception != null && exception.getError().getCode() == AtmosErrorCode.DIRECTORY_NOT_EMPTY.getCode()) { return false; } throw propagate(t); } }
public AtmosError parseAtmosErrorFromContent(HttpCommand command, HttpResponse response, InputStream content) throws HttpException { AtmosError error = factory.create(errorHandlerProvider.get()).parse(content); if (error.getCode() == 1032) { error.setStringSigned(signer.createStringToSign(command.getCurrentRequest())); } return error; }
if (error != null && error.getCode() == 1016) { File file = new File(command.getCurrentRequest().getEndpoint().getPath()); exception = new KeyAlreadyExistsException(file.getParentFile().getAbsolutePath(), file.getName()); case 404: if (!command.getCurrentRequest().getMethod().equals("DELETE")) { String message = error != null ? error.getMessage() : String.format("%s -> %s", command.getCurrentRequest() .getRequestLine(), response.getStatusLine()); String path = command.getCurrentRequest().getEndpoint().getPath();
@Override public Boolean createOrPropagate(Throwable t) throws Exception { if (HttpUtils.contains404(t)) { return true; } AtmosResponseException exception = getFirstThrowableOfType(t, AtmosResponseException.class); if (exception != null && exception.getError().getCode() == AtmosErrorCode.DIRECTORY_NOT_EMPTY.getCode()) { return false; } throw propagate(t); } }
public AtmosResponseException(HttpCommand command, HttpResponse response, AtmosError error) { super(String.format("command %s failed with code %s, error: %s", command.getCurrentRequest() .getRequestLine(), response.getStatusCode(), error.toString()), command, response); this.setError(error); }
public AtmosError getResult() { return new AtmosError(code, message); }
public AtmosError parseAtmosErrorFromContent(HttpCommand command, HttpResponse response, InputStream content) throws HttpException { AtmosError error = factory.create(errorHandlerProvider.get()).parse(content); if (error.getCode() == 1032) { error.setStringSigned(signer.createStringToSign(command.getCurrentRequest())); } return error; }
if (error != null && error.getCode() == AtmosErrorCode.RESOURCE_ALREADY_EXISTS.getCode()) { File file = new File(command.getCurrentRequest().getEndpoint().getPath()); exception = new KeyAlreadyExistsException(file.getParentFile().getAbsolutePath(), file.getName()); case 404: if (!command.getCurrentRequest().getMethod().equals("DELETE")) { String message = error != null ? error.getMessage() : String.format("%s -> %s", command.getCurrentRequest() .getRequestLine(), response.getStatusLine()); String path = command.getCurrentRequest().getEndpoint().getPath();
@Override public Boolean createOrPropagate(Throwable t) throws Exception { if (HttpUtils.contains404(t)) { return true; } AtmosResponseException exception = getFirstThrowableOfType(t, AtmosResponseException.class); if (exception != null && exception.getError().getCode() == AtmosErrorCode.DIRECTORY_NOT_EMPTY.getCode()) { return false; } throw propagate(t); } }
public AtmosResponseException(HttpCommand command, HttpResponse response, AtmosError error) { super(String.format("command %s failed with code %s, error: %s", command.getCurrentRequest() .getRequestLine(), response.getStatusCode(), error.toString()), command, response); this.setError(error); }
public AtmosError getResult() { return new AtmosError(code, message); }
public AtmosError parseAtmosErrorFromContent(HttpCommand command, HttpResponse response, InputStream content) throws HttpException { AtmosError error = factory.create(errorHandlerProvider.get()).parse(content); if (error.getCode() == AtmosErrorCode.SIGNATURE_MISMATCH.getCode()) { error.setStringSigned(signer.createStringToSign(command.getCurrentRequest())); } return error; }
if (error != null && error.getCode() == AtmosErrorCode.RESOURCE_ALREADY_EXISTS.getCode()) { File file = new File(command.getCurrentRequest().getEndpoint().getPath()); exception = new KeyAlreadyExistsException(file.getParentFile().getAbsolutePath(), file.getName()); case 404: if (!command.getCurrentRequest().getMethod().equals("DELETE")) { String message = error != null ? error.getMessage() : String.format("%s -> %s", command.getCurrentRequest() .getRequestLine(), response.getStatusLine()); String path = command.getCurrentRequest().getEndpoint().getPath();
public void testApplyInputStream() { InputStream is = getClass().getResourceAsStream("/error.xml"); ParseSax<AtmosError> parser = createParser(); AtmosError result = parser.parse(is); assertEquals(result.getCode(), 1003); } }