bval-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Donald Woods (JIRA)" <>
Subject [jira] Resolved: (BVAL-88) Cascaded validation adds a constraint violation for valid child property
Date Thu, 03 Feb 2011 16:30:29 GMT


Donald Woods resolved BVAL-88.

    Resolution: Fixed

Closing for now, as the included patch still passes the TCK.
Please open a new issue if you want to us to try and challenge the TCK or create an updated
patch that passes with the current TCK.

> Cascaded validation adds a constraint violation for valid child property
> ------------------------------------------------------------------------
>                 Key: BVAL-88
>                 URL:
>             Project: BeanValidation
>          Issue Type: Bug
>    Affects Versions: 0.2-incubating
>            Reporter: Chris Ey
>            Assignee: Donald Woods
>             Fix For: 0.3-incubating
>         Attachments: BVAL-88-unittest-cey.patch, BVAL-88.patch, BVAL-88drw.patch
> Precondition: 
> Parent bean (call it 'Department') has an invalid property, say, "description" annotated
with @NotEmpty and value is null. 
> Department also has a valid child element, say, Person manager, which itself has a name.
Manager is annotated with @Valid and @NotNull, and name is annotated with @NotEmpty. Both
manager and name are correctly populated with non null values:
> Department {
>     @NotEmpty
>     String description;
>     @NotNull;
>     @Valid
>     Person manager;
> }
> Person {
>     @NotEmpty
>     String name;
> }
> Values:
> Department.description: Intentionally left empty (to cause a constraint violation)
> Department.manager: new Person()
> "Valid Value"
> Action:
> Department is validated using bean validation.
> Expected:
> 1 Constraint violation:
> empty Department.description
> Actual:
> 2 Constraint violations:
> empty Department.description
> empty
> I debugged a bit and it seems like when traversing down to Person's properties, it somehow
switches into (isReportsAsSingleViolation() == true) path (,
then it sets failed = true in line 171, because the context does have violations (caused previously
by Department.description). But failed should apparently stay false, because there was no
/new/ error caused by Person.
> Nevertheless, a new ConstraintViolation gets added in line 183 because failed was true
(while it shouldn't be).

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message