Actually, there result of the validation is correct. Check the returned {{Set}} of {{ConstraintValidation}} s 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:
{noformat} The check digit for ${value} is invalid, Luhn Modulo 10 checksum failed {noformat} It should be: {noformat} The check digit for ${validatedValue} is invalid, Luhn Modulo 10 checksum failed {noformat}
{{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: {noformat} The check digit for ${validatedValue} is invalid, Luhn Modulo 10 checksum failed {noformat}
Hope this helps for now and thanks for reporting this.
|