From 9e03e0e73d53c4a6e077856aa00792493b2d0d4d Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 15 Dec 2015 11:53:40 +0100 Subject: [PATCH] Polishing --- .../support/IdTransferringMergeEventListener.java | 2 +- .../AnnotationMethodHandlerExceptionResolver.java | 10 ++++++---- .../AnnotationMethodHandlerExceptionResolver.java | 11 +++++++---- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/IdTransferringMergeEventListener.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/IdTransferringMergeEventListener.java index c83b5e0501..c87e46c5b3 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/IdTransferringMergeEventListener.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/IdTransferringMergeEventListener.java @@ -49,7 +49,7 @@ import org.hibernate.persister.entity.EntityPersister; * @since 1.2 * @see org.springframework.orm.hibernate3.LocalSessionFactoryBean#setEventListeners(java.util.Map) */ -@SuppressWarnings({ "serial", "rawtypes", "deprecation" }) +@SuppressWarnings({"serial", "rawtypes", "deprecation"}) public class IdTransferringMergeEventListener extends DefaultMergeEventListener { /** diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java index 31e1b86db5..765dfa67c0 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java @@ -75,9 +75,11 @@ import org.springframework.web.servlet.View; */ public class AnnotationMethodHandlerExceptionResolver extends AbstractHandlerExceptionResolver { - // dummy method placeholder - private static final Method NO_METHOD_FOUND = - ClassUtils.getMethodIfAvailable(System.class, "currentTimeMillis", (Class[]) null); + /** + * Arbitrary {@link Method} reference, indicating no method found in the cache. + */ + private static final Method NO_METHOD_FOUND = ClassUtils.getMethodIfAvailable(System.class, "currentTimeMillis"); + private final Map, Map, Method>> exceptionHandlerCache = new ConcurrentHashMap, Map, Method>>(64); @@ -210,7 +212,7 @@ public class AnnotationMethodHandlerExceptionResolver extends AbstractHandlerExc /** * Uses the {@link ExceptionDepthComparator} to find the best matching method. - * @return the best matching method or {@code null}. + * @return the best matching method, or {@code null} if none found */ private Method getBestMatchingMethod( Map, Method> resolverMethods, Exception thrownException) { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java index 7c2568b249..70a5970213 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java @@ -88,8 +88,11 @@ import org.springframework.web.servlet.support.RequestContextUtils; @Deprecated public class AnnotationMethodHandlerExceptionResolver extends AbstractHandlerExceptionResolver { - // dummy method placeholder - private static final Method NO_METHOD_FOUND = ClassUtils.getMethodIfAvailable(System.class, "currentTimeMillis", (Class[]) null); + /** + * Arbitrary {@link Method} reference, indicating no method found in the cache. + */ + private static final Method NO_METHOD_FOUND = ClassUtils.getMethodIfAvailable(System.class, "currentTimeMillis"); + private final Map, Map, Method>> exceptionHandlerCache = new ConcurrentHashMap, Map, Method>>(64); @@ -234,8 +237,8 @@ public class AnnotationMethodHandlerExceptionResolver extends AbstractHandlerExc } /** - * Uses the {@link DepthComparator} to find the best matching method - * @return the best matching method or {@code null}. + * Uses the {@link ExceptionDepthComparator} to find the best matching method. + * @return the best matching method, or {@code null} if none found */ private Method getBestMatchingMethod( Map, Method> resolverMethods, Exception thrownException) {