You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Brown, Melonie S. - Contractor" <Me...@forscom.army.mil> on 2003/05/28 15:45:38 UTC

Possible Validator Bug

I created a custom validator and thought that I had everything configured
properly, but couldn't get it to work.  Since I was using an "older" version
of Struts (December/January), I downloaded the latest nightly build. 

I then started getting the following error:
ERROR Date = 2003-05-28 09:35:46,489 [Thread-5]
org.apache.commons.validator.Validator Line = 471 - reflection:
foo.SecurePasswordValidator.validateComplexPassword()
 java.lang.NoSuchMethodException:
foo.SecurePasswordValidator.validateComplexPassword()
	at java.lang.Class.getMethod0(Class.java:1756)
	at java.lang.Class.getMethod(Class.java:963)
	at
org.apache.commons.validator.Validator.executeValidationMethod(Validator.jav
a:448)
	at
org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:3
71)
	at
org.apache.commons.validator.Validator.validateField(Validator.java:616)
	at
org.apache.commons.validator.Validator.validate(Validator.java:696)
	at
org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:152)


It is correct that I do not have a validateComplexPassword() - 

I have validateComplexPassword(Object bean,
        ValidatorAction va,
        Field field,
        ActionErrors errors,
        HttpServletRequest request)

In my validator rules, I specified the following.  

<validator name="complexpassword"
     classname="foo.SecurePasswordValidator"
     method="validateComplexPassword"
     methodparams="java.lang.Object,
                   org.apache.commons.validator.ValidatorAction,
                   org.apache.commons.validator.Field,
                   org.apache.struts.action.ActionErrors,
                   javax.servlet.http.HttpServletRequest" 
     msg="errors.changepasswordnotfollowrules">
     </validator>

I added a method with no parameters for test purposes, and that's the method
that gets called during validation.

Why would the method with no parameters be called when I specifically set
parameters?  Is this a bug or feature? 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org