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/example/org/apache/commons/validator/example ValidateExample.java
Date Wed, 28 May 2003 04:28:02 GMT
dgraham     2003/05/27 21:28:01

  Modified:    validator/src/test/org/apache/commons/validator
                        DoubleTest.java TestValidator.java LongTest.java
                        LocaleTest.java RequiredIfTest.java EmailTest.java
                        ValidatorTest.java MultipleTests.java TypeTest.java
                        ByteTest.java FloatTest.java RequiredNameTest.java
                        IntegerTest.java MultipleConfigFilesTest.java
                        ShortTest.java
               validator/src/share/org/apache/commons/validator
                        Validator.java ValidatorAction.java
               validator/src/example/org/apache/commons/validator/example
                        ValidateExample.java
  Log:
  Replaced Validator.*_KEY constants with *_PARAM to match new 
  semantics.
  
  Revision  Changes    Path
  1.8       +5 -5      jakarta-commons/validator/src/test/org/apache/commons/validator/DoubleTest.java
  
  Index: DoubleTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/DoubleTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DoubleTest.java	24 May 2003 19:40:11 -0000	1.7
  +++ DoubleTest.java	28 May 2003 04:27:59 -0000	1.8
  @@ -204,7 +204,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource 
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, info);
  +      validator.setParameter(Validator.BEAN_PARAM, info);
   
         // Get results of the validation.
         ValidatorResults results = null;
  
  
  
  1.9       +5 -5      jakarta-commons/validator/src/test/org/apache/commons/validator/TestValidator.java
  
  Index: TestValidator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/TestValidator.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestValidator.java	22 May 2003 02:29:46 -0000	1.8
  +++ TestValidator.java	28 May 2003 04:28:00 -0000	1.9
  @@ -195,7 +195,7 @@
           Field field,
           Validator validator) {
       
  -        Object form = validator.getParameterValue(Validator.BEAN_KEY);
  +        Object form = validator.getParameterValue(Validator.BEAN_PARAM);
           String value = null;
           boolean required = false;
           if (isString(bean)) {
  
  
  
  1.8       +5 -5      jakarta-commons/validator/src/test/org/apache/commons/validator/LongTest.java
  
  Index: LongTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/LongTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- LongTest.java	24 May 2003 19:40:11 -0000	1.7
  +++ LongTest.java	28 May 2003 04:28:00 -0000	1.8
  @@ -226,7 +226,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource 
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, info);
  +      validator.setParameter(Validator.BEAN_PARAM, info);
   
         // Get results of the validation.
         ValidatorResults results = null;
  
  
  
  1.6       +6 -6      jakarta-commons/validator/src/test/org/apache/commons/validator/LocaleTest.java
  
  Index: LocaleTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/LocaleTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LocaleTest.java	24 May 2003 19:40:11 -0000	1.5
  +++ LocaleTest.java	28 May 2003 04:28:00 -0000	1.6
  @@ -197,8 +197,8 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource 
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, name);
  -      validator.setParameter(Validator.LOCALE_KEY, loc);
  +      validator.setParameter(Validator.BEAN_PARAM, name);
  +      validator.setParameter(Validator.LOCALE_PARAM, loc);
         // Get results of the validation.
         ValidatorResults results = null;
         
  
  
  
  1.7       +9 -9      jakarta-commons/validator/src/test/org/apache/commons/validator/RequiredIfTest.java
  
  Index: RequiredIfTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/RequiredIfTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- RequiredIfTest.java	24 May 2003 19:40:11 -0000	1.6
  +++ RequiredIfTest.java	28 May 2003 04:28:00 -0000	1.7
  @@ -161,7 +161,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource 
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, name);
  +      validator.setParameter(Validator.BEAN_PARAM, name);
   
         // Get results of the validation.
         ValidatorResults results = null;
  @@ -200,7 +200,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource 
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, name);
  +      validator.setParameter(Validator.BEAN_PARAM, name);
   
         // Get results of the validation.
         ValidatorResults results = null;
  @@ -235,7 +235,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource 
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, name);
  +      validator.setParameter(Validator.BEAN_PARAM, name);
   
         // Get results of the validation.
         ValidatorResults results = null;
  @@ -270,7 +270,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource 
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, name);
  +      validator.setParameter(Validator.BEAN_PARAM, name);
   
         // Get results of the validation.
         ValidatorResults results = null;
  @@ -305,7 +305,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource 
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, name);
  +      validator.setParameter(Validator.BEAN_PARAM, name);
   
         // Get results of the validation.
         ValidatorResults results = null;
  
  
  
  1.13      +5 -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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- EmailTest.java	24 May 2003 19:40:11 -0000	1.12
  +++ EmailTest.java	28 May 2003 04:28:00 -0000	1.13
  @@ -259,7 +259,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource 
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, info);
  +      validator.setParameter(Validator.BEAN_PARAM, info);
   
         // Get results of the validation.
         ValidatorResults results = null;
  
  
  
  1.13      +6 -6      jakarta-commons/validator/src/test/org/apache/commons/validator/ValidatorTest.java
  
  Index: ValidatorTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/ValidatorTest.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ValidatorTest.java	24 May 2003 19:40:11 -0000	1.12
  +++ ValidatorTest.java	28 May 2003 04:28:00 -0000	1.13
  @@ -147,7 +147,7 @@
         bean.setDate("2/3/1999");
         
         Validator validator = new Validator(resources, "testForm");
  -      validator.setParameter(Validator.BEAN_KEY, bean);
  +      validator.setParameter(Validator.BEAN_PARAM, bean);
   
         try {
            ValidatorResults results = validator.validate();
  @@ -218,7 +218,7 @@
         bean.setLetter("A");
         
         Validator validator = new Validator(resources, "testForm");
  -      validator.setParameter(Validator.BEAN_KEY, bean);
  +      validator.setParameter(Validator.BEAN_PARAM, bean);
         validator.setParameter("java.util.List", l);
   
         try {
  
  
  
  1.7       +8 -8      jakarta-commons/validator/src/test/org/apache/commons/validator/MultipleTests.java
  
  Index: MultipleTests.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/MultipleTests.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MultipleTests.java	24 May 2003 19:40:11 -0000	1.6
  +++ MultipleTests.java	28 May 2003 04:28:00 -0000	1.7
  @@ -160,7 +160,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, name);
  +      validator.setParameter(Validator.BEAN_PARAM, name);
   
         // Get results of the validation.
         ValidatorResults results = null;
  @@ -200,7 +200,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, name);
  +      validator.setParameter(Validator.BEAN_PARAM, name);
   
         // Get results of the validation.
         ValidatorResults results = null;
  @@ -235,7 +235,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, name);
  +      validator.setParameter(Validator.BEAN_PARAM, name);
   
         // Get results of the validation.
         ValidatorResults results = null;
  @@ -270,7 +270,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, name);
  +      validator.setParameter(Validator.BEAN_PARAM, name);
   
         // Get results of the validation.
         ValidatorResults results = null;
  
  
  
  1.9       +5 -5      jakarta-commons/validator/src/test/org/apache/commons/validator/TypeTest.java
  
  Index: TypeTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/TypeTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TypeTest.java	24 May 2003 19:40:11 -0000	1.8
  +++ TypeTest.java	28 May 2003 04:28:00 -0000	1.9
  @@ -169,7 +169,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource 
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, info);
  +      validator.setParameter(Validator.BEAN_PARAM, info);
   
         // Get results of the validation.
         ValidatorResults results = null;
  
  
  
  1.8       +5 -5      jakarta-commons/validator/src/test/org/apache/commons/validator/ByteTest.java
  
  Index: ByteTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/ByteTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ByteTest.java	24 May 2003 19:40:11 -0000	1.7
  +++ ByteTest.java	28 May 2003 04:28:00 -0000	1.8
  @@ -227,7 +227,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource 
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, info);
  +      validator.setParameter(Validator.BEAN_PARAM, info);
   
         // Get results of the validation.
         ValidatorResults results = null;
  
  
  
  1.8       +5 -5      jakarta-commons/validator/src/test/org/apache/commons/validator/FloatTest.java
  
  Index: FloatTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/FloatTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FloatTest.java	24 May 2003 19:40:11 -0000	1.7
  +++ FloatTest.java	28 May 2003 04:28:00 -0000	1.8
  @@ -204,7 +204,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource 
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, info);
  +      validator.setParameter(Validator.BEAN_PARAM, info);
   
         // Get results of the validation.
         ValidatorResults results = null;
  
  
  
  1.10      +10 -10    jakarta-commons/validator/src/test/org/apache/commons/validator/RequiredNameTest.java
  
  Index: RequiredNameTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/RequiredNameTest.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- RequiredNameTest.java	24 May 2003 19:40:11 -0000	1.9
  +++ RequiredNameTest.java	28 May 2003 04:28:00 -0000	1.10
  @@ -161,7 +161,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource 
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, name);
  +      validator.setParameter(Validator.BEAN_PARAM, name);
   
         // Get results of the validation.
         ValidatorResults results = null;
  @@ -199,7 +199,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource 
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, name);
  +      validator.setParameter(Validator.BEAN_PARAM, name);
   
         // Get results of the validation.
         ValidatorResults results = null;
  @@ -233,7 +233,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource 
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, name);
  +      validator.setParameter(Validator.BEAN_PARAM, name);
   
         // Get results of the validation.
         ValidatorResults results = null;
  @@ -267,7 +267,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource 
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, name);
  +      validator.setParameter(Validator.BEAN_PARAM, name);
   
         // Get results of the validation.
         ValidatorResults results = null;
  @@ -301,7 +301,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource 
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, name);
  +      validator.setParameter(Validator.BEAN_PARAM, name);
   
         // Get results of the validation.
         ValidatorResults results = null;
  @@ -337,7 +337,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource 
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, name);
  +      validator.setParameter(Validator.BEAN_PARAM, name);
   
         // Get results of the validation.
         ValidatorResults results = null;
  
  
  
  1.8       +5 -5      jakarta-commons/validator/src/test/org/apache/commons/validator/IntegerTest.java
  
  Index: IntegerTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/IntegerTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- IntegerTest.java	24 May 2003 19:40:11 -0000	1.7
  +++ IntegerTest.java	28 May 2003 04:28:00 -0000	1.8
  @@ -226,7 +226,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource 
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, info);
  +      validator.setParameter(Validator.BEAN_PARAM, info);
   
         // Get results of the validation.
         ValidatorResults results = null;
  
  
  
  1.5       +7 -7      jakarta-commons/validator/src/test/org/apache/commons/validator/MultipleConfigFilesTest.java
  
  Index: MultipleConfigFilesTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/MultipleConfigFilesTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MultipleConfigFilesTest.java	24 May 2003 19:40:11 -0000	1.4
  +++ MultipleConfigFilesTest.java	28 May 2003 04:28:00 -0000	1.5
  @@ -127,7 +127,7 @@
           Validator validator = new Validator(resources, FORM_KEY);
           // add the name bean to the validator as a resource
           // for the validations to be performed on.
  -        validator.setParameter(Validator.BEAN_KEY, name);
  +        validator.setParameter(Validator.BEAN_PARAM, name);
   
           // Get results of the validation.
           ValidatorResults results = null;
  @@ -168,7 +168,7 @@
           Validator validator = new Validator(resources, FORM_KEY);
           // add the name bean to the validator as a resource
           // for the validations to be performed on.
  -        validator.setParameter(Validator.BEAN_KEY, name);
  +        validator.setParameter(Validator.BEAN_PARAM, name);
   
           // Get results of the validation.
           ValidatorResults results = null;
  @@ -203,7 +203,7 @@
           Validator validator = new Validator(resources, FORM_KEY);
           // add the name bean to the validator as a resource
           // for the validations to be performed on.
  -        validator.setParameter(Validator.BEAN_KEY, name);
  +        validator.setParameter(Validator.BEAN_PARAM, name);
   
           // Get results of the validation.
           ValidatorResults results = null;
  @@ -238,7 +238,7 @@
           Validator validator = new Validator(resources, FORM_KEY);
           // add the name bean to the validator as a resource
           // for the validations to be performed on.
  -        validator.setParameter(Validator.BEAN_KEY, name);
  +        validator.setParameter(Validator.BEAN_PARAM, name);
   
           // Get results of the validation.
           ValidatorResults results = null;
  
  
  
  1.8       +5 -5      jakarta-commons/validator/src/test/org/apache/commons/validator/ShortTest.java
  
  Index: ShortTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/ShortTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ShortTest.java	24 May 2003 19:40:11 -0000	1.7
  +++ ShortTest.java	28 May 2003 04:28:00 -0000	1.8
  @@ -226,7 +226,7 @@
         Validator validator = new Validator(resources, FORM_KEY);
         // add the name bean to the validator as a resource 
         // for the validations to be performed on.
  -      validator.setParameter(Validator.BEAN_KEY, info);
  +      validator.setParameter(Validator.BEAN_PARAM, info);
   
         // Get results of the validation.
         ValidatorResults results = null;
  
  
  
  1.24      +66 -23    jakarta-commons/validator/src/share/org/apache/commons/validator/Validator.java
  
  Index: Validator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/Validator.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- Validator.java	24 May 2003 20:09:39 -0000	1.23
  +++ Validator.java	28 May 2003 04:28:01 -0000	1.24
  @@ -98,7 +98,13 @@
       /**
        * Resources key the JavaBean is stored to perform validation on.
        */
  -    public static final String BEAN_KEY = "java.lang.Object";
  +    public static final String BEAN_PARAM = "java.lang.Object";
  +
  +    /**
  +     * Resources key the JavaBean is stored to perform validation on.
  +     * @deprecated Use BEAN_PARAM instead.
  +     */
  +    public static final String BEAN_KEY = BEAN_PARAM;
   
       /**
        * Resources key the <code>ValidatorAction</code> is stored under.
  @@ -106,16 +112,34 @@
        * with the current <code>ValidatorAction</code> if it is
        * specified in the method signature.
        */
  -    public static final String VALIDATOR_ACTION_KEY =
  +    public static final String VALIDATOR_ACTION_PARAM =
           "org.apache.commons.validator.ValidatorAction";
   
       /**
  +     * Resources key the <code>ValidatorAction</code> is stored under.
  +     * This will be automatically passed into a validation method
  +     * with the current <code>ValidatorAction</code> if it is
  +     * specified in the method signature.
  +     * @deprecated Use VALIDATOR_ACTION_PARAM instead.
  +     */
  +    public static final String VALIDATOR_ACTION_KEY = VALIDATOR_ACTION_PARAM;
  +
  +    /**
        * Resources key the <code>Field</code> is stored under.
        * This will be automatically passed into a validation method
        * with the current <code>Field</code> if it is
        * specified in the method signature.
        */
  -    public static final String FIELD_KEY = "org.apache.commons.validator.Field";
  +    public static final String FIELD_PARAM = "org.apache.commons.validator.Field";
  +
  +    /**
  +     * Resources key the <code>Field</code> is stored under.
  +     * This will be automatically passed into a validation method
  +     * with the current <code>Field</code> if it is
  +     * specified in the method signature.
  +     * @deprecated Use FIELD_PARAM instead.
  +     */
  +    public static final String FIELD_KEY = FIELD_PARAM;
   
       /**
        * Resources key the <code>Validator</code> is stored under.
  @@ -123,7 +147,17 @@
        * with the current <code>Validator</code> if it is
        * specified in the method signature.
        */
  -    public static final String VALIDATOR_KEY = "org.apache.commons.validator.Validator";
  +    public static final String VALIDATOR_PARAM =
  +        "org.apache.commons.validator.Validator";
  +
  +    /**
  +     * Resources key the <code>Validator</code> is stored under.
  +     * This will be automatically passed into a validation method
  +     * with the current <code>Validator</code> if it is
  +     * specified in the method signature.
  +     * @deprecated Use VALIDATOR_PARAM instead.
  +     */
  +    public static final String VALIDATOR_KEY = VALIDATOR_PARAM;
   
       /**
        * Resources key the <code>Locale</code> is stored.
  @@ -131,7 +165,16 @@
        * <code>FormSet</code> and <code>Form</code> to be
        * processed.
        */
  -    public static final String LOCALE_KEY = "java.util.Locale";
  +    public static final String LOCALE_PARAM = "java.util.Locale";
  +
  +    /**
  +     * Resources key the <code>Locale</code> is stored.
  +     * This will be used to retrieve the appropriate
  +     * <code>FormSet</code> and <code>Form</code> to be
  +     * processed.
  +     * @deprecated Use LOCALE_PARAM instead.
  +     */
  +    public static final String LOCALE_KEY = LOCALE_PARAM;
   
       protected ValidatorResources resources = null;
       
  @@ -189,6 +232,10 @@
        * @param formName Key used for retrieving the set of validation rules.
        */
       public Validator(ValidatorResources resources, String formName) {
  +        if (resources == null) {
  +            throw new IllegalArgumentException("Resources cannot be null.");
  +        }
  +        
           this.resources = resources;
           this.formName = formName;
       }
  @@ -435,8 +482,8 @@
           try {
               // Add these two Objects to the resources since they reference
               // the current validator action and field
  -            this.setParameter(VALIDATOR_ACTION_KEY, va);
  -            this.setParameter(FIELD_KEY, field);
  +            this.setParameter(VALIDATOR_ACTION_PARAM, va);
  +            this.setParameter(FIELD_PARAM, field);
           
               Class validationClass = getClassLoader().loadClass(va.getClassname());
           
  @@ -563,8 +610,8 @@
           Object[] paramValue)
           throws ValidatorException {
               
  -        int beanIndexPos = params.indexOf(BEAN_KEY);
  -        int fieldIndexPos = params.indexOf(FIELD_KEY);
  +        int beanIndexPos = params.indexOf(BEAN_PARAM);
  +        int fieldIndexPos = params.indexOf(FIELD_PARAM);
           
           Object indexedList[] = this.getIndexedProperty(field);
           
  @@ -639,7 +686,7 @@
           try {
               indexedProperty =
                   PropertyUtils.getProperty(
  -                    this.getParameterValue(BEAN_KEY),
  +                    this.getParameterValue(BEAN_PARAM),
                       field.getIndexedListProperty());
                       
           } catch (IllegalAccessException e) {
  @@ -674,23 +721,19 @@
        */
       public ValidatorResults validate() throws ValidatorException {
           ValidatorResults results = new ValidatorResults();
  -        Locale locale = (Locale) this.getParameterValue(LOCALE_KEY);
  +        Locale locale = (Locale) this.getParameterValue(LOCALE_PARAM);
   
           if (locale == null) {
               locale = Locale.getDefault();
           }
           
  -        this.setParameter(VALIDATOR_KEY, this);
  -
  -        if (this.resources == null) {
  -            throw new ValidatorException("Resources not defined for Validator");
  -        }
  +        this.setParameter(VALIDATOR_PARAM, this);
   
           Form form = this.resources.getForm(locale, this.formName);
           if (form != null) {
  -            Iterator forms = form.getFields().iterator();
  -            while (forms.hasNext()) {
  -                Field field = (Field) forms.next();
  +            Iterator fields = form.getFields().iterator();
  +            while (fields.hasNext()) {
  +                Field field = (Field) fields.next();
                   
                   if ((field.getPage() <= page) && (field.getDepends() != null))
{
                       this.validateField(field, results);
  
  
  
  1.13      +7 -7      jakarta-commons/validator/src/share/org/apache/commons/validator/ValidatorAction.java
  
  Index: ValidatorAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/ValidatorAction.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ValidatorAction.java	24 May 2003 19:17:57 -0000	1.12
  +++ ValidatorAction.java	28 May 2003 04:28:01 -0000	1.13
  @@ -118,11 +118,11 @@
        * </p>
   	 */
   	private String methodParams =
  -		Validator.BEAN_KEY
  +		Validator.BEAN_PARAM
   			+ ","
  -			+ Validator.VALIDATOR_ACTION_KEY
  +			+ Validator.VALIDATOR_ACTION_PARAM
   			+ ","
  -			+ Validator.FIELD_KEY;
  +			+ Validator.FIELD_PARAM;
   
   	/**
   	 * The other <code>ValidatorAction</code>s that this one depends on.  If any

  
  
  
  1.11      +5 -5      jakarta-commons/validator/src/example/org/apache/commons/validator/example/ValidateExample.java
  
  Index: ValidateExample.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/example/org/apache/commons/validator/example/ValidateExample.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ValidateExample.java	25 May 2003 18:00:24 -0000	1.10
  +++ ValidateExample.java	28 May 2003 04:28:01 -0000	1.11
  @@ -136,7 +136,7 @@
           Validator validator = new Validator(resources, "ValidateBean");
           
           // Tell the validator which bean to validate against.
  -        validator.setParameter(Validator.BEAN_KEY, bean);
  +        validator.setParameter(Validator.BEAN_PARAM, bean);
           
           ValidatorResults results = null;
           
  
  
  

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