Skip to content

Commit 5169c51

Browse files
committed
Polishing
1 parent eeb7ae5 commit 5169c51

File tree

7 files changed

+27
-22
lines changed

7 files changed

+27
-22
lines changed

spring-web-reactive/src/main/java/org/springframework/web/reactive/result/view/freemarker/FreeMarkerView.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ public boolean checkResourceExists(Locale locale) throws Exception {
164164
@Override
165165
protected Mono<Void> renderInternal(Map<String, Object> renderAttributes, MediaType contentType,
166166
ServerWebExchange exchange) {
167+
167168
// Expose all standard FreeMarker hash models.
168169
SimpleHash freeMarkerModel = getTemplateModel(renderAttributes, exchange);
169170
if (logger.isDebugEnabled()) {
@@ -186,8 +187,8 @@ protected Mono<Void> renderInternal(Map<String, Object> renderAttributes, MediaT
186187
return exchange.getResponse().writeWith(Flux.just(dataBuffer));
187188
}
188189

189-
private static Optional<Charset> getCharset(MediaType mediaType) {
190-
return mediaType != null ? Optional.ofNullable(mediaType.getCharset()) : Optional.empty();
190+
private Optional<Charset> getCharset(MediaType mediaType) {
191+
return (mediaType != null ? Optional.ofNullable(mediaType.getCharset()) : Optional.empty());
191192
}
192193

193194
/**

spring-web-reactive/src/main/java/org/springframework/web/reactive/socket/adapter/JettyWebSocketSession.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
*/
3939
public class JettyWebSocketSession extends AbstractListenerWebSocketSession<Session> {
4040

41-
4241
public JettyWebSocketSession(Session session) {
4342
super(session, ObjectUtils.getIdentityHexString(session),
4443
session.getUpgradeRequest().getRequestURI());
@@ -52,12 +51,12 @@ protected boolean canSuspendReceiving() {
5251

5352
@Override
5453
protected void suspendReceiving() {
55-
// No-op
54+
// no-op
5655
}
5756

5857
@Override
5958
protected void resumeReceiving() {
60-
// No-op
59+
// no-op
6160
}
6261

6362
@Override

spring-web-reactive/src/main/java/org/springframework/web/reactive/socket/adapter/RxNettyWebSocketSession.java

Lines changed: 1 addition & 1 deletion
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.reactive.socket.adapter;
1718

1819
import java.net.URI;
@@ -39,7 +40,6 @@
3940
*/
4041
public class RxNettyWebSocketSession extends NettyWebSocketSessionSupport<WebSocketConnection> {
4142

42-
4343
public RxNettyWebSocketSession(WebSocketConnection conn, URI uri, NettyDataBufferFactory factory) {
4444
super(conn, uri, factory);
4545
}

spring-web-reactive/src/main/java/org/springframework/web/reactive/socket/adapter/TomcatWebSocketSession.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
*/
4141
public class TomcatWebSocketSession extends AbstractListenerWebSocketSession<Session> {
4242

43-
4443
public TomcatWebSocketSession(Session session) {
4544
super(session, session.getId(), session.getRequestURI());
4645
}
@@ -53,12 +52,12 @@ protected boolean canSuspendReceiving() {
5352

5453
@Override
5554
protected void suspendReceiving() {
56-
// No-op
55+
// no-op
5756
}
5857

5958
@Override
6059
protected void resumeReceiving() {
61-
// No-op
60+
// no-op
6261
}
6362

6463
@Override

spring-web-reactive/src/main/java/org/springframework/web/reactive/socket/adapter/UndertowWebSocketSession.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
*/
4242
public class UndertowWebSocketSession extends AbstractListenerWebSocketSession<WebSocketChannel> {
4343

44-
4544
public UndertowWebSocketSession(WebSocketChannel channel, URI url) {
4645
super(channel, ObjectUtils.getIdentityHexString(channel), url);
4746
}

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
9090
private final Set<String> safeExtensions = new HashSet<>();
9191

9292

93-
9493
/**
9594
* Constructor with list of converters only.
9695
*/
@@ -348,9 +347,7 @@ private MediaType getMostSpecificMediaType(MediaType acceptType, MediaType produ
348347
* header with a safe attachment file name ("f.txt") is added to prevent
349348
* RFD exploits.
350349
*/
351-
private void addContentDispositionHeader(ServletServerHttpRequest request,
352-
ServletServerHttpResponse response) {
353-
350+
private void addContentDispositionHeader(ServletServerHttpRequest request, ServletServerHttpResponse response) {
354351
HttpHeaders headers = response.getHeaders();
355352
if (headers.containsKey(HttpHeaders.CONTENT_DISPOSITION)) {
356353
return;
@@ -363,7 +360,7 @@ private void addContentDispositionHeader(ServletServerHttpRequest request,
363360
}
364361
}
365362
catch (Throwable ex) {
366-
// Ignore
363+
// ignore
367364
}
368365

369366
HttpServletRequest servletRequest = request.getServletRequest();

spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessorTests.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,7 @@
6969
import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
7070
import org.springframework.web.util.WebUtils;
7171

72-
import static org.junit.Assert.assertEquals;
73-
import static org.junit.Assert.assertFalse;
74-
import static org.junit.Assert.assertNotNull;
75-
import static org.junit.Assert.assertNull;
76-
import static org.junit.Assert.assertTrue;
72+
import static org.junit.Assert.*;
7773

7874
/**
7975
* Test fixture for a {@link RequestResponseBodyMethodProcessor} with
@@ -732,7 +728,6 @@ private void assertContentDisposition(RequestResponseBodyMethodProcessor process
732728
}
733729

734730

735-
736731
String handle(
737732
@RequestBody List<SimpleBean> list,
738733
@RequestBody SimpleBean simpleBean,
@@ -751,29 +746,34 @@ OutputStream handleAndReturnOutputStream() {
751746
return null;
752747
}
753748

749+
754750
private static abstract class MyParameterizedController<DTO extends Identifiable> {
755751

756752
@SuppressWarnings("unused")
757753
public void handleDto(@RequestBody DTO dto) {}
758754
}
759755

756+
760757
private static class MySimpleParameterizedController extends MyParameterizedController<SimpleBean> {
761758
}
762759

760+
763761
private interface Identifiable extends Serializable {
764762

765763
Long getId();
766764

767765
void setId(Long id);
768766
}
769767

768+
770769
@SuppressWarnings("unused")
771770
private static abstract class MyParameterizedControllerWithList<DTO extends Identifiable> {
772771

773772
public void handleDto(@RequestBody List<DTO> dto) {
774773
}
775774
}
776775

776+
777777
@SuppressWarnings("unused")
778778
private static class MySimpleParameterizedControllerWithList extends MyParameterizedControllerWithList<SimpleBean> {
779779
}
@@ -843,9 +843,12 @@ public String handle() {
843843
}
844844
}
845845

846+
846847
private interface MyJacksonView1 {}
848+
847849
private interface MyJacksonView2 {}
848850

851+
849852
private static class JacksonViewBean {
850853

851854
@JsonView(MyJacksonView1.class)
@@ -881,6 +884,7 @@ public void setWithoutView(String withoutView) {
881884
}
882885
}
883886

887+
884888
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
885889
public static class ParentClass {
886890

@@ -902,6 +906,7 @@ public void setParentProperty(String parentProperty) {
902906
}
903907
}
904908

909+
905910
@JsonTypeName("foo")
906911
public static class Foo extends ParentClass {
907912

@@ -913,6 +918,7 @@ public Foo(String parentProperty) {
913918
}
914919
}
915920

921+
916922
@JsonTypeName("bar")
917923
public static class Bar extends ParentClass {
918924

@@ -924,6 +930,7 @@ public Bar(String parentProperty) {
924930
}
925931
}
926932

933+
927934
private static class JacksonController {
928935

929936
@RequestMapping
@@ -996,9 +1003,9 @@ public List<Identifiable> handleSubTypeList() {
9961003
public String defaultCharset() {
9971004
return "foo";
9981005
}
999-
10001006
}
10011007

1008+
10021009
private static class EmptyRequestBodyAdvice implements RequestBodyAdvice {
10031010

10041011
@Override
@@ -1030,12 +1037,15 @@ public Object afterBodyRead(Object body, HttpInputMessage inputMessage, MethodPa
10301037
}
10311038
}
10321039

1040+
10331041
interface MappingInterface<A> {
1042+
10341043
default A handle(@RequestBody A arg) {
10351044
return arg;
10361045
}
10371046
}
10381047

1048+
10391049
static class MyControllerImplementingInterface implements MappingInterface<String> {
10401050
}
10411051

0 commit comments

Comments
 (0)