|
|
@ -79,8 +79,8 @@ public class ExceptionHandlerMethodResolver { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Extract exception mappings from the {@code @ExceptionHandler} annotation |
|
|
|
* Extract exception mappings from the {@code @ExceptionHandler} annotation first, |
|
|
|
* first and as a fall-back from the method signature. |
|
|
|
* and then as a fallback from the method signature itself. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
private List<Class<? extends Throwable>> detectExceptionMappings(Method method) { |
|
|
|
private List<Class<? extends Throwable>> detectExceptionMappings(Method method) { |
|
|
@ -115,7 +115,7 @@ public class ExceptionHandlerMethodResolver { |
|
|
|
* Whether the contained type has any exception mappings. |
|
|
|
* Whether the contained type has any exception mappings. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean hasExceptionMappings() { |
|
|
|
public boolean hasExceptionMappings() { |
|
|
|
return (this.mappedMethods.size() > 0); |
|
|
|
return !this.mappedMethods.isEmpty(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -140,11 +140,11 @@ public class ExceptionHandlerMethodResolver { |
|
|
|
method = getMappedMethod(exceptionType); |
|
|
|
method = getMappedMethod(exceptionType); |
|
|
|
this.exceptionLookupCache.put(exceptionType, (method != null ? method : NO_METHOD_FOUND)); |
|
|
|
this.exceptionLookupCache.put(exceptionType, (method != null ? method : NO_METHOD_FOUND)); |
|
|
|
} |
|
|
|
} |
|
|
|
return method != NO_METHOD_FOUND ? method : null; |
|
|
|
return (method != NO_METHOD_FOUND ? method : null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Return the method mapped to the given exception type or {@code null}. |
|
|
|
* Return the {@link Method} mapped to the given exception type, or {@code null} if none. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private Method getMappedMethod(Class<? extends Exception> exceptionType) { |
|
|
|
private Method getMappedMethod(Class<? extends Exception> exceptionType) { |
|
|
|
List<Class<? extends Throwable>> matches = new ArrayList<Class<? extends Throwable>>(); |
|
|
|
List<Class<? extends Throwable>> matches = new ArrayList<Class<? extends Throwable>>(); |
|
|
|