我正在尝试从Android Studio中的应用程序请求AWS DynamoDB中的一些条目。我为scanResult得到CRC32不匹配。有谁知道为什么会这样。在下面附加片段和堆栈跟踪。
credentials = new CognitoCachingCredentialsProvider(
MapValidate.getContext(), // Context
“FILLED_MY_ID_HERE", // Identity Pool ID
Regions.US_EAST_1 // Region
);
AmazonDynamoDBClient dynamoDB = new AmazonDynamoDBClient(credentials);
Region usEast1 = Region.getRegion(Regions.US_EAST_1);
dynamoDB.setRegion(usEast1);
HashMap<String,Condition> scanFilter = new HashMap<String,Condition>();
Condition condition1lat = new Condition()
.withComparisonOperator(ComparisonOperator.EQ.toString())
.withAttributeValueList(new AttributeValue().withS(user_lat));
scanFilter.put("DegLat", condition1lat);
ScanRequest scanRequest = new ScanRequest()
.withTableName("MY_TABLE_NAME")
.withAttributesToGet("DegLat","DegLong","Latitude")
.withScanFilter(scanFilter);
ScanResult result = dynamoDB.scan(scanRequest);
我收到以下异常,如下所示:
04-28 19:34:03.729 4744-4793/com.google.sample I/AmazonHttpClient﹕
Unable to execute HTTP request:
Client calculated crc32 checksum didn't match that calculated by server side
答案 0 :(得分:1)
CRC校验和错误可能是由请求标头中的请求压缩引起的。 如果您还没有这样做,请使用ClientConfiguration尝试以下操作:
a[contains(@onclick,'servletLinkJunkHere...')]/preceding-sibling::IMG/@SRC
答案 1 :(得分:1)
更新:我刚刚解决了这个问题。这是sdk-2.2.0的问题。几天前升级到最新版本的2.2.1解决了这个问题。
答案 2 :(得分:0)
Android SDK实际上不支持ClientConfiguration.DEFAULT_USE_GIP ...如果您查看HttpRequestFactory类https://github.com/aws/aws-sdk-android/blob/4de3a3146d66d9ab5684eb5e71d5a2cef9f4dec9/aws-android-sdk-core/src/main/java/com/amazonaws/http/HttpRequestFactory.java,它会尝试考虑这一点如果您没有明确设置Accept-Encoding,那么sdk默认会关闭压缩。但是,如果你明确地设置它,你可能会遇到压缩问题。
如果这不能解决您的问题,请告诉我。
谢谢, 韦斯顿