You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ga...@apache.org on 2016/01/31 02:20:07 UTC
jclouds git commit: Use parseLong instead of parseInt in range parser
Repository: jclouds
Updated Branches:
refs/heads/master 6360023f0 -> 77eef902b
Use parseLong instead of parseInt in range parser
Use parseLong instead of parseInt when parsing open-ended byte ranges in LocalBlobStore. Without this fix, any "from byte x" or "to byte x" getBlob() call will throw a NumberFormatException if x is too big to fit into an int (2 GB).
Fixes https://issues.apache.org/jira/browse/JCLOUDS-1073
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/77eef902
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/77eef902
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/77eef902
Branch: refs/heads/master
Commit: 77eef902b4183890028a0d5ad16c471acb90e7e1
Parents: 6360023
Author: quod3 <qu...@k.int80k.com>
Authored: Sat Jan 30 20:11:07 2016 -0500
Committer: quod3 <qu...@k.int80k.com>
Committed: Sat Jan 30 20:11:07 2016 -0500
----------------------------------------------------------------------
.../main/java/org/jclouds/blobstore/config/LocalBlobStore.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/77eef902/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java
----------------------------------------------------------------------
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]);