[bv-dev] Sanity check
Matt Benson
mbenson at apache.org
Tue Jun 5 11:45:22 EDT 2012
On Tue, Jun 5, 2012 at 9:56 AM, Emmanuel Bernard <emmanuel at hibernate.org> wrote:
> I was working in the ConstraintValidatorContext area and I think Example 3.16. Use of ConstraintValidatorContext was basically wrong.
> It seems to me that we were able to return false without creating any ConstraintViolation context.
>
> I have create a JIRA https://hibernate.onjira.com/browse/BVAL-296 and a pull request https://github.com/beanvalidation/beanvalidation-spec/pull/7
>
> Can someone double check to make sure I did not have hallucination.
First hallucination: In spec v1.0, this is example 2.16, not 3.16!
;) Was a chapter added?
It actually looks to me like this method cannot return false without
having created a ConstraintViolation, but rather that it may return
true while still having created a ConstraintViolation. Your fix
appears to be quite close; however since you have created a second
block describing a negative result, you should no longer negate the
Collections.disjoint(): "if there are no allowed formats or there are
no elements in common (disjoint) between the allowed and guessed
formats."
Other nits:
* the method described is guessFormats(); the calls in the isValid()
code lack the trailing 's'.
* no need for the second if block to re-call guessFormats(); reuse
the local 'guessFormats' variable already assigned to the result of
the method call.
Matt
>
> Emmanuel
> _______________________________________________
> beanvalidation-dev mailing list
> beanvalidation-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
More information about the beanvalidation-dev
mailing list