Hi,
There's a saveErrors method in Struts 1.2.2 that takes an
ActionMessages object. This can cause a ClassCastException in
getErrors and addErrors, which expects an ActionErrors object.
I've added a patch, which would solve this issue. I'm a bit confused
if the use of ActionErrors is deprecated in 1.2. I think ActionError
is, but what about ActionErrors?
Thanks,
Alwin
Index: Action.java
===================================================================
RCS file: /home/cvspublic/jakarta-
struts/src/share/org/apache/struts/action/Action.java,v
retrieving revision 1.76
diff -u -r1.76 Action.java
--- Action.java 26 Jun 2004 00:36:22 -0000 1.76
+++ Action.java 1 Sep 2004 18:34:32 -0000
@@ -255,7 +255,7 @@
*/
protected void addErrors(
HttpServletRequest request,
- ActionErrors errors) {
+ ActionMessages errors) {
if (errors == null){
// bad programmer! *slap*
@@ -263,9 +263,9 @@
}
// get any existing errors from the request, or make a new one
- ActionErrors requestErrors = (ActionErrors)
request.getAttribute(Globals.ERROR_KEY);
+ ActionMessages requestErrors = (ActionMessages)
request.getAttribute(Globals.ERROR_KEY);
if (requestErrors == null){
- requestErrors = new ActionErrors();
+ requestErrors = new ActionMessages();
}
// add incoming errors
requestErrors.add(errors);
@@ -337,11 +337,11 @@
* @param request The servlet request we are processing
* @since Struts 1.2.1
*/
- protected ActionErrors getErrors(HttpServletRequest request) {
- ActionErrors errors =
- (ActionErrors) request.getAttribute(Globals.ERROR_KEY);
+ protected ActionMessages getErrors(HttpServletRequest request) {
+ ActionMessages errors =
+ (ActionMessages)
request.getAttribute(Globals.ERROR_KEY);
if (errors == null) {
- errors = new ActionErrors();
+ errors = new ActionMessages();
}
return errors;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]