]
Hardy Ferentschik resolved HV-339.
----------------------------------
Resolution: Fixed
Fix Version/s: 4.1.0.Final
Updated the ATOM regular expression to use inclusion of characters instead of explicitly
stating which characters not to use.
^ not allowed in Email
----------------------
Key: HV-339
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HV-339
Project: Hibernate Validator
Issue Type: Bug
Components: validators
Affects Versions: 4.1.0.CR1
Environment: hibernate-validator-4.1.0.CR1
Reporter: Tim
Assignee: Hardy Ferentschik
Priority: Minor
Fix For: 4.1.0.Final
The email validator rejects emails with ^ in them. According to the rfc-2822 spec they
should be allowed.
http://www.faqs.org/rfcs/rfc2822.html
I believe the regex is incorrect.
From file org.hibernate.validator.constraints.impl.EmailValidator (line 17)
private static String ATOM =
"[^\\x00-\\x1F^\\(^\\)^\\<^\\>^\\@^\\,^\\;^\\:^\\\\^\\\"^\\.^\\[^\\]^\\s]";
There should only be one ^ all the others are not needed and cause the ^ character to be
invalid.
I believe it should be:
private static String ATOM =
"[^\\x00-\\x1F\\(\\)\\<\\>\\@\\,\\;\\:\\\\\\\"\\.\\[\\]\\s]";
// ======== Test Case =========
import junit.framework.TestCase;
import org.hibernate.validator.constraints.impl.EmailValidator;
import org.junit.Test;
public class TestEmailValidator extends TestCase {
@Test
public void testAccent(){
EmailValidator emailValidator = new EmailValidator();
boolean result = emailValidator.isValid("Test^Email(a)example.com",
null);
assertTrue(result);
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: