11/*
2- * Copyright 2002-2013 the original author or authors.
2+ * Copyright 2002-2015 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.
3939 * and the {@link Ordered} implementation.
4040 *
4141 * @author Arjen Poutsma
42+ * @author Juergen Hoeller
4243 * @since 3.0
4344 */
4445public abstract class AbstractHandlerExceptionResolver implements HandlerExceptionResolver , Ordered {
@@ -67,40 +68,36 @@ public int getOrder() {
6768 }
6869
6970 /**
70- * Specify the set of handlers that this exception resolver should map.
71- * The exception mappings and the default error view will only apply
72- * to the specified handlers.
73- * <p>If no handlers set, both the exception mappings and the default error
74- * view will apply to all handlers. This means that a specified default
75- * error view will be used as fallback for all exceptions; any further
76- * HandlerExceptionResolvers in the chain will be ignored in this case.
71+ * Specify the set of handlers that this exception resolver should apply to.
72+ * <p>The exception mappings and the default error view will only apply to the specified handlers.
73+ * <p>If no handlers or handler classes are set, the exception mappings and the default error
74+ * view will apply to all handlers. This means that a specified default error view will be used
75+ * as a fallback for all exceptions; any further HandlerExceptionResolvers in the chain will be
76+ * ignored in this case.
7777 */
7878 public void setMappedHandlers (Set <?> mappedHandlers ) {
7979 this .mappedHandlers = mappedHandlers ;
8080 }
8181
8282 /**
8383 * Specify the set of classes that this exception resolver should apply to.
84- * The exception mappings and the default error view will only apply
85- * to handlers of the specified type; the specified types may be interfaces
86- * and superclasses of handlers as well.
87- * <p>If no handlers and handler classes are set, the exception mappings
88- * and the default error view will apply to all handlers. This means that
89- * a specified default error view will be used as fallback for all exceptions;
90- * any further HandlerExceptionResolvers in the chain will be ignored in
91- * this case.
84+ * <p>The exception mappings and the default error view will only apply to handlers of the
85+ * specified types; the specified types may be interfaces or superclasses of handlers as well.
86+ * <p>If no handlers or handler classes are set, the exception mappings and the default error
87+ * view will apply to all handlers. This means that a specified default error view will be used
88+ * as a fallback for all exceptions; any further HandlerExceptionResolvers in the chain will be
89+ * ignored in this case.
9290 */
93- public void setMappedHandlerClasses (Class <?>[] mappedHandlerClasses ) {
91+ public void setMappedHandlerClasses (Class <?>... mappedHandlerClasses ) {
9492 this .mappedHandlerClasses = mappedHandlerClasses ;
9593 }
9694
9795 /**
98- * Set the log category for warn logging. The name will be passed to the
99- * underlying logger implementation through Commons Logging, getting
100- * interpreted as log category according to the logger's configuration.
101- * <p>Default is no warn logging. Specify this setting to activate
102- * warn logging into a specific category. Alternatively, override
103- * the {@link #logException} method for custom logging.
96+ * Set the log category for warn logging. The name will be passed to the underlying logger
97+ * implementation through Commons Logging, getting interpreted as a log category according
98+ * to the logger's configuration.
99+ * <p>Default is no warn logging. Specify this setting to activate warn logging into a specific
100+ * category. Alternatively, override the {@link #logException} method for custom logging.
104101 * @see org.apache.commons.logging.LogFactory#getLog(String)
105102 * @see org.apache.log4j.Logger#getLogger(String)
106103 * @see java.util.logging.Logger#getLogger(String)
@@ -183,8 +180,7 @@ protected boolean shouldApplyTo(PortletRequest request, Object handler) {
183180 /**
184181 * Log the given exception at warn level, provided that warn logging has been
185182 * activated through the {@link #setWarnLogCategory "warnLogCategory"} property.
186- * <p>Calls {@link #buildLogMessage} in order to determine the concrete message
187- * to log. Always passes the full exception to the logger.
183+ * <p>Calls {@link #buildLogMessage} in order to determine the concrete message to log.
188184 * @param ex the exception that got thrown during handler execution
189185 * @param request current portlet request (useful for obtaining metadata)
190186 * @see #setWarnLogCategory
@@ -193,19 +189,18 @@ protected boolean shouldApplyTo(PortletRequest request, Object handler) {
193189 */
194190 protected void logException (Exception ex , PortletRequest request ) {
195191 if (this .warnLogger != null && this .warnLogger .isWarnEnabled ()) {
196- this .warnLogger .warn (buildLogMessage (ex , request ), ex );
192+ this .warnLogger .warn (buildLogMessage (ex , request ));
197193 }
198194 }
199195
200196 /**
201- * Build a log message for the given exception, occured during processing
202- * the given request.
197+ * Build a log message for the given exception, occurred during processing the given request.
203198 * @param ex the exception that got thrown during handler execution
204199 * @param request current portlet request (useful for obtaining metadata)
205200 * @return the log message to use
206201 */
207202 protected String buildLogMessage (Exception ex , PortletRequest request ) {
208- return "Handler execution resulted in exception" ;
203+ return "Handler execution resulted in exception: " + ex ;
209204 }
210205
211206
0 commit comments