Package org.jclouds.rest

Examples of org.jclouds.rest.ResourceNotFoundException


               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 402:
               exception = new IllegalStateException(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


      verify(exception);
   }

   public void testFalseIfResourceNotFound() throws Exception {
      FalseIfNotAvailable function = new FalseIfNotAvailable();
      ResourceNotFoundException exception = new ResourceNotFoundException();

      assertFalse(function.createOrPropagate(exception));
   }
View Full Code Here

      }
   }

   public void testOriginalExceptionIfNotAbiquoException() {
      PropagateAbiquoExceptionOnNotFoundOr4xx function = new PropagateAbiquoExceptionOnNotFoundOr4xx();
      ResourceNotFoundException exception = new ResourceNotFoundException();

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

   }

   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

            case 403:
               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

      // Create custom exception for error messages we know about
      if (SYSTEM_RECONFIGURING_PATTERN.matcher(error).matches()) {
         refinedException = new IllegalStateException(exception);
      } else if (RESOURCE_NOT_FOUND_PATTERN.matcher(error).matches()) {
         refinedException = new ResourceNotFoundException(error, exception);
      } else if (ILLEGAL_STATE_PATTERN.matcher(error).matches()) {
         refinedException = new IllegalStateException(error, exception);
      } else if (ILLEGAL_ARGUMENT_PATTERN.matcher(error).matches()) {
         refinedException = new IllegalArgumentException(error, exception);
      } else if (AUTH_PATTERN.matcher(error).matches()) {
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 401:
            exception = new AuthorizationException(message, exception);
            break;
         case 404:
            if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
               exception = new ResourceNotFoundException(message, exception);
            }
            break;
         default:
            exception = new HttpResponseException(command, response, message);
            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;
            case 500:
               if (message != null ){
                  if (message.indexOf("Unable to determine package for") != -1) {
                     exception = new ResourceNotFoundException(message, exception);
                  } else if (message.indexOf("currently an active transaction") != -1) {
                     exception = new IllegalStateException(message, exception);
                  } else if (message.indexOf("SoftLayer_Exception_Order_Item_Duplicate") != -1) {
                     exception = new SoftLayerOrderItemDuplicateException(command, response, message);
                  }
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.