Revision: 919
http://stripes.svn.sourceforge.net/stripes/?rev=919&view=rev
Author: bengunter
Date: 2008-05-21 05:54:03 -0700 (Wed, 21 May 2008)
Log Message:
-----------
STS-571: Do not return null if unable to handle the exception. Rethrow the
exception instead. Updated the javadoc comments to reflect this change.
Modified Paths:
--------------
trunk/stripes/src/net/sourceforge/stripes/exception/DefaultExceptionHandler.java
Modified:
trunk/stripes/src/net/sourceforge/stripes/exception/DefaultExceptionHandler.java
===================================================================
---
trunk/stripes/src/net/sourceforge/stripes/exception/DefaultExceptionHandler.java
2008-05-20 19:59:53 UTC (rev 918)
+++
trunk/stripes/src/net/sourceforge/stripes/exception/DefaultExceptionHandler.java
2008-05-21 12:54:03 UTC (rev 919)
@@ -182,24 +182,32 @@
* it forwards to the referer.
* </p>
* <p>
- * While this is a best effort, it won't be ideal for all situations.
Developers can extend this
- * class and override this method, delegating to the superclass when
necessary. If this method
- * is unable to handle the exception properly for any reason, it returns
null.
+ * While this is a best effort, it won't be ideal for all situations. If
this method is unable
+ * to handle the exception properly for any reason, it rethrows the
exception. Subclasses can
+ * call this method in a [EMAIL PROTECTED] try} block, providing
additional processing in the [EMAIL PROTECTED] catch}
+ * block.
* </p>
+ * <p>
+ * A simple way to provide a single, global error page for this type of
exception is to override
+ * [EMAIL PROTECTED]
#getFileUploadExceededExceptionPath(HttpServletRequest)} to return the path to
your
+ * global error page.
+ * <p>
*
* @param exception The exception that needs to be handled
* @param request The servlet request
* @param response The servlet response
- * @return Usually, a [EMAIL PROTECTED] Resolution} to forward to the page
from which this request was
- * submitted. If, for some reason, that can't be accomplished then
it returns null.
- * @throws ServletException
+ * @return A [EMAIL PROTECTED] Resolution} to forward to the path returned
by
+ * [EMAIL PROTECTED]
#getFileUploadExceededExceptionPath(HttpServletRequest)}
+ * @throws FileUploadLimitExceededException If
+ * [EMAIL PROTECTED]
#getFileUploadExceededExceptionPath(HttpServletRequest)} returns null or
+ * this method is unable for any other reason to forward to
the error page
*/
protected Resolution handle(FileUploadLimitExceededException exception,
- HttpServletRequest request, HttpServletResponse response) throws
ServletException {
+ HttpServletRequest request, HttpServletResponse response) throws
FileUploadLimitExceededException {
// Get the path to which we will forward to display the message
final String path = getFileUploadExceededExceptionPath(request);
if (path == null)
- return null;
+ throw exception;
// Create the ActionBean and ActionBeanContext
final ActionBeanContext context;
@@ -212,7 +220,7 @@
}
catch (ServletException e) {
log.error(e);
- return null;
+ throw exception;
}
// Try to guess the field name by finding exactly one FileBean field
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development