<Mick.Knutson <at> wellsfargo.com> writes: > > With the new version of Struts, we are getting a NullPointerException whenever custom rules are being run > because they are expecting a parameter list of: > > Object Bean, > ValidatorAction va, > Field field, > ActionErrors errors, > org.apache.commons.validator.Validator validator, > HttpServletRequest request > > and the ActionErrors.errors object is being sent in as null. This did not happen in struts 1.1 > > Has the custom error handling for Struts changed in the new version? > > Here are some of our rules: > ========================= > > <validator name="dateIsPast" > classname="com.wf.bd.ice.rules.validation.ICEFieldChecks" > method="validateDateIsPast" > methodParams="java.lang.Object, > org.apache.commons.validator.ValidatorAction, > org.apache.commons.validator.Field, > org.apache.struts.action.ActionErrors, > org.apache.commons.validator.Validator, > javax.servlet.http.HttpServletRequest" > msg="errors.dateIsPast"> > </validator> > > And here is the Java Class: > ====================== > public static boolean validateDateIsPast( > Object bean, ValidatorAction va, Field field, ActionErrors errors, > org.apache.commons.validator.Validator validator, > HttpServletRequest request > ) { > <snip> > > } > > -------------------- > Mick Knutson > Wells Fargo Business Direct Information Systems > (415) 222-1020 > --------------------
Mick, I noticed the same thing with our custom validator the other day. My solution was to: 1. Use org.apache.struts.action.ActionMessages instead of org.apache.struts.action.ActionErrors in the validator/@methodParams 2. Change your custom validator's method signature to use ActionMessages instead of ActionErrors. Best, Tim --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]