commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject svn commit: r1608584 - in /commons/proper/validator/trunk/src: changes/changes.xml main/java/org/apache/commons/validator/routines/EmailValidator.java test/java/org/apache/commons/validator/EmailTest.java
Date Mon, 07 Jul 2014 19:54:08 GMT
Author: britter
Date: Mon Jul  7 19:54:07 2014
New Revision: 1608584

URL: http://svn.apache.org/r1608584
Log:
VALIDATOR-273: EmailValidator does not support mailboxes at TLDs. Thanks to Chris Lee

Modified:
    commons/proper/validator/trunk/src/changes/changes.xml
    commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/EmailValidator.java
    commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/EmailTest.java

Modified: commons/proper/validator/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/changes/changes.xml?rev=1608584&r1=1608583&r2=1608584&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/changes/changes.xml (original)
+++ commons/proper/validator/trunk/src/changes/changes.xml Mon Jul  7 19:54:07 2014
@@ -43,6 +43,9 @@ The <action> type attribute can be add,u
   <body>
 
   <release version="1.4.1" date="TBA" description="TBA">
+    <action dev="britter" type="fix" issue="VALIDATOR-273" due-to="Chris Lee" >
+      EmailValidator does not support mailboxes at TLDs
+    </action>
     <action dev="britter" type="fix" issue="VALIDATOR-317" due-to="Arūnas Bendoraitis"
>
       DomainValidator missing sTLD - "xxx"
     </action>

Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/EmailValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/EmailValidator.java?rev=1608584&r1=1608583&r2=1608584&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/EmailValidator.java
(original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/EmailValidator.java
Mon Jul  7 19:54:07 2014
@@ -160,7 +160,8 @@ public class EmailValidator implements S
             // Domain is symbolic name
             DomainValidator domainValidator =
                     DomainValidator.getInstance(allowLocal);
-            return domainValidator.isValid(domain);
+            return domainValidator.isValid(domain) ||
+                    domainValidator.isValidTld(domain);
         }
     }
 

Modified: commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/EmailTest.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/EmailTest.java?rev=1608584&r1=1608583&r2=1608584&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/EmailTest.java
(original)
+++ commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/EmailTest.java
Mon Jul  7 19:54:07 2014
@@ -210,6 +210,18 @@ public class EmailTest extends AbstractC
         assertFalse("Test control char 127", validator.isValid("foo" + ((char)127) + "bar@domain.com"));
     }
 
+   /**
+    * Tests the e-mail validation with a user at a TLD
+    */
+   public void testEmailAtTLD() throws ValidatorException {
+      // Create bean to run test on.
+      ValueBean info = new ValueBean();
+
+      info.setValue("m@de");
+      valueTest(info, true);
+
+   }
+
     /**
      * Test that @localhost and @localhost.localdomain
      *  addresses aren't declared valid by default 



Mime
View raw message