Examples of AWSError


Examples of org.jclouds.aws.domain.AWSError

   public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) {
      if (response.getStatusCode() == 503) {
         // Content can be null in the case of HEAD requests
         if (response.getPayload() != null) {
            closeClientButKeepContentStream(response);
            AWSError error = utils.parseAWSErrorFromContent(command.getCurrentRequest(), response);
            if (error != null) {
               return shouldRetryRequestOnError(command, response, error);
            }
         }
      }
View Full Code Here

Examples of org.jclouds.aws.domain.AWSError

         public Integer answer() throws Throwable {
            return counter.get();
         }
      }).anyTimes();

      AWSError error = new AWSError();
      error.setCode(code);

      expect(utils.parseAWSErrorFromContent(putBucket, limitExceeded)).andReturn(error);

      replay(utils, command);
View Full Code Here

Examples of org.jclouds.aws.domain.AWSError

         public Integer answer() throws Throwable {
            return counter.get();
         }
      }).anyTimes();

      AWSError error = new AWSError();
      error.setCode(code);

      expect(utils.parseAWSErrorFromContent(putBucket, limitExceeded)).andReturn(error);

      replay(utils, command);
View Full Code Here

Examples of org.jclouds.aws.domain.AWSError

   }

   public void handleError(HttpCommand command, HttpResponse response) {
      Exception exception = new HttpResponseException(command, response);
      try {
         AWSError error = null;
         // it is important to always read fully and close streams
         byte[] data = closeClientButKeepContentStream(response);
         String message = data != null ? new String(data) : null;
         if (response.getPayload() != null) {
            String contentType = response.getPayload().getContentMetadata().getContentType();
            if (contentType != null && (contentType.indexOf("xml") != -1 || contentType.indexOf("unknown") != -1)) {
               error = utils.parseAWSErrorFromContent(command.getCurrentRequest(), response);
               if (error != null) {
                  message = error.getMessage();
                  exception = new AWSResponseException(command, response, error);
               } else {
                  exception = new HttpResponseException(command, response, message);
               }
            } else {
View Full Code Here

Examples of org.jclouds.aws.domain.AWSError

      switch (response.getStatusCode()) {
      case 503// Service Unavailable
         // Content can be null in the case of HEAD requests
         if (response.getPayload() != null) {
            closeClientButKeepContentStream(response);
            AWSError error = utils.parseAWSErrorFromContent(command.getCurrentRequest(), response);
            if (error != null) {
               return shouldRetryRequestOnError(command, response, error);
            }
         }
         break;
View Full Code Here

Examples of org.jclouds.aws.domain.AWSError

   AWSError error;
   HttpResponse response = HttpResponse.builder().statusCode(400)
         .payload(String.format("<Error><Code>%s</Code></Error>", code)).build();

   public SQSErrorRetryHandlerTest() {
      error = new AWSError();
      error.setCode(code);
   }
View Full Code Here

Examples of org.jclouds.aws.domain.AWSError

   public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) {
      if (response.getStatusCode() == 503) {
         // Content can be null in the case of HEAD requests
         if (response.getPayload() != null) {
            closeClientButKeepContentStream(response);
            AWSError error = utils.parseAWSErrorFromContent(command.getCurrentRequest(), response);
            if (error != null) {
               return shouldRetryRequestOnError(command, response, error);
            }
         }
      }
View Full Code Here

Examples of org.jclouds.aws.domain.AWSError

   public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) {
      if (response.getStatusCode() == 400 || response.getStatusCode() == 403 || response.getStatusCode() == 409) {
         // Content can be null in the case of HEAD requests
         if (response.getPayload() != null) {
            closeClientButKeepContentStream(response);
            AWSError error = utils.parseAWSErrorFromContent(command.getCurrentRequest(), response);
            if (error != null) {
               return shouldRetryRequestOnError(command, response, error);
            }
         }
      }
View Full Code Here

Examples of org.jclouds.aws.domain.AWSError

   @Override
   public void handleError(HttpCommand command, HttpResponse response) {
      Exception exception = new HttpResponseException(command, response);
      try {
         if (response.getPayload() != null) {
            AWSError error = factory.create(handlers.get())
                                    .parse(new String(closeClientButKeepContentStream(response)));
            exception = refineException(new AWSResponseException(command, response, error));
         }
      } finally {
         releasePayload(response);
View Full Code Here

Examples of org.jclouds.aws.domain.AWSError

      if (response.getPayload() == null)
         return null;
      if ("text/plain".equals(response.getPayload().getContentMetadata().getContentType()))
         return null;
      try {
         AWSError error = factory.create(errorHandlerProvider.get()).setContext(request).apply(response);
         if (error.getRequestId() == null)
            error.setRequestId(response.getFirstHeaderOrNull(requestId));
         error.setRequestToken(response.getFirstHeaderOrNull(requestToken));
         if ("SignatureDoesNotMatch".equals(error.getCode())) {
            error.setStringSigned(signer.createStringToSign(request));
            error.setSignature(signer.sign(error.getStringSigned()));
         }
         return error;
      } catch (RuntimeException e) {
         logger.warn(e, "error parsing error");
         return null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.