提交 142f1ab4 编写于 作者: A andrm 提交者: Juergen Hoeller

Removed unnecessary cast to int

Since Java7 HttpURLConnection offers setFixedLengthStreamingMode method with long parameter which should be prefered over version with int argument, therefore casting ContentLength to int is no longer needed. Moreover it makes impossible to stream payload larger than Integer.MAX_VALUE
上级 0ca4cd1c
...@@ -73,7 +73,7 @@ final class SimpleStreamingClientHttpRequest extends AbstractClientHttpRequest { ...@@ -73,7 +73,7 @@ final class SimpleStreamingClientHttpRequest extends AbstractClientHttpRequest {
protected OutputStream getBodyInternal(HttpHeaders headers) throws IOException { protected OutputStream getBodyInternal(HttpHeaders headers) throws IOException {
if (this.body == null) { if (this.body == null) {
if (this.outputStreaming) { if (this.outputStreaming) {
int contentLength = (int) headers.getContentLength(); long contentLength = headers.getContentLength();
if (contentLength >= 0) { if (contentLength >= 0) {
this.connection.setFixedLengthStreamingMode(contentLength); this.connection.setFixedLengthStreamingMode(contentLength);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册