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:19:27 UTC

[jira] Issue Comment Edited: (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:comment-tabpanel&focusedCommentId=12852283#action_12852283 ] 

Roman Stumm edited comment on BVAL-12 at 4/1/10 8:18 AM:
---------------------------------------------------------

HI Carlos,

thanks for the improvements! I will have a closer look at them these days. But, you know what? I never took my experiments with method-level-validation seriously. It was just a trial implementation, to see, how much effort the real thing would be (and because i did not see such features in the reference implementation ;-) )  So I am not surprised, that it does not yet work properly. Also there have to be much more tests of it.

Bye,
Roman 

      was (Author: romanstumm):
    HI Carlos,

thanks for the improvements! I will have a closer look at them these days. But, you know what? I never took my experiments with method-level-validation seriously. It was just a trial implementation, to see, how much effort the real thing would be (and because i did not see such features in the reference implementation ;-) )  So I am not surprised, that it does not yet work properly. Also there have to be much more tests of it.

Besides: i never checked the test coverage of the project so far. Would be nice if someone could help here with the configuration of a maven-plugin to see, where additional tests are missing.

Bye,
Roman 
  
> 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.