You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ni...@apache.org on 2006/01/07 23:51:15 UTC

svn commit: r366933 - in /jakarta/commons/proper/validator/trunk: conf/share/ src/share/org/apache/commons/validator/ src/share/org/apache/commons/validator/util/ xdocs/

Author: niallp
Date: Sat Jan  7 14:51:01 2006
New Revision: 366933

URL: http://svn.apache.org/viewcvs?rev=366933&view=rev
Log:
Fix CheckStyle isses and make Log instances transient.

Added:
    jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/package.html   (with props)
Modified:
    jakarta/commons/proper/validator/trunk/conf/share/ValidatorCheckStyle.xml
    jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/DateValidator.java
    jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/EmailValidator.java
    jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Field.java
    jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/FormSet.java
    jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/FormSetFactory.java
    jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/GenericTypeValidator.java
    jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/GenericValidator.java
    jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Validator.java
    jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorAction.java
    jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResources.java
    jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/ValidatorUtils.java
    jakarta/commons/proper/validator/trunk/xdocs/changes.xml

Modified: jakarta/commons/proper/validator/trunk/conf/share/ValidatorCheckStyle.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/conf/share/ValidatorCheckStyle.xml?rev=366933&r1=366932&r2=366933&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/conf/share/ValidatorCheckStyle.xml (original)
+++ jakarta/commons/proper/validator/trunk/conf/share/ValidatorCheckStyle.xml Sat Jan  7 14:51:01 2006
@@ -43,7 +43,9 @@
     <module name="EqualsHashCode"/>
 
     <!-- Item 12 - Make all fields private -->
+    <!--
     <module name="VisibilityModifier"/>
+    -->
 
     <!-- Item 15 - Design and document for inheritance or else prohibit it -->
     <!-- the module actually implements a very strict rule, it would be
@@ -52,9 +54,11 @@
          i.e. if you get error messages from this check you should be
          able to name a good reason to implement your code the way you do it,
          especially if you are designing a library and not an application. -->
+    <!--
     <module name="DesignForExtension">
       <property name="severity" value="warning"/>
     </module>
+    -->
 
     <!-- Item 17 - Use interfaces only to define types -->
     <module name="InterfaceIsType"/>
@@ -62,7 +66,7 @@
     <!-- Item 25 - Design method signatures carefully -->
     <!-- Avoid long parameter lists -->
     <module name="ParameterNumber">
-      <property name="max" value="3"/>
+      <property name="max" value="4"/>
     </module>
 
     <!-- Item 26 - Use overloading judiciously -->
@@ -77,6 +81,7 @@
     </module>
     <module name="JavadocMethod"> <!-- also covers Item 44 -->
       <property name="scope" value="protected"/>
+      <property name="allowUndeclaredRTE" value="true"/>
     </module>
     <module name="JavadocVariable">
       <property name="scope" value="protected"/>

Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/DateValidator.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/DateValidator.java?rev=366933&r1=366932&r2=366933&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/DateValidator.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/DateValidator.java Sat Jan  7 14:51:01 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.
@@ -40,14 +40,14 @@
     /**
      * Singleton instance of this class.
      */
-    private static final DateValidator instance = new DateValidator();
+    private static final DateValidator DATE_VALIDATOR = new DateValidator();
 
     /**
      * Returns the Singleton instance of this validator.
      * @return A singleton instance of the DateValidator.
      */
     public static DateValidator getInstance() {
-        return instance;
+        return DATE_VALIDATOR;
     }
 
     /**

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=366933&r1=366932&r2=366933&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 Sat Jan  7 14:51:01 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.
@@ -61,14 +61,14 @@
     /**
      * Singleton instance of this class.
      */
-    private static final EmailValidator instance = new EmailValidator();
+    private static final EmailValidator EMAIL_VALIDATOR = new EmailValidator();
 
     /**
      * Returns the Singleton instance of this validator.
      * @return singleton instance of this validator.
      */
     public static EmailValidator getInstance() {
-        return instance;
+        return EMAIL_VALIDATOR;
     }
 
     /**

Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Field.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Field.java?rev=366933&r1=366932&r2=366933&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Field.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Field.java Sat Jan  7 14:51:01 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.
@@ -816,6 +816,7 @@
      * @param actions A Map of validator names to ValidatorAction objects.
      * @return A ValidatorResults object containing validation messages for 
      * this field.
+     * @throws ValidatorException If an error occurs during validation.
      */
     public ValidatorResults validate(Map params, Map actions)
         throws ValidatorException {

Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/FormSet.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/FormSet.java?rev=366933&r1=366932&r2=366933&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/FormSet.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/FormSet.java Sat Jan  7 14:51:01 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.
@@ -36,7 +36,7 @@
 public class FormSet implements Serializable {
 
     /** Logging */
-    private static final Log log = LogFactory.getLog(FormSet.class);
+    private transient Log log = LogFactory.getLog(FormSet.class);
 
     /**
      * Whether or not the this <code>FormSet</code> was processed for replacing
@@ -237,7 +237,7 @@
     public void addConstant(String name, String value) {
 
         if (constants.containsKey(name)) {
-            log.error("Constant '" + name +  "' already exists in FormSet["
+            getLog().error("Constant '" + name +  "' already exists in FormSet["
                       + this.displayKey() + "] - ignoring.");
                        
         } else {
@@ -255,7 +255,7 @@
 
         String formName = f.getName();
         if (forms.containsKey(formName)) {
-            log.error("Form '" + formName + "' already exists in FormSet[" 
+            getLog().error("Form '" + formName + "' already exists in FormSet[" 
                       + this.displayKey() + "] - ignoring.");
                        
         } else {
@@ -355,4 +355,20 @@
         return results.toString();
     }
 
+    /**
+     * Accessor method for Log instance.
+     *
+     * The Log instance variable is transient and
+     * accessing it through this method ensures it
+     * is re-initialized when this instance is
+     * de-serialized.
+     *
+     * @return The Log instance.
+     */
+    private Log getLog() {
+        if (log == null) {
+            log =  LogFactory.getLog(FormSet.class);
+        }
+        return log;
+    }
 }

Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/FormSetFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/FormSetFactory.java?rev=366933&r1=366932&r2=366933&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/FormSetFactory.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/FormSetFactory.java Sat Jan  7 14:51:01 2006
@@ -4,7 +4,7 @@
  * $Date$
  *
  * ====================================================================
- * Copyright 2005 The Apache Software Foundation
+ * Copyright 2005-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.
@@ -33,7 +33,7 @@
 public class FormSetFactory extends AbstractObjectCreationFactory {
 
     /** Logging */
-    private static final Log log = LogFactory.getLog(ValidatorResources.class);
+    private transient Log log = LogFactory.getLog(FormSetFactory.class);
 
     /**
      * <p>Create or retrieve a <code>FormSet</code> for the specified
@@ -41,6 +41,7 @@
      *
      * @param attributes The sax attributes for the formset element.
      * @return The FormSet for a locale.
+     * @throws Exception If an error occurs creating the FormSet.
      */
     public Object createObject(Attributes attributes) throws Exception {
 
@@ -73,8 +74,8 @@
         // Retrieve existing FormSet for the language/country/variant
         FormSet formSet = resources.getFormSet(language, country, variant);
         if (formSet != null) {
-            if (log.isDebugEnabled()) {
-                log.debug("FormSet[" + formSet.displayKey() + "] found - merging.");
+            if (getLog().isDebugEnabled()) {
+                getLog().debug("FormSet[" + formSet.displayKey() + "] found - merging.");
             }
             return formSet;
         }
@@ -88,12 +89,29 @@
         // Add the FormSet to the validator resources
         resources.addFormSet(formSet);
 
-        if (log.isDebugEnabled()) {
-            log.debug("FormSet[" + formSet.displayKey() + "] created.");
+        if (getLog().isDebugEnabled()) {
+            getLog().debug("FormSet[" + formSet.displayKey() + "] created.");
         }
 
         return formSet;
 
+    }
+
+    /**
+     * Accessor method for Log instance.
+     *
+     * The Log instance variable is transient and
+     * accessing it through this method ensures it
+     * is re-initialized when this instance is
+     * de-serialized.
+     *
+     * @return The Log instance.
+     */
+    private Log getLog() {
+        if (log == null) {
+            log =  LogFactory.getLog(FormSetFactory.class);
+        }
+        return log;
     }
 
 }

Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/GenericTypeValidator.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/GenericTypeValidator.java?rev=366933&r1=366932&r2=366933&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/GenericTypeValidator.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/GenericTypeValidator.java Sat Jan  7 14:51:01 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.
@@ -37,7 +37,7 @@
  */
 public class GenericTypeValidator implements Serializable {
 
-    private final static Log log = LogFactory.getLog(GenericTypeValidator.class);
+    private final static Log LOG = LogFactory.getLog(GenericTypeValidator.class);
 
     /**
      *  Checks if the value can safely be converted to a byte primitive.
@@ -391,8 +391,8 @@
             date = formatter.parse(value);
         } catch (ParseException e) {
             // Bad date so return null
-            if (log.isDebugEnabled()) {
-                log.debug("Date parse failed value=[" + value  + "], " +
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Date parse failed value=[" + value  + "], " +
                                            "locale=[" + locale + "] "  + e);
             }
         }
@@ -436,8 +436,8 @@
             }
         } catch (ParseException e) {
             // Bad date so return null
-            if (log.isDebugEnabled()) {
-                log.debug("Date parse failed value=[" + value       + "], " +
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Date parse failed value=[" + value       + "], " +
                                           "pattern=[" + datePattern + "], " +
                                            "strict=[" + strict      + "] "  + e);
             }

Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/GenericValidator.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/GenericValidator.java?rev=366933&r1=366932&r2=366933&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/GenericValidator.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/GenericValidator.java Sat Jan  7 14:51:01 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.
@@ -34,12 +34,12 @@
     /**
      * UrlValidator used in wrapper method.
      */
-    private static final UrlValidator urlValidator = new UrlValidator();
+    private static final UrlValidator URL_VALIDATOR = new UrlValidator();
 
     /**
      * CreditCardValidator used in wrapper method.
      */
-    private static final CreditCardValidator creditCardValidator =
+    private static final CreditCardValidator CREDIT_CARD_VALIDATOR =
         new CreditCardValidator();
 
     /**
@@ -243,7 +243,7 @@
      * @return true if the value is valid Credit Card Number.
      */
     public static boolean isCreditCard(String value) {
-        return creditCardValidator.isValid(value);
+        return CREDIT_CARD_VALIDATOR.isValid(value);
     }
 
     /**
@@ -265,7 +265,7 @@
      * @return true if the value is valid Url.
      */
     public static boolean isUrl(String value) {
-        return urlValidator.isValid(value);
+        return URL_VALIDATOR.isValid(value);
     }
 
     /**

Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Validator.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Validator.java?rev=366933&r1=366932&r2=366933&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Validator.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Validator.java Sat Jan  7 14:51:01 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.
@@ -337,6 +337,7 @@
      * @return The <code>Map</code> returned uses the property of the
      * <code>Field</code> for the key and the value is the number of error the
      * field had.
+     * @throws ValidatorException If an error occurs during validation
      */
     public ValidatorResults validate() throws ValidatorException {
         Locale locale = (Locale) this.getParameterValue(LOCALE_PARAM);

Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorAction.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorAction.java?rev=366933&r1=366932&r2=366933&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorAction.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorAction.java Sat Jan  7 14:51:01 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.
@@ -51,7 +51,7 @@
     /**
      * Logger.
      */
-    private static final Log log = LogFactory.getLog(ValidatorAction.class);
+    private transient Log log = LogFactory.getLog(ValidatorAction.class);
 
     /**
      * The name of the validation.
@@ -377,8 +377,8 @@
             return;
         }
 
-        if (log.isTraceEnabled()) {
-            log.trace("  Loading function begun");
+        if (getLog().isTraceEnabled()) {
+            getLog().trace("  Loading function begun");
         }
 
         if (this.jsFunction == null) {
@@ -387,14 +387,14 @@
 
         String javascriptFileName = this.formatJavascriptFileName();
 
-        if (log.isTraceEnabled()) {
-            log.trace("  Loading js function '" + javascriptFileName + "'");
+        if (getLog().isTraceEnabled()) {
+            getLog().trace("  Loading js function '" + javascriptFileName + "'");
         }
 
         this.javascript = this.readJavascriptFile(javascriptFileName);
 
-        if (log.isTraceEnabled()) {
-            log.trace("  Loading javascript function completed");
+        if (getLog().isTraceEnabled()) {
+            getLog().trace("  Loading javascript function completed");
         }
 
     }
@@ -416,7 +416,7 @@
         }
 
         if (is == null) {
-            log.debug("  Unable to read javascript name "+javascriptFileName);
+            getLog().debug("  Unable to read javascript name "+javascriptFileName);
             return null;
         }
 
@@ -429,13 +429,13 @@
             }
 
         } catch(IOException e) {
-            log.error("Error reading javascript file.", e);
+            getLog().error("Error reading javascript file.", e);
 
         } finally {
             try {
                 reader.close();
             } catch(IOException e) {
-                log.error("Error closing stream to javascript file.", e);
+                getLog().error("Error closing stream to javascript file.", e);
             }
         }
         
@@ -575,7 +575,7 @@
                 throw (ValidatorException) e;
             }
 
-            log.error(
+            getLog().error(
                 "Unhandled exception thrown during validation: " + e.getMessage(),
                 e);
 
@@ -770,4 +770,20 @@
         return v.getOnlyReturnErrors();
     }
 
+    /**
+     * Accessor method for Log instance.
+     *
+     * The Log instance variable is transient and
+     * accessing it through this method ensures it
+     * is re-initialized when this instance is
+     * de-serialized.
+     *
+     * @return The Log instance.
+     */
+    private Log getLog() {
+        if (log == null) {
+            log =  LogFactory.getLog(ValidatorAction.class);
+        }
+        return log;
+    }
 }

Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResources.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResources.java?rev=366933&r1=366932&r2=366933&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResources.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResources.java Sat Jan  7 14:51:01 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.
@@ -62,7 +62,7 @@
      * the versions of the configuration file DTDs that we know about.  There
      * <strong>MUST</strong> be an even number of Strings in this list!
      */
-    private static final String registrations[] = {
+    private static final String REGISTRATIONS[] = {
         "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN",
         "/org/apache/commons/validator/resources/validator_1_0.dtd",
         "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0.1//EN",
@@ -75,7 +75,7 @@
         "/org/apache/commons/validator/resources/validator_1_2_0.dtd"
     };
 
-    private static final Log log = LogFactory.getLog(ValidatorResources.class);
+    private transient Log log = LogFactory.getLog(ValidatorResources.class);
 
     /**
      * <code>Map</code> of <code>FormSet</code>s stored under
@@ -124,6 +124,7 @@
      * @throws IOException
      * @throws SAXException if the validation XML files are not valid or well
      * formed.
+     * @throws IOException  if an I/O error occurs processing the XML files
      * @since Validator 1.1
      */
     public ValidatorResources(InputStream in) throws IOException, SAXException {
@@ -139,6 +140,7 @@
      * @throws IOException
      * @throws SAXException if the validation XML files are not valid or well
      * formed.
+     * @throws IOException  if an I/O error occurs processing the XML files
      * @since Validator 1.1
      */
     public ValidatorResources(InputStream[] streams)
@@ -162,6 +164,7 @@
      * @throws IOException
      * @throws SAXException if the validation XML files are not valid or well
      * formed.
+     * @throws IOException  if an I/O error occurs processing the XML files
      * @since Validator 1.2
      */
     public ValidatorResources(String uri) throws IOException, SAXException {
@@ -176,6 +179,7 @@
      * @throws IOException
      * @throws SAXException if the validation XML files are not valid or well
      * formed.
+     * @throws IOException  if an I/O error occurs processing the XML files
      * @since Validator 1.2
      */
     public ValidatorResources(String[] uris)
@@ -206,16 +210,16 @@
         addOldArgRules(digester);
 
         // register DTDs
-        for (int i = 0; i < registrations.length; i += 2) {
-            URL url = this.getClass().getResource(registrations[i + 1]);
+        for (int i = 0; i < REGISTRATIONS.length; i += 2) {
+            URL url = this.getClass().getResource(REGISTRATIONS[i + 1]);
             if (url != null) {
-                digester.register(registrations[i], url.toString());
+                digester.register(REGISTRATIONS[i], url.toString());
             }
         }
         return digester;
     }
 
-    private static final String argsPattern 
+    private static final String ARGS_PATTERN 
                = "form-validation/formset/form/field/arg";
 
     /**
@@ -237,7 +241,7 @@
                 try {
                     arg.setPosition(Integer.parseInt(name.substring(3)));
                 } catch (Exception ex) {
-                    log.error("Error parsing Arg position: " 
+                    getLog().error("Error parsing Arg position: " 
                                + name + " " + arg + " " + ex);
                 }
 
@@ -247,10 +251,10 @@
         };
 
         // Add the rule for each of the arg elements
-        digester.addRule(argsPattern + "0", rule);
-        digester.addRule(argsPattern + "1", rule);
-        digester.addRule(argsPattern + "2", rule);
-        digester.addRule(argsPattern + "3", rule);
+        digester.addRule(ARGS_PATTERN + "0", rule);
+        digester.addRule(ARGS_PATTERN + "1", rule);
+        digester.addRule(ARGS_PATTERN + "2", rule);
+        digester.addRule(ARGS_PATTERN + "3", rule);
 
     }
 
@@ -264,20 +268,20 @@
     public void addFormSet(FormSet fs) {
         String key = this.buildKey(fs);
         if (key.length() == 0) {// there can only be one default formset
-            if (log.isWarnEnabled() && defaultFormSet != null) {
+            if (getLog().isWarnEnabled() && defaultFormSet != null) {
                 // warn the user he might not get the expected results
-                log.warn("Overriding default FormSet definition.");
+                getLog().warn("Overriding default FormSet definition.");
             }
             defaultFormSet = fs;
         } else {
             FormSet formset = (FormSet) hFormSets.get(key);
             if (formset == null) {// it hasn't been included yet
-                if (log.isDebugEnabled()) {
-                    log.debug("Adding FormSet '" + fs.toString() + "'.");
+                if (getLog().isDebugEnabled()) {
+                    getLog().debug("Adding FormSet '" + fs.toString() + "'.");
                 }
-            } else if (log.isWarnEnabled()) {// warn the user he might not
+            } else if (getLog().isWarnEnabled()) {// warn the user he might not
                                                 // get the expected results
-                log
+                getLog()
                         .warn("Overriding FormSet definition. Duplicate for locale: "
                                 + key);
             }
@@ -291,8 +295,8 @@
      * @param value The constant value.
      */
     public void addConstant(String name, String value) {
-        if (log.isDebugEnabled()) {
-            log.debug("Adding Global Constant: " + name + "," + value);
+        if (getLog().isDebugEnabled()) {
+            getLog().debug("Adding Global Constant: " + name + "," + value);
         }
 
         this.hConstants.put(name, value);
@@ -310,8 +314,8 @@
 
         this.hActions.put(va.getName(), va);
 
-        if (log.isDebugEnabled()) {
-            log.debug("Add ValidatorAction: " + va.getName() + "," + va.getClassname());
+        if (getLog().isDebugEnabled()) {
+            getLog().debug("Add ValidatorAction: " + va.getName() + "," + va.getClassname());
         }
     }
 
@@ -435,13 +439,13 @@
         }
 
         if (form == null) {
-            if (log.isWarnEnabled()) {
-                log.warn("Form '" + formKey + "' not found for locale '" +
+            if (getLog().isWarnEnabled()) {
+                getLog().warn("Form '" + formKey + "' not found for locale '" +
                          localeKey + "'");
             }
         } else {
-            if (log.isDebugEnabled()) {
-                log.debug("Form '" + formKey + "' found in formset '" +
+            if (getLog().isDebugEnabled()) {
+                getLog().debug("Form '" + formKey + "' found in formset '" +
                           key + "' for locale '" + localeKey + "'");
             }
         }
@@ -573,6 +577,23 @@
      */
     protected Map getActions() {
         return hActions;
+    }
+
+    /**
+     * Accessor method for Log instance.
+     *
+     * The Log instance variable is transient and
+     * accessing it through this method ensures it
+     * is re-initialized when this instance is
+     * de-serialized.
+     *
+     * @return The Log instance.
+     */
+    private Log getLog() {
+        if (log == null) {
+            log =  LogFactory.getLog(ValidatorResources.class);
+        }
+        return log;
     }
 
 }

Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/ValidatorUtils.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/ValidatorUtils.java?rev=366933&r1=366932&r2=366933&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/ValidatorUtils.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/ValidatorUtils.java Sat Jan  7 14:51:01 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.
@@ -44,7 +44,7 @@
  */
 public class ValidatorUtils {
 
-    private static final Log log = LogFactory.getLog(ValidatorUtils.class);
+    private static final Log LOG = LogFactory.getLog(ValidatorUtils.class);
 
     /**
      * <p>Replace part of a <code>String</code> with another value.</p>
@@ -107,11 +107,11 @@
             value = PropertyUtils.getProperty(bean, property);
 
         } catch(IllegalAccessException e) {
-            log.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         } catch(InvocationTargetException e) {
-            log.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         } catch(NoSuchMethodException e) {
-            log.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         }
 
         if (value == null) {

Added: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/package.html
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/package.html?rev=366933&view=auto
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/package.html (added)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/package.html Sat Jan  7 14:51:01 2006
@@ -0,0 +1,10 @@
+<html>
+<head>
+<title>Package Documentation for org.apache.commons.validator.util Package</title>
+</head>
+<body bgcolor="white">
+<p>
+This package contains utility classes used by Commons Validator.
+</p>
+</body>
+</html>

Propchange: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/package.html
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: jakarta/commons/proper/validator/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/xdocs/changes.xml?rev=366933&r1=366932&r2=366933&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/xdocs/changes.xml (original)
+++ jakarta/commons/proper/validator/trunk/xdocs/changes.xml Sat Jan  7 14:51:01 2006
@@ -47,12 +47,8 @@
       </action>
     </release>
 
-    <release version="1.2.0" date="2005-11-15">
-      <description>
-          Validator 1.2.0 General Availability release - see
-          <a href="http://wiki.apache.org/jakarta-commons/ValidatorVersion120">
-          Version 1.2.0 Wiki Notes</a> for more details.
-      </description>
+    <release version="1.2.0" date="2005-11-15" 
+       description="see http://wiki.apache.org/jakarta-commons/ValidatorVersion120">
       <action dev="dgraham" type="add" issue="31489">
         Added ISBNValidator for validating book numbers.
       </action>
@@ -179,7 +175,7 @@
       </action>
     </release>
   
-    <release version="1.1.4" date="2004-11-12">
+    <release version="1.1.4" date="2004-11-12" description="Minor maintenance release.">
       <action dev="niallp" type="add" issue="29452">
         Added getMessage(key) and getMessages() methods to Field
       </action>



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