Current implementation of method validation (appendix C of JSR-303) doesn't
work with some constraints
------------------------------------------------------------------------------------------------------
Key: BVAL-12
URL: https://issues.apache.org/jira/browse/BVAL-12
Project: BeanValidation
Issue Type: Improvement
Components: jsr303
Affects Versions: 0.1-incubating
Reporter: Carlos Vara
The methods processAnnotation and processAnnotations in
MethodValidatorMetaBeanFactory don't have enough information to infer the the
parameter/return value types, so they default to the type of the class that
contains the methods. Because of this, the selection of the correct validator
throws an exception (for example with a @Size constraint), or works in a
suboptimal manner (it always selects NotEmptyValidator instead of for example
NotEmptyValidatorForString when validating a String).
To fix it, I have created two new AccessStrategies (ParameterAccess and
ReturnAccess), and modified the processAnnotation and processAnnotations
signatures to take the strategies as parameters so they can pass them to the
Jsr303MetaBeanFactory.applyConstraint method (which at the moment receives a
null).
I attach the fix, along with a few more tests that check that constraints such
as @Size or @Pattern can be applied to method parameters and return types.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.