Karsten Tinnefeld created BVAL-105:
--------------------------------------

             Summary: Multiple use of @ReportAsSingleViolation composing 
constraints on one bean leads to internal RuntimeError
                 Key: BVAL-105
                 URL: https://issues.apache.org/jira/browse/BVAL-105
             Project: BVal
          Issue Type: Bug
          Components: jsr303
    Affects Versions: 0.4
         Environment: Win 7 64-Bit Java 1.6.0_30 
            Reporter: Karsten Tinnefeld


Given a composing validation annotation


@Pattern(regexp = ".*\\$1.*")
@ReportAsSingleViolation
@Constraint(validatedBy = {})
@Documented
@Retention(RUNTIME)
@Target({ ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER })
public @interface ValidURLPattern {

    String message() default "{path.to.ValidURLPattern.message}";

    Class < ? >[] groups() default {};

    Class < ? extends Payload >[] payload() default {};
}


attached to a bean several times 


@lombok.Data
public class Bean {

    @ValidURLPattern
    private String oneURL;

    @ValidURLPattern
    private String secondURL;

[...]
}


validating a bean containing null in both URLs yields a spurious validation 
error on one field, by adding up to _n_ fields, _n - 1_ errors are displayed.

I tracked down to ConstraintValidation.validate(GroupValidationContext<?>), 
where a runtime error is thrown somewhere in the iteration over 
getComposingValidations(), and then gave up.

On removal of @ReportAsSingleViolation, the error disappeared.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to