dgraham 2003/07/11 17:06:01
Modified: src/share/org/apache/struts/tiles/actions
DefinitionDispatcherAction.java
Log:
Use commons-logging to record error messages instead of printing them to
the response.
Revision Changes Path
1.8 +20 -35
jakarta-struts/src/share/org/apache/struts/tiles/actions/DefinitionDispatcherAction.java
Index: DefinitionDispatcherAction.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/tiles/actions/DefinitionDispatcherAction.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DefinitionDispatcherAction.java 11 Jul 2003 23:57:15 -0000 1.7
+++ DefinitionDispatcherAction.java 12 Jul 2003 00:06:01 -0000 1.8
@@ -84,7 +84,7 @@
* that is named by the request parameter whose name is specified
* by the <code>parameter</code> property of the corresponding
* ActionMapping.
- * This action is usefull in following situations :
+ * This action is useful in following situations:
* <li>
* <ul>To associate an Url to a definition</ul>
* <ul>To use Struts <html:link> tag on a definition</ul>
@@ -149,13 +149,9 @@
// Identify the method name to be dispatched to
String name = request.getParameter(parameter);
if (name == null) {
- String msg =
- "Definition dispatcher action : can't get parameter '"
- + parameter
- + "'.";
-
- printError(response, msg);
- return null;
+ log.error("Can't get parameter '" + parameter + "'.");
+
+ return mapping.findForward("error");
}
// Try to dispatch to requested definition
@@ -168,39 +164,25 @@
getServlet().getServletContext());
if (log.isDebugEnabled()) {
- log.debug("get Definition " + definition);
+ log.debug("Get Definition " + definition);
}
DefinitionsUtil.setActionDefinition(request, definition);
- } catch (FactoryNotFoundException ex) {
- printError(
- response,
- "Error - DefinitionDispatcherAction : Can't get definition
factory.");
+ } catch (FactoryNotFoundException e) {
+ log.error("Can't get definition factory.", e);
return mapping.findForward("error");
- } catch (NoSuchDefinitionException ex) {
- printError(
- response,
- "Error - DefinitionDispatcherAction : Can't get definition '"
- + name
- + "'.");
+ } catch (NoSuchDefinitionException e) {
+ log.error("Can't get definition '" + name + "'.", e);
return mapping.findForward("error");
- } catch (DefinitionsFactoryException ex) {
- printError(
- response,
- "Error - DefinitionDispatcherAction : General Factory error '"
- + ex.getMessage()
- + "'.");
+ } catch (DefinitionsFactoryException e) {
+ log.error("General Factory error '" + e.getMessage() + "'.", e);
return mapping.findForward("error");
- } catch (Exception ex) {
- printError(
- response,
- "Error - DefinitionDispatcherAction : General error '"
- + ex.getMessage()
- + "'.");
+ } catch (Exception e) {
+ log.error("General error '" + e.getMessage() + "'.", e);
return mapping.findForward("error");
}
@@ -208,6 +190,9 @@
}
+ /**
+ * @deprecated This will be removed after Struts 1.2.
+ */
protected void printError(HttpServletResponse response, String msg)
throws IOException {
response.setContentType("text/plain");
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]