@CreditCardNumber throws PropertyNotFoundException on validation error

Description

Test an invalid credit card number:

Usage:

Result:

Environment

Java 1.7, Win7, Eclipse

Activity

Show:
Hardy Ferentschik
March 24, 2014, 7:27 PM

OK great, that works!

Great. Good to know. We will fix the properties files for the next release. Thanks again for the bug report.

member sound
March 24, 2014, 2:07 PM

OK great, that works!

Hardy Ferentschik
March 21, 2014, 11:21 AM

Sorry, must be a misunderstanding, but you need to add the message for the LuhnCheck:

That's the one which fails as part of the validation.

member sound
March 21, 2014, 8:54 AM
Edited

I tried adding the following property, but I'm still getting the error logged:

So probably I'll just ignore the logging until next version.

Hardy Ferentschik
March 20, 2014, 7:27 PM
Edited

Actually, there result of the validation is correct. Check the returned Set of ConstraintValidation instances. If you look at the log, you see that this his a warning message.
The reason is actually, that the default resource bundle ValidationMessages.properties has an error in the message descriptor for LuhnCheck (in fact Mod10Check, Mod10Check and ModCheck have the same problem). The message is:

It should be:

LuhnCheck is relevant in this case, since it @CreditCard is implemented as composing constraint. Obviously we need to fix the messages (and maybe improve on the log message). For now you have several options:

  • Ignore the warning in the log (the result is correct)

  • Configure logging to ignore messages from this logger category: log4j.logger.org.hibernate.validator.internal.engine.messageinterpolation.InterpolationTerm=ERROR in case of Log4J

  • Add your own ValidationMessages.properties to the root of the classpath (in case you have not done so yet) and add:

Hope this helps for now and thanks for reporting this.

Fixed

Assignee

Hardy Ferentschik

Reporter

member sound