Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/clra/web/ValidateMemberEmail.java


1   /*
2    * Copyright (c) Carnegie Lake Rowing Association 2002. All rights reserved.
3    * Distributed under the GPL license. See doc/COPYING.
4    * $RCSfile: ValidateMemberEmail.java,v $
5    * $Date: 2003/02/26 03:38:46 $
6    * $Revision: 1.3 $
7    */
8   
9   package com.clra.web;
10  
11  import com.clra.member.Email;
12  import org.apache.struts.action.ActionError;
13  import org.apache.struts.action.ActionErrors;
14  
15  /**
16   * Checks whether an email address seems valid.
17   *
18   * @version $Id: ValidateMemberEmail.java,v 1.3 2003/02/26 03:38:46 rphall Exp $
19   * @author <a href="mailto:rphall@pluto.njcc.com">Rick Hall</a>
20   */
21  class ValidateMemberEmail extends ValidateMember {
22  
23    public final static String PROPERTY_EMAIL = "email";
24  
25    ValidateMemberEmail( MemberInfoForm f ) {
26      super( f );
27    }
28  
29    /**
30     * Checks whether an email address seems valid.
31     */
32    void validate( ActionErrors errors ) {
33      if ( errors == null ) {
34        throw new IllegalArgumentException( "null action errors" );
35      }
36  
37      String strEmail = form.getEmail();
38  
39      if ( strEmail != null
40        && strEmail.trim().length() > 0 && !Email.isValidEmail( strEmail ) ) {
41  
42        ActionError ae = new ActionError( "validate.member.email.invalid" );
43        errors.add( PROPERTY_EMAIL, ae );
44  
45      }
46  
47      return;
48    } // validate(ActionErrors)
49  
50  } // ValidateMemberEmail
51  
52  /*
53   * $Log: ValidateMemberEmail.java,v $
54   * Revision 1.3  2003/02/26 03:38:46  rphall
55   * Added copyright and GPL license
56   *
57   * Revision 1.2  2003/02/19 03:25:25  rphall
58   * Fixed bug in validation
59   *
60   * Revision 1.1  2003/02/11 21:13:15  rphall
61   * Separate class for specific validation task; stubbed implementation
62   *
63   */
64