commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bspeak...@apache.org
Subject svn commit: r588365 - /commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/EmailValidator.java
Date Thu, 25 Oct 2007 21:32:36 GMT
Author: bspeakmon
Date: Thu Oct 25 14:32:34 2007
New Revision: 588365

URL: http://svn.apache.org/viewvc?rev=588365&view=rev
Log:
- VALIDATOR-191: incrementally replacing oro with java.util.regex

Modified:
    commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/EmailValidator.java

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=588365&r1=588364&r2=588365&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
Thu Oct 25 14:32:34 2007
@@ -49,7 +49,7 @@
     private static final String WORD = "((" + VALID_CHARS + "|')+|" + QUOTED_USER + ")";
 
     // Each pattern must be surrounded by /
-    private static final String LEGAL_ASCII_PATTERN = "/^[\\000-\\177]+$/";
+    private static final String LEGAL_ASCII_PATTERN = "^[\\0000-\\0177]+$";
     private static final String EMAIL_PATTERN = "/^(.+)@(.+)$/";
     private static final String IP_DOMAIN_PATTERN = "^\\[(.*)\\]$";
     private static final String TLD_PATTERN = "/^([a-zA-Z]+)$/";
@@ -90,8 +90,9 @@
             return false;
         }
 
-        Perl5Util matchAsciiPat = new Perl5Util();
-        if (!matchAsciiPat.match(LEGAL_ASCII_PATTERN, email)) {
+        Pattern matchAsciiPattern = Pattern.compile(LEGAL_ASCII_PATTERN);
+        Matcher matcher = matchAsciiPattern.matcher(email);
+        if (!matcher.matches()) {
             return false;
         }
 



Mime
View raw message