Skip to content

Commit 142f1ab

Browse files
mrmausjhoeller
authored andcommitted
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
1 parent 0ca4cd1 commit 142f1ab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-web/src/main/java/org/springframework/http/client/SimpleStreamingClientHttpRequest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public URI getURI() {
7373
protected OutputStream getBodyInternal(HttpHeaders headers) throws IOException {
7474
if (this.body == null) {
7575
if (this.outputStreaming) {
76-
int contentLength = (int) headers.getContentLength();
76+
long contentLength = headers.getContentLength();
7777
if (contentLength >= 0) {
7878
this.connection.setFixedLengthStreamingMode(contentLength);
7979
}

0 commit comments

Comments
 (0)