[hibernate-issues] [Hibernate-JIRA] Commented: (HV-573) Need graceful handling of return value constraint applied to method with void return type

Hardy Ferentschik (JIRA) noreply at atlassian.com
Tue Apr 10 02:30:50 EDT 2012


    [ https://hibernate.onjira.com/browse/HV-573?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46212#comment-46212 ] 

Hardy Ferentschik commented on HV-573:
--------------------------------------

I think _ConstraintDeclarationException_ is the right thing to do. Just logging an error seems to "weak".

> Need graceful handling of return value constraint applied to method with void return type
> -----------------------------------------------------------------------------------------
>
>                 Key: HV-573
>                 URL: https://hibernate.onjira.com/browse/HV-573
>             Project: Hibernate Validator
>          Issue Type: Bug
>            Reporter: Ron Sigal
>            Priority: Minor
>
> In Resteasy, I inadvertently created a method
> {code}
> @FooConstraint(min=3,max=5)
> public void postImposed(Foo foo){
> }
> {code}
> and got
> {noformat}
> java.lang.RuntimeException: Unhandled primitive type.
> 	at org.hibernate.validator.util.ReflectionHelper.boxedType(ReflectionHelper.java:722)
> 	at org.hibernate.validator.metadata.location.MethodConstraintLocation.typeOfAnnotatedElement(MethodConstraintLocation.java:74)
> 	at org.hibernate.validator.metadata.MetaConstraint.typeOfAnnotatedElement(MetaConstraint.java:92)
> 	at org.hibernate.validator.metadata.MetaConstraint.validateConstraint(MetaConstraint.java:82)
> 	at org.hibernate.validator.engine.ValidatorImpl.validateReturnValueForGroup(ValidatorImpl.java:1120)
> 	at org.hibernate.validator.engine.ValidatorImpl.validateReturnValueForGroup(ValidatorImpl.java:1082)
> 	at org.hibernate.validator.engine.ValidatorImpl.validateReturnValueInContext(ValidatorImpl.java:1022)
> 	at org.hibernate.validator.engine.ValidatorImpl.validateReturnValue(ValidatorImpl.java:245)
> 	at org.jboss.resteasy.plugins.providers.validation.GeneralValidatorImpl.validateReturnValue(GeneralValidatorImpl.java:71)
>         ...
> {noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list