From 2fd6e6e87c675c9c450affb87221be31d251abce Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Mon, 11 Jan 2021 12:40:50 +0100 Subject: [PATCH] Polish Javadoc for base ExceptionHandlerMethodResolvers --- .../AbstractExceptionHandlerMethodResolver.java | 13 ++++++++----- .../annotation/ExceptionHandlerMethodResolver.java | 11 +++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractExceptionHandlerMethodResolver.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractExceptionHandlerMethodResolver.java index e4e6b6632a25..6bf11cf119bd 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractExceptionHandlerMethodResolver.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractExceptionHandlerMethodResolver.java @@ -66,9 +66,9 @@ protected AbstractExceptionHandlerMethodResolver(Map, } /** - * Extract the exceptions this method handles.This implementation looks for + * Extract the exceptions this method handles. This implementation looks for * sub-classes of Throwable in the method signature. - * The method is static to ensure safe use from sub-class constructors. + *

The method is static to ensure safe use from sub-class constructors. */ @SuppressWarnings("unchecked") protected static List> getExceptionsFromMethodSignature(Method method) { @@ -94,7 +94,7 @@ public boolean hasExceptionMappings() { /** * Find a {@link Method} to handle the given exception. - * Use {@link ExceptionDepthComparator} if more than one match is found. + *

Uses {@link ExceptionDepthComparator} if more than one match is found. * @param exception the exception * @return a Method to handle the exception, or {@code null} if none found */ @@ -113,6 +113,7 @@ public Method resolveMethod(Throwable exception) { /** * Find a {@link Method} to handle the given exception type. This can be * useful if an {@link Exception} instance is not available (e.g. for tools). + *

Uses {@link ExceptionDepthComparator} if more than one match is found. * @param exceptionType the exception type * @return a Method to handle the exception, or {@code null} if none found * @since 4.3.1 @@ -128,7 +129,8 @@ public Method resolveMethodByExceptionType(Class exceptionT } /** - * Return the {@link Method} mapped to the given exception type, or {@code null} if none. + * Return the {@link Method} mapped to the given exception type, or + * {@link #NO_MATCHING_EXCEPTION_HANDLER_METHOD} if none. */ @Nullable private Method getMappedMethod(Class exceptionType) { @@ -150,8 +152,9 @@ private Method getMappedMethod(Class exceptionType) { } /** - * For the NO_MATCHING_EXCEPTION_HANDLER_METHOD constant. + * For the {@link #NO_MATCHING_EXCEPTION_HANDLER_METHOD} constant. */ + @SuppressWarnings("unused") private void noMatchingExceptionHandler() { } diff --git a/spring-web/src/main/java/org/springframework/web/method/annotation/ExceptionHandlerMethodResolver.java b/spring-web/src/main/java/org/springframework/web/method/annotation/ExceptionHandlerMethodResolver.java index 3d5995ceae90..8850d58be450 100644 --- a/spring-web/src/main/java/org/springframework/web/method/annotation/ExceptionHandlerMethodResolver.java +++ b/spring-web/src/main/java/org/springframework/web/method/annotation/ExceptionHandlerMethodResolver.java @@ -125,7 +125,7 @@ public boolean hasExceptionMappings() { /** * Find a {@link Method} to handle the given exception. - * Use {@link ExceptionDepthComparator} if more than one match is found. + *

Uses {@link ExceptionDepthComparator} if more than one match is found. * @param exception the exception * @return a Method to handle the exception, or {@code null} if none found */ @@ -136,7 +136,7 @@ public Method resolveMethod(Exception exception) { /** * Find a {@link Method} to handle the given Throwable. - * Use {@link ExceptionDepthComparator} if more than one match is found. + *

Uses {@link ExceptionDepthComparator} if more than one match is found. * @param exception the exception * @return a Method to handle the exception, or {@code null} if none found * @since 5.0 @@ -156,6 +156,7 @@ public Method resolveMethodByThrowable(Throwable exception) { /** * Find a {@link Method} to handle the given exception type. This can be * useful if an {@link Exception} instance is not available (e.g. for tools). + *

Uses {@link ExceptionDepthComparator} if more than one match is found. * @param exceptionType the exception type * @return a Method to handle the exception, or {@code null} if none found */ @@ -170,7 +171,8 @@ public Method resolveMethodByExceptionType(Class exceptionT } /** - * Return the {@link Method} mapped to the given exception type, or {@code null} if none. + * Return the {@link Method} mapped to the given exception type, or + * {@link #NO_MATCHING_EXCEPTION_HANDLER_METHOD} if none. */ private Method getMappedMethod(Class exceptionType) { List> matches = new ArrayList<>(); @@ -191,8 +193,9 @@ private Method getMappedMethod(Class exceptionType) { } /** - * For the NO_MATCHING_EXCEPTION_HANDLER_METHOD constant. + * For the {@link #NO_MATCHING_EXCEPTION_HANDLER_METHOD} constant. */ + @SuppressWarnings("unused") private void noMatchingExceptionHandler() { }