commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgra...@apache.org
Subject cvs commit: jakarta-commons/validator/src/share/org/apache/commons/validator CreditCardValidator.java
Date Sun, 08 Jun 2003 21:32:29 GMT
dgraham     2003/06/08 14:32:29

  Modified:    validator/src/share/org/apache/commons/validator
                        CreditCardValidator.java
  Log:
  Added a null check and max length of 19 check.  Updated
  reference to a better online source.
  
  Revision  Changes    Path
  1.7       +7 -7      jakarta-commons/validator/src/share/org/apache/commons/validator/CreditCardValidator.java
  
  Index: CreditCardValidator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/CreditCardValidator.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CreditCardValidator.java	7 Jun 2003 19:13:21 -0000	1.6
  +++ CreditCardValidator.java	8 Jun 2003 21:32:29 -0000	1.7
  @@ -72,7 +72,8 @@
    * configures the validator to only pass American Express and Visa cards. 
    * </p>
    * Reference Sean M. Burke's 
  - * <a href="http://www.ling.nwu.edu/~sburke/pub/luhn_lib.pl">script</a>.
  + * <a href="http://www.ling.nwu.edu/~sburke/pub/luhn_lib.pl">script</a>.  More
information
  + * also available <a href="http://www.merriampark.com/anatomycc.htm">here</a>.
    *
    * @author David Winterfeldt
    * @author James Turner
  @@ -141,7 +142,7 @@
   	 * @param card The card number to validate.
   	 */
   	public boolean isValid(String card) {
  -		if (card.length() < 13) {
  +		if ((card == null) || (card.length() < 13) || (card.length() > 19)) {
   			return false;
   		}
   
  @@ -170,7 +171,6 @@
   
   	/**
   	 * Checks for a valid credit card number.
  -	 *
   	 * @param cardNumber Credit Card Number.
   	 */
   	protected boolean luhnCheck(String cardNumber) {
  
  
  

---------------------------------------------------------------------
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