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 aee3c10a93
commit f3e43b34f6
1 changed files with 5 additions and 3 deletions

View File

@ -209,9 +209,11 @@ public class JavaUrlHttpCommandExecutorService extends BaseHttpCommandExecutorSe
writePayloadToConnection(payload, "streaming", connection); writePayloadToConnection(payload, "streaming", connection);
} else { } else {
Long length = checkNotNull(md.getContentLength(), "payload.getContentLength"); Long length = checkNotNull(md.getContentLength(), "payload.getContentLength");
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6755625 // TODO: remove check after moving to JDK 7.
checkArgument(length < Integer.MAX_VALUE, checkArgument(length <= Integer.MAX_VALUE,
"JDK 1.6 does not support >2GB chunks. Use chunked encoding, if possible."); "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) { if (length > 0) {
connection.setRequestProperty(CONTENT_LENGTH, length.toString()); connection.setRequestProperty(CONTENT_LENGTH, length.toString());
connection.setFixedLengthStreamingMode(length.intValue()); connection.setFixedLengthStreamingMode(length.intValue());