commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton" <>
Subject Re: Commons validator error
Date Sat, 10 Nov 2007 00:07:53 GMT
On Nov 9, 2007 4:47 PM, Nuno Martins <> wrote:
> Hi all,
> I'm developing a commons-validator (with struts) standalone application.

Not sure what you mean by "standalone" and "with Struts". Are you
using the standard built-in Struts validation? From the error below I
guess not - I can only see one way this could have happened:

1) A "null" reference was passed to the validateMask() method where it
expected an "ActionMessages" object.
2) The "null"  ActionMessages caused a "NullPointerException" to be
thrown on line 235 of FieldChecks in the validateMask() method (where
it tries to add a message to the ActionMessages object).
3) That NullPointerException was caught by the try/catch block in the
validateMask() method so it called the processFailure() method.
4) The processFailure() method logged the message "mask validation
failed for property xpto: java.lang.NullPointerException"
5) The processFailure() threw another NullPointerException on line
1323 when it tried to add a message to ActionMessages
6) ValidatorAction caught the 2nd NullPointerException and logged the
message "Unhandled exception thrown during validation: null"  + stack

Perhaps I'm wrong, but this is the only explanation I can see. If I am
right then it looks like you are not using the standard build-in
Struts validation and the problem is you haven't configured the
"Validator" instance you're using with an ActionMessages object.
Fixing that issue should resolve the problem - something like:

validator.setParameter(ACTION_MESSAGES_PARAM, errors);

Best place to look on initializing Validator is in the validate()
method of ValidatorForm[1] and initValidator() method of Resources[2]



> Since  using  new versions 1.3.1 (commons-validator) and 1.3.9 (struts),
> an error occurred.
> [WARN ][2007-11-09
> 16:43:17,039][org.apache.struts.util.PropertyMessageResources]:
> Resource org/apache/struts/validator/ Not
> Found.
> [WARN ][2007-11-09
> 16:43:17,039][org.apache.struts.util.PropertyMessageResources]:
> Resource org/apache/struts/validator/ Not Found.
> [ERROR][2007-11-09
> 16:43:17,041][org.apache.struts.validator.FieldChecks]: mask validation
> failed for property xpto: java.lang.NullPointerException
> [ERROR][2007-11-09
> 16:43:17,043][org.apache.commons.validator.ValidatorAction]: Unhandled
> exception thrown during validation: null
> java.lang.NullPointerException
>     at
> org.apache.struts.validator.FieldChecks.processFailure(
>     at
> org.apache.struts.validator.FieldChecks.validateMask(
> Any ideia?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message