Skip to content

Commit a63247b

Browse files
committed
Polishing
1 parent dd7ddc0 commit a63247b

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

spring-webmvc/src/main/java/org/springframework/web/servlet/AsyncHandlerInterceptor.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 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.
@@ -53,7 +53,6 @@
5353
*
5454
* @author Rossen Stoyanchev
5555
* @since 3.2
56-
*
5756
* @see org.springframework.web.context.request.async.WebAsyncManager
5857
* @see org.springframework.web.context.request.async.CallableProcessingInterceptor
5958
* @see org.springframework.web.context.request.async.DeferredResultProcessingInterceptor
@@ -67,15 +66,13 @@ public interface AsyncHandlerInterceptor extends HandlerInterceptor {
6766
* avoid modifying them in ways that would conflict with the concurrent
6867
* execution of the handler. A typical use of this method would be to
6968
* clean up thread-local variables.
70-
*
7169
* @param request the current request
7270
* @param response the current response
7371
* @param handler the handler (or {@link HandlerMethod}) that started async
7472
* execution, for type and/or instance examination
7573
* @throws Exception in case of errors
7674
*/
77-
void afterConcurrentHandlingStarted(
78-
HttpServletRequest request, HttpServletResponse response, Object handler)
75+
void afterConcurrentHandlingStarted(HttpServletRequest request, HttpServletResponse response, Object handler)
7976
throws Exception;
8077

8178
}

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

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 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.
@@ -19,7 +19,7 @@
1919
import java.io.IOException;
2020
import java.io.UnsupportedEncodingException;
2121
import java.io.Writer;
22-
import java.util.Arrays;
22+
import java.util.Collections;
2323

2424
import org.junit.Before;
2525
import org.junit.BeforeClass;
@@ -68,10 +68,10 @@ public class ExceptionHandlerExceptionResolverTests {
6868

6969
@BeforeClass
7070
public static void setupOnce() {
71-
ExceptionHandlerExceptionResolver r = new ExceptionHandlerExceptionResolver();
72-
r.afterPropertiesSet();
73-
RESOLVER_COUNT = r.getArgumentResolvers().getResolvers().size();
74-
HANDLER_COUNT = r.getReturnValueHandlers().getHandlers().size();
71+
ExceptionHandlerExceptionResolver resolver = new ExceptionHandlerExceptionResolver();
72+
resolver.afterPropertiesSet();
73+
RESOLVER_COUNT = resolver.getArgumentResolvers().getResolvers().size();
74+
HANDLER_COUNT = resolver.getReturnValueHandlers().getHandlers().size();
7575
}
7676

7777
@Before
@@ -93,7 +93,7 @@ public void nullHandler() {
9393
@Test
9494
public void setCustomArgumentResolvers() throws Exception {
9595
HandlerMethodArgumentResolver resolver = new ServletRequestMethodArgumentResolver();
96-
this.resolver.setCustomArgumentResolvers(Arrays.asList(resolver));
96+
this.resolver.setCustomArgumentResolvers(Collections.singletonList(resolver));
9797
this.resolver.afterPropertiesSet();
9898

9999
assertTrue(this.resolver.getArgumentResolvers().getResolvers().contains(resolver));
@@ -103,7 +103,7 @@ public void setCustomArgumentResolvers() throws Exception {
103103
@Test
104104
public void setArgumentResolvers() throws Exception {
105105
HandlerMethodArgumentResolver resolver = new ServletRequestMethodArgumentResolver();
106-
this.resolver.setArgumentResolvers(Arrays.asList(resolver));
106+
this.resolver.setArgumentResolvers(Collections.singletonList(resolver));
107107
this.resolver.afterPropertiesSet();
108108

109109
assertMethodProcessorCount(1, HANDLER_COUNT);
@@ -112,7 +112,7 @@ public void setArgumentResolvers() throws Exception {
112112
@Test
113113
public void setCustomReturnValueHandlers() {
114114
HandlerMethodReturnValueHandler handler = new ViewNameMethodReturnValueHandler();
115-
this.resolver.setCustomReturnValueHandlers(Arrays.asList(handler));
115+
this.resolver.setCustomReturnValueHandlers(Collections.singletonList(handler));
116116
this.resolver.afterPropertiesSet();
117117

118118
assertTrue(this.resolver.getReturnValueHandlers().getHandlers().contains(handler));
@@ -122,7 +122,7 @@ public void setCustomReturnValueHandlers() {
122122
@Test
123123
public void setReturnValueHandlers() {
124124
HandlerMethodReturnValueHandler handler = new ModelMethodProcessor();
125-
this.resolver.setReturnValueHandlers(Arrays.asList(handler));
125+
this.resolver.setReturnValueHandlers(Collections.singletonList(handler));
126126
this.resolver.afterPropertiesSet();
127127

128128
assertMethodProcessorCount(RESOLVER_COUNT, 1);
@@ -217,9 +217,7 @@ public void resolveExceptionGlobalHandlerOrdered() throws Exception {
217217
assertEquals("TestExceptionResolver: IllegalStateException", this.response.getContentAsString());
218218
}
219219

220-
// SPR-12605
221-
222-
@Test
220+
@Test // SPR-12605
223221
public void resolveExceptionWithHandlerMethodArg() throws Exception {
224222
AnnotationConfigApplicationContext cxt = new AnnotationConfigApplicationContext(MyConfig.class);
225223
this.resolver.setApplicationContext(cxt);

0 commit comments

Comments
 (0)