bval-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Romain Manni-Bucau (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (BVAL-107) Validation of Return-Values
Date Mon, 25 Jun 2012 11:41:43 GMT

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

Romain Manni-Bucau updated BVAL-107:
------------------------------------

    Attachment: bval.zip

Attached a maven project with a unit test reproducing the issue


here the exception:


javax.validation.ValidationException: error retrieving constraints for class org.apache.bval.issue.ReturnValueTest$Validatable
	at org.apache.bval.jsr303.ClassValidator.getConstraintsForClass(ClassValidator.java:266)
	at org.apache.bval.jsr303.extensions.MethodValidatorImpl.validateReturnedValue(MethodValidatorImpl.java:147)
	at org.apache.bval.issue.ReturnValueTest.failling(ReturnValueTest.java:14)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: javax.validation.ValidationException: Property foo does not follow javabean conventions.
	at org.apache.bval.jsr303.Jsr303MetaBeanFactory.processClass(Jsr303MetaBeanFactory.java:162)
	at org.apache.bval.jsr303.Jsr303MetaBeanFactory.buildMetaBean(Jsr303MetaBeanFactory.java:95)
	at org.apache.bval.MetaBeanBuilder.buildForClass(MetaBeanBuilder.java:131)
	at org.apache.bval.MetaBeanManager.findForClass(MetaBeanManager.java:102)
	at org.apache.bval.jsr303.ClassValidator.getConstraintsForClass(ClassValidator.java:258)
	... 28 more

                
> Validation of Return-Values
> ---------------------------
>
>                 Key: BVAL-107
>                 URL: https://issues.apache.org/jira/browse/BVAL-107
>             Project: BVal
>          Issue Type: Bug
>          Components: jsr303
>    Affects Versions: 0.4
>         Environment: JDK 1.6, Windows, Eclipse 3.7
>            Reporter: Sascha Vujevic
>         Attachments: ValidationTest.jar, bval.zip
>
>
> In the Test i have attached i have a @Size-Constraint on a method for validation of the
returnvalue. In version 0.3 of bval-jsr303 it worked.
> In version 0.4 there is a change in the code:
> The method org.apache.bval.jsr303.extensions.patchFactoryContextForMethodValidation is
no longer activ. Therefore all Jsr303MetaBeanFactory were no longer changed to MethodValidatorMetaBeanFactory.
> This has the affect that the method hasValidationConstraintsDefined() is used from Jsr303MetaBeanFactory
which checks if there is a Constraint on the Method. If it is, a exception is thrown "Property
%myMethod% does not follow javabean conventions".
> Mayby i use the annotions for validating returnvalues in a wrong way.
> I have attached an example.
> Thank you for your help.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message