Errors occured on null or not present indexed properties if required parameter
is used within @ValidateNestedProperties
-----------------------------------------------------------------------------------------------------------------------
Key: STS-868
URL: http://www.stripesframework.org/jira/browse/STS-868
Project: Stripes
Issue Type: Bug
Components: Validation
Affects Versions: Release 1.5.6
Reporter: Haggi
Priority: Critical
Attachments: DefaultActionBeanPropertyBinder.java,
DefaultValidationMetadataProvider.java, ValidationMetadata.java
If you use the @ValidateNestedProperties annotation and some of your nested
properties are required, you will get validation errors even the index property
is null or not present in the request.
The Documentation at
http://www.stripesframework.org/display/stripes/Indexed+Properties says:
{quote}
.. Required field validations are only applied if at least one value with the
same index was supplied. To understand this it is easier to think of indexed
properties as a mechanism for creating multi-row forms. And this change means
that rows in the form that are completely empty are ignored.
{quote}
The nested validation below whould raise a validation error "name is required"
even the indexed property books is not present in the request (null).
{code}
@ValidateNestedProperties({
@Validate(field = "name", required = true, maxlength = 100),
@Validate(field = "description", maxlength = 255)
})
private List<Book> books;
{code}
I fixed this problem and attached the modified classes.
@BenGunter: is the stripes project dead??
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development