From 142f1ab42f062916df88d3b852a20e8e73b0cf9f Mon Sep 17 00:00:00 2001 From: andrm Date: Sat, 20 Jan 2018 11:23:28 +0100 Subject: [PATCH] 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 --- .../http/client/SimpleStreamingClientHttpRequest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-web/src/main/java/org/springframework/http/client/SimpleStreamingClientHttpRequest.java b/spring-web/src/main/java/org/springframework/http/client/SimpleStreamingClientHttpRequest.java index fd0a1d0ddc..98523e9518 100644 --- a/spring-web/src/main/java/org/springframework/http/client/SimpleStreamingClientHttpRequest.java +++ b/spring-web/src/main/java/org/springframework/http/client/SimpleStreamingClientHttpRequest.java @@ -73,7 +73,7 @@ final class SimpleStreamingClientHttpRequest extends AbstractClientHttpRequest { protected OutputStream getBodyInternal(HttpHeaders headers) throws IOException { if (this.body == null) { if (this.outputStreaming) { - int contentLength = (int) headers.getContentLength(); + long contentLength = headers.getContentLength(); if (contentLength >= 0) { this.connection.setFixedLengthStreamingMode(contentLength); } -- GitLab