@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); } }
@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); } }
@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); } }
@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; }
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 void testApplyInputStream() { InputStream is = getClass().getResourceAsStream("/error.xml"); ParseSax<AtmosError> parser = createParser(); AtmosError result = parser.parse(is); assertEquals(result.getCode(), 1003); } }
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 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; }
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; }
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; }
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; }
public void testApplyInputStream() { InputStream is = getClass().getResourceAsStream("/error.xml"); ParseSax<AtmosError> parser = createParser(); AtmosError result = parser.parse(is); assertEquals(result.getCode(), AtmosErrorCode.OBJECT_NOT_FOUND.getCode()); } }
public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { if (command.getFailureCount() > retryCountLimit) { return false; } if (response.getStatusCode() == 500) { byte[] content = HttpUtils.closeClientButKeepContentStream(response); // Content can be null in the case of HEAD requests if (content != null) { try { AtmosError error = utils.parseAtmosErrorFromContent(command, response, new String(content)); if (error.getCode() == 1040) { // The server is busy. Please try again. return backoffHandler.shouldRetryRequest(command, response); } // don't increment count before here, since backoff handler does already command.incrementFailureCount(); } catch (HttpException e) { logger.warn(e, "error parsing response: %s", new String(content)); } } else { command.incrementFailureCount(); } return false; } return false; }
public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { if (command.getFailureCount() > retryCountLimit) return false; if (response.getStatusCode() == 404 && command.getCurrentRequest().getMethod().equals("DELETE")) { command.incrementFailureCount(); return true; } else if (response.getStatusCode() == 409) { byte[] content = HttpUtils.closeClientButKeepContentStream(response); // Content can be null in the case of HEAD requests if (content != null) { try { AtmosError error = utils.parseAtmosErrorFromContent(command, response, new String(content)); if (error.getCode() == 1006) { return backoffHandler.shouldRetryRequest(command, response); } // don't increment count before here, since backoff handler does already command.incrementFailureCount(); } catch (HttpException e) { logger.warn(e, "error parsing response: %s", new String(content)); } } else { command.incrementFailureCount(); } return true; } return false; }
public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { if (command.getFailureCount() > retryCountLimit) return false; if (response.getStatusCode() == 404 && command.getCurrentRequest().getMethod().equals("DELETE")) { command.incrementFailureCount(); return true; } else if (response.getStatusCode() == 409) { byte[] content = HttpUtils.closeClientButKeepContentStream(response); // Content can be null in the case of HEAD requests if (content != null) { try { AtmosError error = utils.parseAtmosErrorFromContent(command, response, new String(content)); if (error.getCode() == 1006) { return backoffHandler.shouldRetryRequest(command, response); } // don't increment count before here, since backoff handler does already command.incrementFailureCount(); } catch (HttpException e) { logger.warn(e, "error parsing response: %s", new String(content)); } } else { command.incrementFailureCount(); } return true; } return false; }
public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { if (command.getFailureCount() > retryCountLimit) { return false; } if (response.getStatusCode() == 500) { byte[] content = HttpUtils.closeClientButKeepContentStream(response); // Content can be null in the case of HEAD requests if (content != null) { try { AtmosError error = utils.parseAtmosErrorFromContent(command, response, new String(content)); if (error.getCode() == AtmosErrorCode.SERVER_BUSY.getCode()) { return backoffHandler.shouldRetryRequest(command, response); } // don't increment count before here, since backoff handler does already command.incrementFailureCount(); } catch (HttpException e) { logger.warn(e, "error parsing response: %s", new String(content)); } } else { command.incrementFailureCount(); } return false; } return false; }
public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { if (command.getFailureCount() > retryCountLimit) { return false; } if (response.getStatusCode() == 500) { byte[] content = HttpUtils.closeClientButKeepContentStream(response); // Content can be null in the case of HEAD requests if (content != null) { try { AtmosError error = utils.parseAtmosErrorFromContent(command, response, new String(content)); if (error.getCode() == AtmosErrorCode.SERVER_BUSY.getCode()) { return backoffHandler.shouldRetryRequest(command, response); } // don't increment count before here, since backoff handler does already command.incrementFailureCount(); } catch (HttpException e) { logger.warn(e, "error parsing response: %s", new String(content)); } } else { command.incrementFailureCount(); } return false; } return false; }
public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { if (command.getFailureCount() > retryCountLimit) return false; if (response.getStatusCode() == 404 && command.getCurrentRequest().getMethod().equals("DELETE")) { command.incrementFailureCount(); return true; } else if (response.getStatusCode() == 409) { byte[] content = HttpUtils.closeClientButKeepContentStream(response); // Content can be null in the case of HEAD requests if (content != null) { try { AtmosError error = utils.parseAtmosErrorFromContent(command, response, new String(content)); if (error.getCode() == AtmosErrorCode.CONFLICTING_OPERATION.getCode()) { return backoffHandler.shouldRetryRequest(command, response); } // don't increment count before here, since backoff handler does already command.incrementFailureCount(); } catch (HttpException e) { logger.warn(e, "error parsing response: %s", new String(content)); } } else { command.incrementFailureCount(); } return true; } return false; }
public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { if (command.getFailureCount() > retryCountLimit) { return false; } if (response.getStatusCode() == 500) { byte[] content = HttpUtils.closeClientButKeepContentStream(response); // Content can be null in the case of HEAD requests if (content != null) { try { AtmosError error = utils.parseAtmosErrorFromContent(command, response, new String(content)); if (error.getCode() == AtmosErrorCode.SERVER_BUSY.getCode()) { return backoffHandler.shouldRetryRequest(command, response); } // don't increment count before here, since backoff handler does already command.incrementFailureCount(); } catch (HttpException e) { logger.warn(e, "error parsing response: %s", new String(content)); } } else { command.incrementFailureCount(); } return false; } return false; }