You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bval.apache.org by "Roman Stumm (JIRA)" <ji...@apache.org> on 2010/04/01 10:29:27 UTC

[jira] Resolved: (BVAL-12) Current implementation of method validation (appendix C of JSR-303) doesn't work with some constraints

     [ https://issues.apache.org/jira/browse/BVAL-12?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roman Stumm resolved BVAL-12.
-----------------------------

    Resolution: Fixed

I merged your code changes into the trunk

> 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
>            Assignee: Roman Stumm
>         Attachments: method-validation.diff, ParameterAccess.java, ReturnAccess.java
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> 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.