Package org.jclouds.rest

Examples of org.jclouds.rest.ResourceNotFoundException


   }

   public void testAbiquoException() {
      PropagateAbiquoExceptionOnNotFoundOr4xx function = new PropagateAbiquoExceptionOnNotFoundOr4xx();
      AbiquoException abiquoException = new AbiquoException(Status.NOT_FOUND, new ErrorsDto());
      ResourceNotFoundException exception = new ResourceNotFoundException(abiquoException);

      try {
         function.create(exception);
      } catch (Exception ex) {
         assertEquals(ex, abiquoException);
View Full Code Here


               // generic exception
               exception = new AuthorizationException(defaultMessage, new HttpResponseException(command, response,
                     defaultMessage));
               break;
            case 404:
               exception = new ResourceNotFoundException(defaultMessage, getExceptionToPropagate(command, response,
                     defaultMessage));
               break;
            case 301:
               // Moved resources in Abiquo should be handled with the
               // ReturnMovedResource
View Full Code Here

         case FORBIDDEN:
            exception = new AuthorizationException(message, exception);
            break;
         case NOT_FOUND:
            if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
               exception = new ResourceNotFoundException(message, exception);
            }
            break;
         case CONFLICT:
            exception = new IllegalStateException(message, exception);
            break;
View Full Code Here

         case 403:
            exception = new AuthorizationException(message, exception);
            break;
         case 404:
            if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
               exception = new ResourceNotFoundException(message, exception);
            }
            break;
         case 409:
            exception = new IllegalStateException(message, exception);
            break;
View Full Code Here

            case 403:
               exception = new AuthorizationException(message, exception);
               break;
            case 404:
               if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
                  exception = new ResourceNotFoundException(message, exception);
               }
               break;
         }
      } finally {
         if (response.getPayload() != null) {
View Full Code Here

         case 401:
            exception = new AuthorizationException(message, exception);
            break;
         case 404:
            if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
               exception = new ResourceNotFoundException(message, exception);
            }
            break;
         case 405:
            exception = new IllegalArgumentException(message, exception);
            break;
         case 409:
         case 431:
            if (message.contains("does not exist")) {
               exception = new ResourceNotFoundException(message, exception);
            } else {
               exception = new IllegalStateException(message, exception);
            }
            break;
         case 534:
View Full Code Here

               response.getStatusLine());
         switch (response.getStatusCode()) {
         case 400:
            if ((command.getCurrentRequest().getEndpoint().getPath().endsWith("/info"))
                  || (message != null && message.indexOf("could not be found") != -1))
               exception = new ResourceNotFoundException(message, exception);
            else if (message != null && message.indexOf("currently in use") != -1)
               exception = new IllegalStateException(message, exception);
            else
               exception = new IllegalArgumentException(message, exception);
            break;
         case 401:
            exception = new AuthorizationException(message, exception);
            break;
         case 404:
            if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
               exception = new ResourceNotFoundException(message, exception);
            }
            break;
         case 405:
            exception = new IllegalArgumentException(message, exception);
            break;
View Full Code Here

               response.getStatusLine());
         switch (response.getStatusCode()) {
         case 400:
            if ((command.getCurrentRequest().getEndpoint().getPath().endsWith("/info"))
                  || (message != null && message.indexOf("could not be found") != -1))
               exception = new ResourceNotFoundException(message, exception);
            else
               exception = new IllegalArgumentException(message, exception);
            break;
         case 401:
            exception = new AuthorizationException(message, exception);
            break;
         case 404:
            if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
               exception = new ResourceNotFoundException(message, exception);
            }
            break;
         case 405:
            exception = new IllegalArgumentException(message, exception);
            break;
View Full Code Here

         case 403:
            exception = new AuthorizationException(message, exception);
            break;
         case 400:
            if (message.indexOf("not find") != -1) {
               exception = new ResourceNotFoundException(message, exception);
            }
            break;
         case 404:
            if (message.indexOf("Not supported") != -1) {
               exception = new UnsupportedOperationException(message, exception);
            } else {
               exception = new ResourceNotFoundException(message, exception);
            }
            break;
         case 500:
            if (message.indexOf("Locked") != -1) {
               exception = new IllegalStateException(message, exception);
View Full Code Here

            else if ("AddressLimitExceeded".equals(errorCode))
               exception = new InsufficientResourcesException(message, exception);
            else if ("TooManyBuckets".equals(errorCode))
               exception = new InsufficientResourcesException(message, exception);
            else if (errorCode != null && (errorCode.indexOf("NotFound") != -1 || errorCode.endsWith(".Unknown")))
               exception = new ResourceNotFoundException(message, exception);
            else if ("IncorrectState".equals(errorCode)
                     || (errorCode != null && (error.getCode().endsWith(".Duplicate") || error.getCode().endsWith(
                              ".InUse")))
                     || (message != null && (message.indexOf("already exists") != -1 || message.indexOf("is in use") != -1)))
               exception = new IllegalStateException(message, exception);
            else if (errorCode != null && errorCode.indexOf("AuthFailure") != -1)
               exception = new AuthorizationException(message, exception);
            else if (message != null
                     && (message.indexOf("Invalid id") != -1 || message.indexOf("Failed to bind") != -1))
               exception = new IllegalArgumentException(message, exception);
            break;
         case 401:
         case 403:
            exception = new AuthorizationException(message, exception);
            break;
         case 404:
            if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
               exception = new ResourceNotFoundException(message, exception);
            }
            break;
         case 409:
            if ("BucketAlreadyExists".equals(errorCode)) {
               exception = new ResourceAlreadyExistsException(exception);
View Full Code Here

TOP

Related Classes of org.jclouds.rest.ResourceNotFoundException

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.