From 5261f760b79187003c41540885cf7b171b965552 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Wed, 28 Aug 2013 11:58:02 -0700 Subject: [PATCH] Support Integer.MAX_VALUE size PUTs Previously jclouds enforced Integer.MAX_VALUE - 1 size. Tested against Atmos Online. --- .../http/internal/JavaUrlHttpCommandExecutorService.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpCommandExecutorService.java b/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpCommandExecutorService.java index acc20416d2..fac7c55f1d 100644 --- a/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpCommandExecutorService.java +++ b/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpCommandExecutorService.java @@ -209,9 +209,11 @@ public class JavaUrlHttpCommandExecutorService extends BaseHttpCommandExecutorSe writePayloadToConnection(payload, "streaming", connection); } else { Long length = checkNotNull(md.getContentLength(), "payload.getContentLength"); - // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6755625 - checkArgument(length < Integer.MAX_VALUE, - "JDK 1.6 does not support >2GB chunks. Use chunked encoding, if possible."); + // TODO: remove check after moving to JDK 7. + checkArgument(length <= Integer.MAX_VALUE, + "Cannot transfer 2 GB or larger chunks due to JDK 1.6 limitations." + + " Use chunked encoding or multi-part upload, if possible." + + " For more information: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6755625"); if (length > 0) { connection.setRequestProperty(CONTENT_LENGTH, length.toString()); connection.setFixedLengthStreamingMode(length.intValue());