dgraham     2003/03/12 18:26:25

  Modified:    validator/src/share/org/apache/commons/validator
                        GenericValidator.java
               validator/src/test/org/apache/commons/validator
                        EmailTest.java
  Log:
  Added test and fixed comma problem for PR #17219.
  
  Revision  Changes    Path
  1.11      +11 -8     
jakarta-commons/validator/src/share/org/apache/commons/validator/GenericValidator.java
  
  Index: GenericValidator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/GenericValidator.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- GenericValidator.java     20 Jan 2003 06:50:26 -0000      1.10
  +++ GenericValidator.java     13 Mar 2003 02:26:25 -0000      1.11
  @@ -7,7 +7,7 @@
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -76,7 +76,7 @@
    * @author David Winterfeldt
    * @author James Turner
    * @version $Revision$ $Date$
  -*/
  + */
   public class GenericValidator implements Serializable {
   
       /**
  @@ -499,8 +499,11 @@
                    // Make sure there's a host name preceding the domain.
                    if (len < 2) {
                       bValid = false;
  -                 }
  -              }                      
  +                 } 
  +                 
  +              } else {
  +                bValid = false; 
  +              }              
           }
          } catch (Exception e) {
             bValid = false;
  
  
  
  1.8       +18 -5     
jakarta-commons/validator/src/test/org/apache/commons/validator/EmailTest.java
  
  Index: EmailTest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/EmailTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- EmailTest.java    13 Mar 2003 02:09:23 -0000      1.7
  +++ EmailTest.java    13 Mar 2003 02:26:25 -0000      1.8
  @@ -7,7 +7,7 @@
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -223,6 +223,19 @@
         info.setValue("[EMAIL PROTECTED]");
         valueTest(info, false);
   
  +   }
  +   
  +   /**
  +    * Tests the email validation with commas.
  +    */
  +   public void testEmailWithCommas() throws ValidatorException {
  +      ValueBean info = new ValueBean();
  +      info.setValue("joe,[EMAIL PROTECTED]");
  +      valueTest(info, false);
  +      info.setValue("[EMAIL PROTECTED],che.org");
  +      valueTest(info, false);
  +      info.setValue("[EMAIL PROTECTED],rg");
  +      valueTest(info, false);
      }
   
      /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to