mirror of https://github.com/apache/jclouds.git
JCLOUDS-1368: Fix off-by-one in slicing algorithm
This commit is contained in:
parent
90498ae04d
commit
eb5db026da
|
@ -360,7 +360,7 @@ public abstract class BaseBlobStore implements BlobStore {
|
||||||
long partSize = algorithm.calculateChunkSize(contentLength);
|
long partSize = algorithm.calculateChunkSize(contentLength);
|
||||||
int partNumber = 1;
|
int partNumber = 1;
|
||||||
// TODO: for InputStream payloads, this buffers all parts in-memory!
|
// TODO: for InputStream payloads, this buffers all parts in-memory!
|
||||||
while (partNumber < algorithm.getParts()) {
|
while (partNumber <= algorithm.getParts()) {
|
||||||
Payload payload = slicer.slice(blob.getPayload(), algorithm.getCopied(), partSize);
|
Payload payload = slicer.slice(blob.getPayload(), algorithm.getCopied(), partSize);
|
||||||
BlobUploader b =
|
BlobUploader b =
|
||||||
new BlobUploader(mpu, partNumber++, payload);
|
new BlobUploader(mpu, partNumber++, payload);
|
||||||
|
|
|
@ -828,6 +828,8 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
|
||||||
assertThat(etag).isNotNull();
|
assertThat(etag).isNotNull();
|
||||||
|
|
||||||
Blob blob = blobStore.getBlob(container, blobName);
|
Blob blob = blobStore.getBlob(container, blobName);
|
||||||
|
assertThat(blob.getMetadata().getContentMetadata().getContentLength()).isEqualTo(length);
|
||||||
|
|
||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
try {
|
try {
|
||||||
is = blob.getPayload().openStream();
|
is = blob.getPayload().openStream();
|
||||||
|
|
Loading…
Reference in New Issue