JCLOUDS-264: Allow payloads greater than 2 GB

Enabled by JDK 7.
This commit is contained in:
Andrew Gaul 2014-04-17 08:16:47 +08:00
parent 5e8bd02c93
commit 7e4cacf9ea
1 changed files with 3 additions and 8 deletions

View File

@ -180,15 +180,10 @@ public class JavaUrlHttpCommandExecutorService extends BaseHttpCommandExecutorSe
connection.setChunkedStreamingMode(8196);
writePayloadToConnection(payload, "streaming", connection);
} else {
Long length = checkNotNull(md.getContentLength(), "payload.getContentLength");
// 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");
long length = checkNotNull(md.getContentLength(), "payload.getContentLength");
if (length > 0) {
connection.setRequestProperty(CONTENT_LENGTH, length.toString());
connection.setFixedLengthStreamingMode(length.intValue());
connection.setRequestProperty(CONTENT_LENGTH, String.valueOf(length));
connection.setFixedLengthStreamingMode(length);
writePayloadToConnection(payload, length, connection);
} else {
writeNothing(connection);