commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bspeak...@apache.org
Subject svn commit: r591487 - /commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/EmailValidator.java
Date Fri, 02 Nov 2007 21:57:37 GMT
Author: bspeakmon
Date: Fri Nov  2 14:57:37 2007
New Revision: 591487

URL: http://svn.apache.org/viewvc?rev=591487&view=rev
Log:
- VALIDATOR-242: removing stripComments() since it has no tests and is way
  too painful to figure out. Another issue will cover its eventual reimplementation.

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=591487&r1=591486&r2=591487&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
Fri Nov  2 14:57:37 2007
@@ -95,8 +95,6 @@
             return false;
         }
 
-        email = stripComments(email);
-
         // Check the whole email address structure
         Matcher emailMatcher = EMAIL_PATTERN.matcher(email);
         if (!emailMatcher.matches()) {
@@ -150,27 +148,4 @@
         return USER_PATTERN.matcher(user).matches();
     }
 
-    /**
-     * Recursively remove comments, and replace with a single space.  The simpler
-     * regexps in the Email Addressing FAQ are imperfect - they will miss escaped
-     * chars in atoms, for example.
-     * Derived From    Mail::RFC822::Address
-     *
-     * @param emailStr The email address
-     * @return address with comments removed.
-     */
-    protected String stripComments(String emailStr) {
-        String input = emailStr;
-        String result = emailStr;
-        String commentPat = "s/^((?:[^\"\\\\]|\\\\.)*(?:\"(?:[^\"\\\\]|\\\\.)*\"(?:[^\"\\\\]|\111111\\\\.)*)*)\\((?:[^()\\\\]|\\\\.)*\\)/$1
/osx";
-        Perl5Util commentMatcher = new Perl5Util();
-        result = commentMatcher.substitute(commentPat, input);
-        // This really needs to be =~ or Perl5Matcher comparison
-        while (!result.equals(input)) {
-            input = result;
-            result = commentMatcher.substitute(commentPat, input);
-        }
-        return result;
-
-    }
 }



Mime
View raw message