Package com.amazonaws

Examples of com.amazonaws.AmazonClientException


                    SSLSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
            Scheme https = new Scheme("https", 443, sf);

            schemeRegistry.register(https);
        } catch (NoSuchAlgorithmException e) {
            throw new AmazonClientException("Unable to access default SSL context to disable strict hostname verification");
        }
    }
View Full Code Here


    public <T> T execute(Request<?> request,
            HttpResponseHandler<AmazonWebServiceResponse<T>> responseHandler,
            HttpResponseHandler<AmazonServiceException> errorResponseHandler,
            ExecutionContext executionContext) throws AmazonClientException, AmazonServiceException {

        if (executionContext == null) throw new AmazonClientException("Internal SDK Error: No execution context parameter specified.");
        List<RequestHandler> requestHandlers = executionContext.getRequestHandlers();
        if (requestHandlers == null) requestHandlers = new ArrayList<RequestHandler>();

        // Apply any additional service specific request handlers that need to be run
        for ( RequestHandler requestHandler : requestHandlers ) {
View Full Code Here

                log.info("Unable to execute HTTP request: " + ioe.getMessage(), ioe);
                awsRequestMetrics.addProperty(Field.Exception.name(), ioe.toString());
                awsRequestMetrics.addProperty(Field.AWSRequestID.name(), null);

                if (!shouldRetry(httpRequest, ioe, retryCount)) {
                    throw new AmazonClientException("Unable to execute HTTP request: " + ioe.getMessage(), ioe);
                }
                resetRequestAfterError(request, ioe);
            } finally {
                retryCount++;
View Full Code Here

    private void resetRequestAfterError(Request<?> request, Exception cause) throws AmazonClientException {
        if ( request.getContent() == null ) {
            return; // no reset needed
        }
        if ( ! request.getContent().markSupported() ) {
            throw new AmazonClientException("Encountered an exception and stream is not resettable", cause);
        }
        try {
            request.getContent().reset();
        } catch ( IOException e ) {
            // This exception comes from being unable to reset the input stream,
            // so throw the original, more meaningful exception
            throw new AmazonClientException(
                    "Encountered an exception and couldn't reset the stream to retry", cause);
        }
    }
View Full Code Here

            return awsResponse.getResult();
        } catch (CRC32MismatchException e) {
            throw e;
        } catch (Exception e) {
            String errorMessage = "Unable to unmarshall response (" + e.getMessage() + ")";
            throw new AmazonClientException(errorMessage, e);
        }
    }
View Full Code Here

                exception.setStatusCode(503);
                exception.setErrorType(ErrorType.Service);
                exception.setErrorCode("Service unavailable");
            } else {
                String errorMessage = "Unable to unmarshall error response (" + e.getMessage() + ")";
                throw new AmazonClientException(errorMessage, e);
            }
        }

        exception.setStatusCode(status);
        exception.setServiceName(request.getServiceName());
View Full Code Here

        try {
            Thread.sleep(delay);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new AmazonClientException(e.getMessage(), e);
        }
    }
View Full Code Here

                if (containsThrottlingException(failedBatches)) {
                    try {
                        Thread.sleep(1000 * 2);
                    } catch (InterruptedException e) {
                        Thread.currentThread().interrupt();
                        throw new AmazonClientException(e.getMessage(), e);
                    }
                }
            }
        }

View Full Code Here

         */
        if (rangeKeyConditions.size() > 1) {
          // The current DynamoDB service only supports queries using hash key equal condition
          // plus ONE range key condition.
          // This range key could be either the primary key or any index key.
          throw new AmazonClientException("Conditions on multiple range keys ("
              + rangeKeyConditions.keySet().toString()
              + ") are found in the query. DynamoDB service only accepts up to ONE range key condition.");
        }
        String assignedIndexName = queryRequest.getIndexName();
        for (String rangeKey : rangeKeyConditions.keySet()) {
          /**
           * If it is a primary range key, checks whether the user has specified
           * an unnecessary index name.
           */
          if (rangeKey.equals(reflector.getPrimaryRangeKeyName(clazz))) {
            if ( null != assignedIndexName )
              throw new AmazonClientException("The range key ("
                  + rangeKey + ") in the query is the primary key of the table, not the range key of index ("
                  + assignedIndexName + ").");
          }
          else {
                List<String> annotatedIndexNames = reflector.getIndexNameByIndexRangeKeyName(clazz, rangeKey);
              /**
               * If it is an index range key,
               *     check whether the provided index name matches the @DynamoDBIndexRangeKey annotation,
               *     or try to infer the index name according to @DynamoDBIndexRangeKey annotation
               *       if it is not provided in the query.
               */
                if ( null != annotatedIndexNames) {
                if (null == assignedIndexName) {
                  // infer the index name if the range key is used only in one index
                  if ( 1 == annotatedIndexNames.size()) {
                    queryRequest.setIndexName(annotatedIndexNames.get(0));
                  } else {
                    throw new AmazonClientException("Please specify which index to be used for this query. "
                        + "(Choose from " + annotatedIndexNames.toString() + ").");
                  }
                } else {
                  // check whether the provided index name in the query matches the @DyanmoDBIndexRangeKey annotation
                  if ( !annotatedIndexNames.contains(assignedIndexName)) {
                    throw new AmazonClientException(assignedIndexName
                        + " is not annotated as an index in the @DynamoDBIndexRangeKey annotation on "
                        + rangeKey + "(Choose from " + annotatedIndexNames.toString() + ").");
                  }
                }
                }
                else {
                throw new AmazonClientException("The range key used in the query (" + rangeKey + ") is not annotated with " +
                    "either @DynamoDBRangeKey or @DynamoDBIndexRangeKey in class (" + clazz.getName() + ").");
              }
          }
        }
    }
View Full Code Here

        try {
            Thread.sleep(delay);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new AmazonClientException(e.getMessage(), e);
        }
    }
View Full Code Here

TOP

Related Classes of com.amazonaws.AmazonClientException

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.