Skip to content

Commit bde4964

Browse files
committed
Polishing
1 parent 8a96d1a commit bde4964

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

spring-web/src/main/java/org/springframework/web/method/annotation/ExceptionHandlerMethodResolver.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* Discovers {@linkplain ExceptionHandler @ExceptionHandler} methods in a given class,
3737
* including all of its superclasses, and helps to resolve a given {@link Exception}
3838
* to the exception types supported by a given {@link Method}.
39-
*
39+
*
4040
* @author Rossen Stoyanchev
4141
* @since 3.1
4242
*/
@@ -79,8 +79,8 @@ public ExceptionHandlerMethodResolver(Class<?> handlerType) {
7979

8080

8181
/**
82-
* Extract exception mappings from the {@code @ExceptionHandler} annotation
83-
* first and as a fall-back from the method signature.
82+
* Extract exception mappings from the {@code @ExceptionHandler} annotation first,
83+
* and then as a fallback from the method signature itself.
8484
*/
8585
@SuppressWarnings("unchecked")
8686
private List<Class<? extends Throwable>> detectExceptionMappings(Method method) {
@@ -115,7 +115,7 @@ private void addExceptionMapping(Class<? extends Throwable> exceptionType, Metho
115115
* Whether the contained type has any exception mappings.
116116
*/
117117
public boolean hasExceptionMappings() {
118-
return (this.mappedMethods.size() > 0);
118+
return !this.mappedMethods.isEmpty();
119119
}
120120

121121
/**
@@ -140,11 +140,11 @@ public Method resolveMethodByExceptionType(Class<? extends Exception> exceptionT
140140
method = getMappedMethod(exceptionType);
141141
this.exceptionLookupCache.put(exceptionType, (method != null ? method : NO_METHOD_FOUND));
142142
}
143-
return method != NO_METHOD_FOUND ? method : null;
143+
return (method != NO_METHOD_FOUND ? method : null);
144144
}
145145

146146
/**
147-
* Return the method mapped to the given exception type or {@code null}.
147+
* Return the {@link Method} mapped to the given exception type, or {@code null} if none.
148148
*/
149149
private Method getMappedMethod(Class<? extends Exception> exceptionType) {
150150
List<Class<? extends Throwable>> matches = new ArrayList<Class<? extends Throwable>>();

0 commit comments

Comments
 (0)