From 716f63e3a9af6291bb441559b4325bc85f71afae Mon Sep 17 00:00:00 2001 From: kjordan2001 Date: Thu, 16 Jul 2015 20:07:20 -0500 Subject: [PATCH] GH-11: Base64 encoding instead of Hex Fixes #11 (https://github.com/spring-projects/spring-integration-aws/issues/11) Polishing --- .../aws/s3/core/AbstractAmazonS3Operations.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/springframework/integration/aws/s3/core/AbstractAmazonS3Operations.java b/src/main/java/org/springframework/integration/aws/s3/core/AbstractAmazonS3Operations.java index 225dece..76404a3 100644 --- a/src/main/java/org/springframework/integration/aws/s3/core/AbstractAmazonS3Operations.java +++ b/src/main/java/org/springframework/integration/aws/s3/core/AbstractAmazonS3Operations.java @@ -22,7 +22,6 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -35,6 +34,8 @@ import org.springframework.integration.aws.core.AWSCommonUtils; import org.springframework.integration.aws.core.AWSCredentials; import org.springframework.util.Assert; +import com.amazonaws.util.BinaryUtils; + /** * The common super class for any implementation of {@link AmazonS3Operations}. The sub class * has to implement all the functionality for performing the actual work to add, remove, update @@ -306,14 +307,7 @@ public abstract class AbstractAmazonS3Operations implements AmazonS3Operations, //later in inbound-channel-adapter where we cant find the MD5 sum of the //multipart upload file from its ETag - String stringContentMD5 = null; - try { - stringContentMD5 = - AWSCommonUtils.encodeHex(AWSCommonUtils.getContentsMD5AsBytes(file)); - } - catch (UnsupportedEncodingException e) { - logger.error("Exception while generating the content's MD5 of the file " + file.getAbsolutePath(), e); - } + String stringContentMD5 = BinaryUtils.toBase64(AWSCommonUtils.getContentsMD5AsBytes(file)); try { doPut(bucketName, key, file, s3Object.getObjectACL(),