Skip to content

Commit 29955a2

Browse files
committed
Polishing
1 parent 4b6b12b commit 29955a2

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestBodyAdvice.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ boolean supports(MethodParameter methodParameter, Type targetType,
5757
* @param targetType the target type, not necessarily the same as the method
5858
* parameter type, e.g. for {@code HttpEntity<String>}.
5959
* @param converterType the converter used to deserialize the body
60-
* @return the input request or a new instance, never {@code null}
60+
* @return the input request or a new instance (never {@code null})
6161
*/
6262
HttpInputMessage beforeBodyRead(HttpInputMessage inputMessage, MethodParameter parameter,
6363
Type targetType, Class<? extends HttpMessageConverter<?>> converterType) throws IOException;
@@ -83,8 +83,8 @@ Object afterBodyRead(Object body, HttpInputMessage inputMessage, MethodParameter
8383
* @param targetType the target type, not necessarily the same as the method
8484
* parameter type, e.g. for {@code HttpEntity<String>}.
8585
* @param converterType the selected converter type
86-
* @return the value to use or {@code null} which may then raise an
87-
* {@code HttpMessageNotReadableException} if the argument is required.
86+
* @return the value to use, or {@code null} which may then raise an
87+
* {@code HttpMessageNotReadableException} if the argument is required
8888
*/
8989
@Nullable
9090
Object handleEmptyBody(@Nullable Object body, HttpInputMessage inputMessage, MethodParameter parameter,

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestBodyAdviceAdapter.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.web.servlet.mvc.method.annotation;
1718

1819
import java.io.IOException;
@@ -28,7 +29,7 @@
2829
* {@link org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice
2930
* RequestBodyAdvice} with default method implementations.
3031
*
31-
* <p>Sub-classes are required to implement {@link #supports} to return true
32+
* <p>Subclasses are required to implement {@link #supports} to return true
3233
* depending on when the advice applies.
3334
*
3435
* @author Rossen Stoyanchev
@@ -41,8 +42,7 @@ public abstract class RequestBodyAdviceAdapter implements RequestBodyAdvice {
4142
*/
4243
@Override
4344
public HttpInputMessage beforeBodyRead(HttpInputMessage inputMessage, MethodParameter parameter,
44-
Type targetType, Class<? extends HttpMessageConverter<?>> converterType)
45-
throws IOException {
45+
Type targetType, Class<? extends HttpMessageConverter<?>> converterType) throws IOException {
4646

4747
return inputMessage;
4848
}
@@ -62,9 +62,8 @@ public Object afterBodyRead(Object body, HttpInputMessage inputMessage, MethodPa
6262
*/
6363
@Override
6464
@Nullable
65-
public Object handleEmptyBody(@Nullable Object body, HttpInputMessage inputMessage,
66-
MethodParameter parameter, Type targetType,
67-
Class<? extends HttpMessageConverter<?>> converterType) {
65+
public Object handleEmptyBody(@Nullable Object body, HttpInputMessage inputMessage, MethodParameter parameter,
66+
Type targetType, Class<? extends HttpMessageConverter<?>> converterType) {
6867

6968
return body;
7069
}

spring-webmvc/src/test/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandlerIntegrationTests.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.web.servlet.resource;
1718

1819
import java.io.IOException;
@@ -49,6 +50,7 @@
4950

5051
/**
5152
* Integration tests for static resource handling.
53+
*
5254
* @author Rossen Stoyanchev
5355
*/
5456
public class ResourceHttpRequestHandlerIntegrationTests {
@@ -135,7 +137,7 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) {
135137

136138
registerClasspathLocation("/cp/**", classPathLocation, registry);
137139
registerFileSystemLocation("/fs/**", path, registry);
138-
registerUrlLocation("/url/**", "file://" + path, registry);
140+
registerUrlLocation("/url/**", "file://" + path.replace('\\', '/'), registry);
139141
}
140142

141143
protected void registerClasspathLocation(String pattern, ClassPathResource resource, ResourceHandlerRegistry registry) {

0 commit comments

Comments
 (0)