struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dimitri Valdin" <>
Subject Re: Weirdness/possible bug in Validator dependencies
Date Thu, 18 Jul 2002 15:47:02 GMT
Hallo (David)

>I just looked at the code and it looks like I broke
>backwards compatibility when I added the methods that
>return objects instead of boolean values.  The
>validateDate method used to default to true and only
>validate the field if it wasn't blank or null.  So if
>the field was blank, date validation was skipped but
>'true' was returned so an error message wasn't
>generated.  Now the method returns null which is being
>interpretted as a failure so an error message is being
>created.  We might need to remove this functionality
>for now and just use the boolean methods at least
>until after the Struts 1.1 release.  I'll think if
>there are any other ways to do this and keep it
>backwards compatible.

Please don't do that :-) Let the functions return objects.
Just return null in case nothing is entered in the input field.
The validator date should not depends on required at that case.
I think, that it would be not bad to remove this required dependency
for other types as well, so user can have an option to enter
non-obligatory field, but if it does so, then the field will be checked.
Let me know your opinion about it.

The problem pointed out by James problem can be easily fixed if the block
in StrutsValidator.validateDate

            if (result == null) {
                errors.add(field.getKey(), StrutsValidatorUtil.getActionError(request, va,

would be moved into

if (!GenericValidator.isBlankOrNull(value)) {



Dmitri Valdin


Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie
nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren
Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie
die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended
recipient (or have received this e-mail in error) please notify the sender immediately and
destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material
in this e-mail is strictly forbidden.

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

View raw message