JCLOUDS-1064: More helpful error for null length

This commit is contained in:
Andrew Gaul 2016-03-06 19:08:06 -08:00
parent 72f2652dca
commit dd670f3f78
1 changed files with 2 additions and 1 deletions

View File

@ -578,7 +578,8 @@ public class RegionScopedSwiftBlobStore implements BlobStore {
@Beta
protected String putMultipartBlob(String container, Blob blob, PutOptions overrides) {
List<MultipartPart> parts = Lists.newArrayList();
long contentLength = blob.getMetadata().getContentMetadata().getContentLength();
long contentLength = checkNotNull(blob.getMetadata().getContentMetadata().getContentLength(),
"must provide content-length to use multi-part upload");
MultipartUploadSlicingAlgorithm algorithm = new MultipartUploadSlicingAlgorithm(
getMinimumMultipartPartSize(), getMaximumMultipartPartSize(), getMaximumNumberOfParts());
long partSize = algorithm.calculateChunkSize(contentLength);