added message and null check guarding MPU on payloads with contentLength set

This commit is contained in:
Adrian Cole 2011-06-27 07:11:10 -07:00
parent 0502300840
commit 96a4923c4c
1 changed files with 4 additions and 1 deletions

View File

@ -92,7 +92,10 @@ public class SequentialMultipartUploadStrategy implements MultipartUploadStrateg
String key = blob.getMetadata().getName(); String key = blob.getMetadata().getName();
Payload payload = blob.getPayload(); Payload payload = blob.getPayload();
MultipartUploadSlicingAlgorithm algorithm = new MultipartUploadSlicingAlgorithm(); MultipartUploadSlicingAlgorithm algorithm = new MultipartUploadSlicingAlgorithm();
algorithm.calculateChunkSize(payload.getContentMetadata().getContentLength()); algorithm
.calculateChunkSize(checkNotNull(
payload.getContentMetadata().getContentLength(),
"contentLength required on all uploads to amazon s3; please invoke payload.getContentMetadata().setContentLength(length) first"));
int parts = algorithm.getParts(); int parts = algorithm.getParts();
long chunkSize = algorithm.getChunkSize(); long chunkSize = algorithm.getChunkSize();
if (parts > 0) { if (parts > 0) {