Uploaded image for project: 'jclouds'
  1. jclouds
  2. JCLOUDS-1073

in local-fs getBlob with open-ended range: parseInt instead of parseLong -> NumberFormatException

    XMLWordPrintableJSON

    Details

    • Flags:
      Patch

      Description

      Andrew 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):

      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>
      

      This fixes it for me:

      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]);
      

        Attachments

          Activity

            People

            • Assignee:
              gaul Andrew Gaul
              Reporter:
              quod3 quod3
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: