[hibernate-issues] [Hibernate-JIRA] Resolved: (HV-339) ^ not allowed in Email
Hardy Ferentschik (JIRA)
noreply at atlassian.com
Wed Jun 23 07:24:09 EDT 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HV-339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
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 at example.com", null);
> assertTrue(result);
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list