Package org.jclouds.aws

Examples of org.jclouds.aws.AWSResponseException


      }

      @Override
      public Object createOrPropagate(Throwable t) throws Exception {
         if (checkNotNull(t, "throwable") instanceof AWSResponseException) {
            AWSResponseException e = AWSResponseException.class.cast(t);
            if ("InvalidDBInstanceState".equals(e.getError().getCode())
                  && e.getError().getMessage().contains("has state: deleting"))
               return null;
         }
         return valOnNotFoundOr404(null, t);
      }
View Full Code Here


            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 {
               try {
View Full Code Here

      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);
         command.setException(exception);
      }
View Full Code Here

      }

      @Override
      public Void createOrPropagate(Throwable t) throws Exception {
         if (checkNotNull(t, "throwable") instanceof AWSResponseException) {
            AWSResponseException e = AWSResponseException.class.cast(t);
            if (Predicates.in(ImmutableSet.of("IncorrectState", "available")).apply(e.getError().getCode()))
               return null;
         }
         throw propagate(t);
      }
View Full Code Here

      function.handleError(command, response);

      assertEquals(command.getException().getClass(), ResourceNotFoundException.class);
      assertEquals(command.getException().getMessage(), "Tried to delete resource record set krank.foo.bar., type TXT but it was not found");

      AWSResponseException exception = AWSResponseException.class.cast(command.getException().getCause());

      assertEquals(exception.getError().getCode(), "InvalidChangeBatch");
   }
View Full Code Here

         String message = data != null ? new String(data) : null;
         if (message != null) {
            exception = new HttpResponseException(command, response, message);
            if (message.indexOf("ErrorResponse") != -1) {
               AWSError error = factory.create(handlers.get()).parse(message);
               exception = refineException(new AWSResponseException(command, response, error));
            } else if (message.indexOf("InvalidChangeBatch") != -1) {
               ImmutableList<String> errors = factory.create(batchHandlers.get()).parse(message);
               exception = new InvalidChangeBatchException(errors, new HttpResponseException(command, response));
            }
         }
View Full Code Here

            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 {
               try {
View Full Code Here

   }

   private Exception getErrorWithCode(String code) {
      AWSError error = new AWSError();
      error.setCode(code);
      return new AWSResponseException(null, null, null, error);
   }
View Full Code Here

      return immediateFuture(createOrPropagate(t));
   }

   @Override
   public Boolean createOrPropagate(Throwable t) throws Exception {
      AWSResponseException exception = getFirstThrowableOfType(checkNotNull(t, "throwable"), AWSResponseException.class);
      if (exception != null && exception.getError() != null && exception.getError().getCode() != null) {
         String code = exception.getError().getCode();
         if (code.equals("BucketAlreadyOwnedByYou"))
            return false;
         else if (code.equals("OperationAborted") && bucket != null && client.bucketExists(bucket))
            return false;
      }
View Full Code Here

      return immediateFuture(createOrPropagate(t));
   }

   @Override
   public Boolean createOrPropagate(Throwable t) throws Exception {
      AWSResponseException exception = getFirstThrowableOfType(checkNotNull(t, "throwable"), AWSResponseException.class);
      if (exception != null && exception.getError() != null && exception.getError().getCode() != null) {
         String code = exception.getError().getCode();
         if (code.equals("BucketAlreadyOwnedByYou"))
            return false;
         else if (code.equals("OperationAborted") && bucket != null && client.bucketExists(bucket))
            return false;
      }
View Full Code Here

TOP

Related Classes of org.jclouds.aws.AWSResponseException

Copyright © 2018 www.massapicom. 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.