[hibernate-issues] [Hibernate-JIRA] Commented: (HV-182) Error when using composite constraints (wrong messages and stack traces)

Hardy Ferentschik (JIRA) noreply at atlassian.com
Tue Jul 14 07:48:12 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HV-182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33604#action_33604 ] 

Hardy Ferentschik commented on HV-182:
--------------------------------------

There were really two bugs in the code. One in the recursive traversal of the constraint tree. 
This was causing the wrong annotation type problem. 
The problem with the wrong interpolated message was a bug in ResourceBundleMessageInterpolator.
I added tests for both cases (including tests in the TCK for nested composed constraints)



> Error when using composite constraints (wrong messages and stack traces)
> ------------------------------------------------------------------------
>
>                 Key: HV-182
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-182
>             Project: Hibernate Validator
>          Issue Type: Bug
>          Components: engine
>            Reporter: Hardy Ferentschik
>            Assignee: Hardy Ferentschik
>             Fix For: 4.0.0.Beta2
>
>         Attachments: bv_issue.zip
>
>          Time Spent: 4 hours, 30 minutes
>  Remaining Estimate: 0 minutes
>
> i'm using the current snapshot of hibernate validator v4.
> constellation:
> composite constraint + @ReportAsSingleViolation
> on part of the composition is:
> @Size(min = 1, max = 10)
> the message of the composite constraint:
> the following sometimes leads to a wrong text:
> String message() default "my msg -- min: {min} max: {max}";
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> if i run the test-case multiple times (sometimes really really often) the following stacktrace shows up:
> java.lang.AssertionError: expected:<interface javax.validation.constraints.NotNull> but was:<interface javax.validation.constraints.Size>
>     at org.junit.Assert.fail(Assert.java:58)
>     at org.junit.Assert.failNotEquals(Assert.java:259)
>     at org.junit.Assert.assertEquals(Assert.java:80)
>     at org.junit.Assert.assertEquals(Assert.java:88)
>     at test.CompositeConstraintTest.invalidNickName(CompositeConstraintTest.java:26)
>     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.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
>     at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
>     at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
>     at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
>     at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
>     at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
>     at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
>     at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
>     at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
>     at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
>     at com.intellij.rt.junit4.Junit4ClassSuite.run(Junit4ClassSuite.java:99)
>     at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
> the bad thing is - i cannot always reproduce it - i run some junit test-cases - sometimes the interpolated message is ok and one test-run later (without source changes) it's something like that:
> my msg - min: my msg - min: {min} max: {max} max: my msg - min: {min} max: {max}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list