struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [2/2] struts git commit: WW-4735 Uses more flexible RegExp to match domain suffixes
Date Fri, 27 Jan 2017 07:28:17 GMT
WW-4735 Uses more flexible RegExp to match domain suffixes


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/45580718
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/45580718
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/45580718

Branch: refs/heads/master
Commit: 45580718ab01627d4cf2b168e65e4d0016681a54
Parents: 87f113e
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Fri Jan 27 08:27:50 2017 +0100
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Fri Jan 27 08:27:50 2017 +0100

----------------------------------------------------------------------
 .../xwork2/validator/validators/EmailValidator.java            | 6 ++----
 .../com/opensymphony/xwork2/validator/EmailValidatorTest.java  | 1 +
 2 files changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/45580718/core/src/main/java/com/opensymphony/xwork2/validator/validators/EmailValidator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/validators/EmailValidator.java
b/core/src/main/java/com/opensymphony/xwork2/validator/validators/EmailValidator.java
index 9410eb6..98958a0 100644
--- a/core/src/main/java/com/opensymphony/xwork2/validator/validators/EmailValidator.java
+++ b/core/src/main/java/com/opensymphony/xwork2/validator/validators/EmailValidator.java
@@ -23,7 +23,7 @@ package com.opensymphony.xwork2.validator.validators;
  * The regular expression used to validate that the string is an email address is:
  *
  * <pre>
- * \\b^['_a-z0-9-\\+]+(\\.['_a-z0-9-\\+]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\\.([a-z]{2}|aero|arpa|asia|biz|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|nato|net|org|pro|tel|travel|xxx|tech|cat)$\\b
+ * \\b^['_a-z0-9-\\+]+(\\.['_a-z0-9-\\+]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\\.([a-z]{2,6})$\\b
  * </pre>
  *
  * You can also specify expression, caseSensitive and trim params as a OGNL expression, see
the example below.
@@ -78,9 +78,7 @@ package com.opensymphony.xwork2.validator.validators;
  */
 public class EmailValidator extends RegexFieldValidator {
 
-	// see XW-371 
-    public static final String EMAIL_ADDRESS_PATTERN =
-    	"\\b^['_a-z0-9-\\+]+(\\.['_a-z0-9-\\+]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\\.([a-z]{2}|aero|arpa|asia|biz|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|nato|net|org|pro|tel|travel|xxx|tech|cat)$\\b";
+    public static final String EMAIL_ADDRESS_PATTERN = "\\b^['_a-z0-9-\\+]+(\\.['_a-z0-9-\\+]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\\.([a-z]{2,6})$\\b";
 
     public EmailValidator() {
         setRegex(EMAIL_ADDRESS_PATTERN);

http://git-wip-us.apache.org/repos/asf/struts/blob/45580718/core/src/test/java/com/opensymphony/xwork2/validator/EmailValidatorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/validator/EmailValidatorTest.java
b/core/src/test/java/com/opensymphony/xwork2/validator/EmailValidatorTest.java
index 2de1f18..721ce08 100644
--- a/core/src/test/java/com/opensymphony/xwork2/validator/EmailValidatorTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/validator/EmailValidatorTest.java
@@ -47,6 +47,7 @@ public class EmailValidatorTest extends XWorkTestCase {
         assertTrue(verifyEmailValidity("Ferda+Mravenec@yaHoo.CoM"));
         assertTrue(verifyEmailValidity("user@domainname.tech"));
         assertTrue(verifyEmailValidity("Ferda+Mravenec@yaHoo.cat"));
+        assertTrue(verifyEmailValidity("user@domainname.swiss"));
 
         assertFalse(verifyEmailValidity("tm_jee#marry@yahoo.co.uk"));
         assertFalse(verifyEmailValidity("tm_jee@ yahoo.co.uk"));


Mime
View raw message