diff --git a/spring-test/src/main/java/org/springframework/test/web/servlet/request/MockHttpServletRequestBuilder.java b/spring-test/src/main/java/org/springframework/test/web/servlet/request/MockHttpServletRequestBuilder.java index efcfd8d3843..2f51ca07915 100644 --- a/spring-test/src/main/java/org/springframework/test/web/servlet/request/MockHttpServletRequestBuilder.java +++ b/spring-test/src/main/java/org/springframework/test/web/servlet/request/MockHttpServletRequestBuilder.java @@ -145,7 +145,7 @@ public class MockHttpServletRequestBuilder *
Although this class cannot be extended, additional ways to initialize * the {@code MockHttpServletRequest} can be plugged in via * {@link #with(RequestPostProcessor)}. - * @param httpMethod the HTTP method (GET, POST, etc) + * @param httpMethod the HTTP method (GET, POST, etc.) * @param url a URL template; the resulting URL will be encoded * @param vars zero or more URI variables */ @@ -164,7 +164,7 @@ public class MockHttpServletRequestBuilder /** * Alternative to {@link #MockHttpServletRequestBuilder(HttpMethod, String, Object...)} * with a pre-built URI. - * @param httpMethod the HTTP method (GET, POST, etc) + * @param httpMethod the HTTP method (GET, POST, etc.) * @param url the URL * @since 4.0.3 */ @@ -797,7 +797,7 @@ public class MockHttpServletRequestBuilder } } catch (Exception ex) { - // Must be invalid, ignore.. + // Must be invalid, ignore } } } @@ -894,7 +894,8 @@ public class MockHttpServletRequestBuilder HttpInputMessage message = new HttpInputMessage() { @Override public InputStream getBody() { - return (content != null ? new ByteArrayInputStream(content) : InputStream.nullInputStream()); + byte[] bodyContent = MockHttpServletRequestBuilder.this.content; + return (bodyContent != null ? new ByteArrayInputStream(bodyContent) : InputStream.nullInputStream()); } @Override public HttpHeaders getHeaders() { diff --git a/spring-test/src/main/java/org/springframework/test/web/servlet/request/MockMvcRequestBuilders.java b/spring-test/src/main/java/org/springframework/test/web/servlet/request/MockMvcRequestBuilders.java index 679c3c6ae59..1bc10783d39 100644 --- a/spring-test/src/main/java/org/springframework/test/web/servlet/request/MockMvcRequestBuilders.java +++ b/spring-test/src/main/java/org/springframework/test/web/servlet/request/MockMvcRequestBuilders.java @@ -176,7 +176,7 @@ public abstract class MockMvcRequestBuilders { /** * Create a {@link MockHttpServletRequestBuilder} for a request with the given HTTP method. - * @param method the HTTP method (GET, POST, etc) + * @param method the HTTP method (GET, POST, etc.) * @param urlTemplate a URL template; the resulting URL will be encoded * @param uriVariables zero or more URI variables */ @@ -186,7 +186,7 @@ public abstract class MockMvcRequestBuilders { /** * Create a {@link MockHttpServletRequestBuilder} for a request with the given HTTP method. - * @param httpMethod the HTTP method (GET, POST, etc) + * @param httpMethod the HTTP method (GET, POST, etc.) * @param uri the URL * @since 4.0.3 */