Created
July 29, 2015 23:29
-
-
Save jentfoo/4042262f55362bebb276 to your computer and use it in GitHub Desktop.
aws-sdk-java PR #459 alternative
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/aws-java-sdk-sqs/src/main/java/com/amazonaws/services/sqs/MessageMD5ChecksumHandler.java b/aws-java-sdk-sqs/src/main/java/com/amazonaws/services/sqs/MessageMD5ChecksumHandler.java | |
index 3d02445..8d84a39 100644 | |
--- a/aws-java-sdk-sqs/src/main/java/com/amazonaws/services/sqs/MessageMD5ChecksumHandler.java | |
+++ b/aws-java-sdk-sqs/src/main/java/com/amazonaws/services/sqs/MessageMD5ChecksumHandler.java | |
@@ -278,12 +278,10 @@ public class MessageMD5ChecksumHandler extends AbstractRequestHandler { | |
* input ByteBuffer and all the bytes it contains. | |
*/ | |
private static void updateLengthAndBytes(MessageDigest digest, ByteBuffer binaryValue) { | |
- // Rewind the ByteBuffer, in case that get/put operations were applied to | |
- // the unmarshalled BB before it's passed to this handler. | |
- binaryValue.rewind(); | |
- int size = binaryValue.remaining(); | |
+ ByteBuffer readOnlyBuffer = binaryValue.asReadOnlyBuffer(); | |
+ int size = readOnlyBuffer.remaining(); | |
ByteBuffer lengthBytes = ByteBuffer.allocate(INTEGER_SIZE_IN_BYTES).putInt(size); | |
digest.update(lengthBytes.array()); | |
- digest.update(binaryValue); | |
+ digest.update(readOnlyBuffer); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment