|
|
@@ -122,30 +122,11 @@ class DefaultS3OutputStream extends S3OutputStream {
|
|
|
}
|
|
|
md.setContentLength(length);
|
|
|
|
|
|
- // We try to compute a MD5 while reading it
|
|
|
- MessageDigest messageDigest;
|
|
|
- InputStream inputStream;
|
|
|
- try {
|
|
|
- messageDigest = MessageDigest.getInstance("MD5");
|
|
|
- inputStream = new DigestInputStream(is, messageDigest);
|
|
|
- } catch (NoSuchAlgorithmException impossible) {
|
|
|
- // Every implementation of the Java platform is required to support MD5 (see MessageDigest)
|
|
|
- throw new RuntimeException(impossible);
|
|
|
- }
|
|
|
-
|
|
|
- PutObjectRequest putRequest = new PutObjectRequest(bucketName, blobName, inputStream, md)
|
|
|
+ PutObjectRequest putRequest = new PutObjectRequest(bucketName, blobName, is, md)
|
|
|
.withStorageClass(blobStore.getStorageClass())
|
|
|
.withCannedAcl(blobStore.getCannedACL());
|
|
|
- PutObjectResult putObjectResult = blobStore.client().putObject(putRequest);
|
|
|
-
|
|
|
- String localMd5 = Base64.encodeAsString(messageDigest.digest());
|
|
|
- String remoteMd5 = putObjectResult.getContentMd5();
|
|
|
- if (!localMd5.equals(remoteMd5)) {
|
|
|
- logger.debug("MD5 local [{}], remote [{}] are not equal...", localMd5, remoteMd5);
|
|
|
- throw new AmazonS3Exception("MD5 local [" + localMd5 +
|
|
|
- "], remote [" + remoteMd5 +
|
|
|
- "] are not equal...");
|
|
|
- }
|
|
|
+ blobStore.client().putObject(putRequest);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void initializeMultipart() {
|