commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r367161 - in /jakarta/commons/proper/validator/trunk: src/share/org/apache/commons/validator/EmailValidator.java src/test/org/apache/commons/validator/EmailTest.java xdocs/changes.xml
Date Mon, 09 Jan 2006 02:19:33 GMT
Author: niallp
Date: Sun Jan  8 18:19:23 2006
New Revision: 367161

URL: http://svn.apache.org/viewcvs?rev=367161&view=rev
Log:
Fix for Bug 38051 - whitespaces allowed in server side email validation - reported by Stephanie
Codron

Modified:
    jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/EmailValidator.java
    jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator/EmailTest.java
    jakarta/commons/proper/validator/trunk/xdocs/changes.xml

Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/EmailValidator.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/EmailValidator.java?rev=367161&r1=367160&r2=367161&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/EmailValidator.java
(original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/EmailValidator.java
Sun Jan  8 18:19:23 2006
@@ -54,8 +54,8 @@
             "/^\\[(\\d{1,3})[.](\\d{1,3})[.](\\d{1,3})[.](\\d{1,3})\\]$/";
     private static final String TLD_PATTERN = "/^([a-zA-Z]+)$/";
             
-    private static final String USER_PATTERN = "/^\\s*" + WORD + "(\\." + WORD + ")*\\s*$/";
-    private static final String DOMAIN_PATTERN = "/^\\s*" + ATOM + "(\\." + ATOM + ")*\\s*$/";
+    private static final String USER_PATTERN = "/^\\s*" + WORD + "(\\." + WORD + ")*$/";
+    private static final String DOMAIN_PATTERN = "/^" + ATOM + "(\\." + ATOM + ")*\\s*$/";
     private static final String ATOM_PATTERN = "/(" + ATOM + ")/";
 
     /**

Modified: jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator/EmailTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator/EmailTest.java?rev=367161&r1=367160&r2=367161&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator/EmailTest.java
(original)
+++ jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator/EmailTest.java
Sun Jan  8 18:19:23 2006
@@ -4,7 +4,7 @@
  * $Date$
  *
  * ====================================================================
- * Copyright 2001-2005 The Apache Software Foundation
+ * Copyright 2001-2006 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -199,6 +199,26 @@
         info.setValue("joeblow@apache.o,rg");
         valueTest(info, false);
         info.setValue("joeblow@apache,org");
+        valueTest(info, false);
+
+    }
+   
+   /**
+    * Tests the email validation with spaces.
+    */
+    public void testEmailWithSpaces() throws ValidatorException {
+        ValueBean info = new ValueBean();
+        info.setValue("joeblow @apache.org");
+        valueTest(info, false);
+        info.setValue("joeblow@ apache.org");
+        valueTest(info, false);
+        info.setValue(" joeblow@apache.org");
+        valueTest(info, true);
+        info.setValue("joeblow@apache.org ");
+        valueTest(info, true);
+        info.setValue("joe blow@apache.org ");
+        valueTest(info, false);
+        info.setValue("joeblow@apa che.org ");
         valueTest(info, false);
 
     }

Modified: jakarta/commons/proper/validator/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/xdocs/changes.xml?rev=367161&r1=367160&r2=367161&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/xdocs/changes.xml (original)
+++ jakarta/commons/proper/validator/trunk/xdocs/changes.xml Sun Jan  8 18:19:23 2006
@@ -39,6 +39,10 @@
   <body>
 
     <release version="1.2.1 (alpha)" date="in SVN">
+      <action dev="niallp" type="fix" issue="38051" due-to="Stephanie Codron">
+         Fix email validator to not allow spaces at the end of the user
+         component or start of the domain component.
+      </action>
       <action dev="niallp" type="add" issue="37975" due-to="Neale">
          Added validator_1_2_1.dtd and changed form rules so that a minimum
          of one field is no longer required (i.e. changed (field+) to (field*)



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message