-->
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.  [ 2 posts ] 
Author Message
 Post subject: "{value}" is not replaced in the error message
PostPosted: Fri Aug 20, 2010 7:06 pm 
Regular
Regular

Joined: Fri Mar 26, 2004 11:45 am
Posts: 75
Hello,

I am using Hibernate Validator 4.0.1GA to validate an email address. Here is my code:
@Column(nullable = false)
@Email
private String email;

Here is the error message that gets logged:
"{value}" is not a valid email address

What do I need to do to get "{value}" replaced with the email address that failed validation?

Thanks.


Top
 Profile  
 
 Post subject: Re: "{value}" is not replaced in the error message
PostPosted: Sun Aug 22, 2010 7:33 am 
Hibernate Team
Hibernate Team

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

${value} is actually not a token which can get replaced. The validated values is not available for message interpolation. You could write your own MessageInterpolator. The interpolate methods in this interface take both a MessageInterpolator.Context instance which gives you access to the interpolated value. See also - HV-358. The Bean Validation specification does not support the value interpolation.

Regarding the message you are seeing now. I remember that in some earlier version of Validator there were errors in the message templates. Make sure to use a more up to date version of Hibernate Validator, eg 4.1.0.Final

--Hardy


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.