You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bval.apache.org by "Matt Benson (JIRA)" <ji...@apache.org> on 2016/10/20 22:21:59 UTC
[jira] [Resolved] (BVAL-105) Multiple use of
@ReportAsSingleViolation composing constraints on one bean leads to
internal RuntimeError
[ https://issues.apache.org/jira/browse/BVAL-105?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matt Benson resolved BVAL-105.
------------------------------
Resolution: Fixed
Fix Version/s: 1.1.2
Cannot reproduce with latest code. Closing as FIXED.
> 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: tinne
> Fix For: 1.1.2
>
>
> Given a composing validation annotation
> {code:title=ValidURLPattern.java}
> @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 {};
> }
> {code}
> attached to a bean several times
> {code:title=Bean.java}
> @lombok.Data
> public class Bean {
> @ValidURLPattern
> private String oneURL;
> @ValidURLPattern
> private String secondURL;
> [...]
> }
> {code}
> 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 was sent by Atlassian JIRA
(v6.3.4#6332)