Examples of AzureStorageError


Examples of org.jclouds.azure.storage.domain.AzureStorageError

         return false;
      } else if (response.getStatusCode() == 409) {
         // Content can be null in the case of HEAD requests
         if (content != null) {
            try {
               AzureStorageError error = utils.parseAzureStorageErrorFromContent(command, response,
                        new ByteArrayInputStream(content));
               if ("ContainerBeingDeleted".equals(error.getCode())) {
                  backoffHandler.imposeBackoffExponentialDelay(100L, 3, retryCountLimit, command
                           .getFailureCount(), command.toString());
                  return true;
               }
            } catch (HttpException e) {
View Full Code Here

Examples of org.jclouds.azure.storage.domain.AzureStorageError

   public static final Pattern CONTAINER_KEY_PATH = Pattern.compile("^[/]?([^/]+)/(.*)$");

   public void handleError(HttpCommand command, HttpResponse response) {
      Exception exception = new HttpResponseException(command, response);
      String message = null;
      AzureStorageError error = null;
      try {
         if (response.getPayload() != null) {
            String contentType = response.getPayload().getContentMetadata().getContentType();
            if (contentType != null && (contentType.indexOf("xml") != -1 || contentType.indexOf("unknown") != -1)
                     && !Long.valueOf(0).equals(response.getPayload().getContentMetadata().getContentLength())) {
               try {
                  error = utils.parseAzureStorageErrorFromContent(command, response, response.getPayload().getInput());
                  if (error != null) {
                     message = error.getMessage();
                     exception = new AzureStorageResponseException(command, response, error);
                  }
               } catch (RuntimeException e) {
                  try {
                     message = Strings2.toString(response.getPayload());
View Full Code Here

Examples of org.jclouds.azure.storage.domain.AzureStorageError

   @Inject
   Provider<ErrorHandler> errorHandlerProvider;

   public AzureStorageError parseAzureStorageErrorFromContent(HttpCommand command,
            HttpResponse response, InputStream content) throws HttpException {
      AzureStorageError error = factory.create(errorHandlerProvider.get()).parse(content);
      error.setRequestId(response.getFirstHeaderOrNull(AzureStorageHeaders.REQUEST_ID));
      if ("AuthenticationFailed".equals(error.getCode())) {
         error.setStringSigned(signer.createStringToSign(command.getCurrentRequest()));
         error.setSignature(signer.signString(error.getStringSigned()));
      }
      return error;
   }
View Full Code Here

Examples of org.jclouds.azure.storage.domain.AzureStorageError

   }

   public void testApplyInputStream() {
      InputStream is = getClass().getResourceAsStream("/test_error.xml");
      ParseSax<AzureStorageError> parser = createParser();
      AzureStorageError result = parser.parse(is);
      assertEquals(result.getCode(), "AuthenticationFailed");
   }
View Full Code Here

Examples of org.jclouds.azure.storage.domain.AzureStorageError

         return false;
      } else if (response.getStatusCode() == 409) {
         // Content can be null in the case of HEAD requests
         if (content != null) {
            try {
               AzureStorageError error = utils.parseAzureStorageErrorFromContent(command, response,
                        new ByteArrayInputStream(content));
               if ("ContainerBeingDeleted".equals(error.getCode())) {
                  backoffHandler.imposeBackoffExponentialDelay(100L, 3, retryCountLimit, command
                           .getFailureCount(), command.toString());
                  return true;
               }
            } catch (HttpException e) {
View Full Code Here

Examples of org.jclouds.azure.storage.domain.AzureStorageError

   public static final Pattern CONTAINER_KEY_PATH = Pattern.compile("^[/]?([^/]+)/(.*)$");

   public void handleError(HttpCommand command, HttpResponse response) {
      Exception exception = new HttpResponseException(command, response);
      String message = null;
      AzureStorageError error = null;
      try {
         if (response.getPayload() != null) {
            String contentType = response.getPayload().getContentMetadata().getContentType();
            if (contentType != null && (contentType.indexOf("xml") != -1 || contentType.indexOf("unknown") != -1)
                     && !Long.valueOf(0).equals(response.getPayload().getContentMetadata().getContentLength())) {
               try {
                  error = utils.parseAzureStorageErrorFromContent(command, response, response.getPayload().getInput());
                  if (error != null) {
                     message = error.getMessage();
                     exception = new AzureStorageResponseException(command, response, error);
                  }
               } catch (RuntimeException e) {
                  try {
                     message = Strings2.toString(response.getPayload());
View Full Code Here

Examples of org.jclouds.azure.storage.domain.AzureStorageError

   @Inject
   Provider<ErrorHandler> errorHandlerProvider;

   public AzureStorageError parseAzureStorageErrorFromContent(HttpCommand command,
            HttpResponse response, InputStream content) throws HttpException {
      AzureStorageError error = factory.create(errorHandlerProvider.get()).parse(content);
      error.setRequestId(response.getFirstHeaderOrNull(AzureStorageHeaders.REQUEST_ID));
      if ("AuthenticationFailed".equals(error.getCode())) {
         error.setStringSigned(signer.createStringToSign(command.getCurrentRequest()));
         error.setSignature(signer.signString(error.getStringSigned()));
      }
      return error;
   }
View Full Code Here

Examples of org.jclouds.azure.storage.domain.AzureStorageError

   }

   public void testApplyInputStream() {
      InputStream is = getClass().getResourceAsStream("/test_error.xml");
      ParseSax<AzureStorageError> parser = createParser();
      AzureStorageError result = parser.parse(is);
      assertEquals(result.getCode(), "AuthenticationFailed");
   }
View Full Code Here

Examples of org.jclouds.azure.storage.domain.AzureStorageError

   }

   public void testApplyInputStream() {
      InputStream is = getClass().getResourceAsStream("/test_error.xml");
      ParseSax<AzureStorageError> parser = createParser();
      AzureStorageError result = parser.parse(is);
      assertEquals(result.getCode(), "AuthenticationFailed");
   }
View Full Code Here

Examples of org.jclouds.azure.storage.domain.AzureStorageError

   @Inject
   Provider<ErrorHandler> errorHandlerProvider;

   public AzureStorageError parseAzureStorageErrorFromContent(HttpCommand command,
            HttpResponse response, InputStream content) throws HttpException {
      AzureStorageError error = factory.create(errorHandlerProvider.get()).parse(content);
      error.setRequestId(response.getFirstHeaderOrNull(AzureStorageHeaders.REQUEST_ID));
      if ("AuthenticationFailed".equals(error.getCode())) {
         error.setStringSigned(signer.createStringToSign(command.getCurrentRequest()));
         error.setSignature(signer.signString(error.getStringSigned()));
      }
      return error;
   }
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.