quod3 created JCLOUDS-1073:
------------------------------

             Summary: in local-fs getBlob with open-ended range: parseInt 
instead of parseLong -> NumberFormatException
                 Key: JCLOUDS-1073
                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1073
             Project: jclouds
          Issue Type: Bug
          Components: jclouds-blobstore
    Affects Versions: 2.0.0
            Reporter: quod3


[~gaul] LocalBlobStore tries to parse the open-ended ranges using parseInt, 
causing multipart downloads to fail on the last chunk of files that are 2GB+.

This causes the following error from s3proxy (latest git head):

{code}
GET /bucket/key.tar HTTP/1.1
Host: 10.10.10.10:8080
Accept-Encoding: identity
Date: Sat, 30 Jan 2016 04:57:54 GMT
Range: bytes=2357198848-
Authorization: AWS ---
User-Agent: Boto3/1.2.3 Python/2.7.6 Linux/3.19.0-43-generic Botocore/1.3.22 
Resource

***

HTTP/1.1 416 Requested Range Not Satisfiable
Date: Sat, 30 Jan 2016 04:57:54 GMT
Transfer-Encoding: chunked
Server: Jetty(9.2.z-SNAPSHOT)

<?xml version="1.0" ?><Error><Code>InvalidRange</Code><Message>The requested 
range is not satisfiable</Message><RequestId>...</RequestId></Error>
{code}

This fixes it for me:

{code}
diff --git 
a/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java 
b/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java
index 9c06f21..ce244ef 100644
--- a/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java
+++ b/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java
@@ -662,12 +662,12 @@ public final class LocalBlobStore implements BlobStore {
                long offset = 0;
                long last = 
blob.getPayload().getContentMetadata().getContentLength() - 1;
                if (s.startsWith("-")) {
-                  offset = last - Integer.parseInt(s.substring(1)) + 1;
+                  offset = last - Long.parseLong(s.substring(1)) + 1;
                   if (offset < 0) {
                      offset = 0;
                   }
                } else if (s.endsWith("-")) {
-                  offset = Integer.parseInt(s.substring(0, s.length() - 1));
+                  offset = Long.parseLong(s.substring(0, s.length() - 1));
                } else if (s.contains("-")) {
                   String[] firstLast = s.split("\\-");
                   offset = Long.parseLong(firstLast[0]);
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to