Hello,
Could you please decide if this patch should be applied.
The API for ServletContext mentions that a call to
getRequestDispatcher(String uri) will return null if the
uri is not found.
I was previusly only getting java.lang.NullPointerExceptions from line
1988 of ActionServlet. This was in no way helpful for me in finding the
real cause of the error, that being I had left off the '/' in front of
the
actions input attribute in the struts-config.xml file.
Cheers,
Nick
Index: share/org/apache/struts/action/ActionServlet.java
===================================================================
RCS file:
/home/cvspublic/jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java,v
retrieving revision 1.63
diff -c -r1.63 ActionServlet.java
*** share/org/apache/struts/action/ActionServlet.java 2001/03/11
02:50:10 1.63
--- share/org/apache/struts/action/ActionServlet.java 2001/03/12
01:37:18
***************
*** 2044,2049 ****
--- 2044,2058 ----
log(" Validation error(s), redirecting to: " + uri);
request.setAttribute(Action.ERROR_KEY, errors);
RequestDispatcher rd =
getServletContext().getRequestDispatcher(uri);
+ if ( rd == null ) {
+
+ if (debug >= 1)
+ log("Can not find a RequestDispatcher for " + uri + " for
this servlets context.");
+
+
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
+ internal.getMessage("invalidInput",
uri));
+ return (false);
+ }
rd.forward(request, response);
return (false);
Index: share/org/apache/struts/action/ActionResources.properties
===================================================================
RCS file:
/home/cvspublic/jakarta-struts/src/share/org/apache/struts/action/ActionResources.properties,v
retrieving revision 1.7
diff -c -r1.7 ActionResources.properties
*** share/org/apache/struts/action/ActionResources.properties
2001/03/11 02:50:10 1.7
--- share/org/apache/struts/action/ActionResources.properties
2001/03/12 01:37:32
***************
*** 11,16 ****
--- 11,17 ----
destroyDataSource=Exception destroying application data source {0}
finalizing=Finalizing this controller servlet
initDataSource=Exception initializing application data source {0}
+ invalidInput=Could not get a dispatcher to redirect to the input = {0}
for this action
mappingType=Must specify either "include" or "type" attribute for path
{0}
noInput=No input attribute for mapping path {0}
processInvalid=Invalid path {0} was requested