Issue Type: Bug Bug
Affects Versions: 4.3.0.Final
Assignee: Unassigned
Components: validators
Created: 25/Oct/12 7:27 PM
Description:

In 4.3, EmailValidator was updated to pass the value through IDN.toAscii before applying the regular expression. The Javadocs for IDN.toAscii document a set of cases which can result in an IllegalArgumentException being thrown, but EmailValidator does not attempt to catch that exception. As a result, in certain circumstances, rather than returning false the validator throws an exception. That, in turn, results in this:

javax.validation.ValidationException: HV000028: Unexpected exception during isValid call.
	at org.hibernate.validator.internal.engine.ConstraintTree.validateSingleConstraint(ConstraintTree.java:294) ~[hibernate-validator-4.3.0.Final.jar:4.3.0.Final]
	at org.hibernate.validator.internal.engine.ConstraintTree.validateConstraints(ConstraintTree.java:164) ~[hibernate-validator-4.3.0.Final.jar:4.3.0.Final]
	at org.hibernate.validator.internal.engine.ConstraintTree.validateConstraints(ConstraintTree.java:125) ~[hibernate-validator-4.3.0.Final.jar:4.3.0.Final]
	at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:86) ~[hibernate-validator-4.3.0.Final.jar:4.3.0.Final]
	at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:442) ~[hibernate-validator-4.3.0.Final.jar:4.3.0.Final]
	at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:387) ~[hibernate-validator-4.3.0.Final.jar:4.3.0.Final]
	at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:351) ~[hibernate-validator-4.3.0.Final.jar:4.3.0.Final]
	at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:303) ~[hibernate-validator-4.3.0.Final.jar:4.3.0.Final]
	at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:133) ~[hibernate-validator-4.3.0.Final.jar:4.3.0.Final]
Caused by: java.lang.IllegalArgumentException: The label in the input is too long
	at java.net.IDN.toASCIIInternal(IDN.java:298) ~[na:1.6.0_34]
	at java.net.IDN.toASCII(IDN.java:101) ~[na:1.6.0_34]
	at java.net.IDN.toASCII(IDN.java:127) ~[na:1.6.0_34]
	at org.hibernate.validator.internal.constraintvalidators.EmailValidator.isValid(EmailValidator.java:45) ~[hibernate-validator-4.3.0.Final.jar:4.3.0.Final]
	at org.hibernate.validator.internal.constraintvalidators.EmailValidator.isValid(EmailValidator.java:24) ~[hibernate-validator-4.3.0.Final.jar:4.3.0.Final]
	at org.hibernate.validator.internal.engine.ConstraintTree.validateSingleConstraint(ConstraintTree.java:291) ~[hibernate-validator-4.3.0.Final.jar:4.3.0.Final]

This situation was not possible in 4.2.

Project: Hibernate Validator
Priority: Major Major
Reporter: Bryan Turner
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira