bval-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carlos Vara (JIRA)" <j...@apache.org>
Subject [jira] Updated: (BVAL-12) Current implementation of method validation (appendix C of JSR-303) doesn't work with some constraints
Date Wed, 31 Mar 2010 18:19:27 GMT

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

Carlos Vara updated BVAL-12:
----------------------------

    Attachment: ReturnAccess.java
                ParameterAccess.java
                method-validation.diff

FIx for the issue

> 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
>         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.


Mime
View raw message