Support Integer.MAX_VALUE size PUTs

Previously jclouds enforced Integer.MAX_VALUE - 1 size.  Tested
against Atmos Online.
This commit is contained in:
Andrew Gaul 2013-08-28 11:58:02 -07:00
parent 607b178c6b
commit 5261f760b7
1 changed files with 5 additions and 3 deletions

View File

@ -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());