-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: MessageInterpolation bug? in Validator 4
PostPosted: Tue Nov 24, 2009 4:49 am 
Newbie

Joined: Tue Nov 24, 2009 4:31 am
Posts: 2
Hi there,

I've noticed a strage behaviour of Message Interpolation in Hibernate Validator 4.0.2.GA.
I Have a bean mapping
Code:

<bean class="testBean" ignore-annotations="true">
        <field name="testField">
            <constraint annotation="javax.validation.constraints.NotNull">
                <message>javax.validation.constraints.NotNull.message</message>
            </constraint>           
        </field>
</bean>



and a ValidationMessages.properties
Code:
javax.validation.constraints.NotNull.message=testMessage


when I start the test the message is not interpolated and I receive javax.validation.constraints.NotNull.message as I call
violationSet.iterator().next().getMessage()

If I delete the <message> definition from the bean mapping, I receive the message I expect(testMessage). So the Message bundle is found. It seems that if the <message> attribute is defined then no message interpolation is started.
Can anybody confirm this?

Many thanks


Top
 Profile  
 
 Post subject: Re: MessageInterpolation bug? in Validator 4
PostPosted: Wed Nov 25, 2009 8:32 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

you are missing the curly braces for indicating message parameters:

Code:
<bean class="testBean" ignore-annotations="true">
        <field name="testField">
            <constraint annotation="javax.validation.constraints.NotNull">
                <message>{javax.validation.constraints.NotNull.message}</message>
            </constraint>           
        </field>
</bean>


Top
 Profile  
 
 Post subject: Re: MessageInterpolation bug? in Validator 4
PostPosted: Thu Nov 26, 2009 6:24 am 
Newbie

Joined: Tue Nov 24, 2009 4:31 am
Posts: 2
Thank you hardy!

it was the mistake.

Thanks again!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.