commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mart...@apache.org
Subject svn commit: r399539 - /jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorAction.java
Date Thu, 04 May 2006 04:27:43 GMT
Author: martinc
Date: Wed May  3 21:27:39 2006
New Revision: 399539

URL: http://svn.apache.org/viewcvs?rev=399539&view=rev
Log:
Bugzilla #39393 - Thread-safety issue.
Submitted by Takayuki Kaneko.

Modified:
    jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorAction.java

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=399539&r1=399538&r2=399539&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
Wed May  3 21:27:39 2006
@@ -527,10 +527,14 @@
         params.put(Validator.VALIDATOR_ACTION_PARAM, this);
 
         try {
-            ClassLoader loader = this.getClassLoader(params);
-            this.loadValidationClass(loader);
-            this.loadParameterClasses(loader);
-            this.loadValidationMethod();
+            if (this.validationMethod == null) {
+                synchronized(this) {
+                    ClassLoader loader = this.getClassLoader(params);
+                    this.loadValidationClass(loader);
+                    this.loadParameterClasses(loader);
+                    this.loadValidationMethod();
+                }
+            }
 
             Object[] paramValues = this.getParameterValues(params);
             
@@ -638,18 +642,20 @@
             return;
         }
         
-        this.parameterClasses = new Class[this.methodParameterList.size()];
+        Class[] parameterClasses = new Class[this.methodParameterList.size()];
 
         for (int i = 0; i < this.methodParameterList.size(); i++) {
             String paramClassName = (String) this.methodParameterList.get(i);
 
             try {
-                this.parameterClasses[i] = loader.loadClass(paramClassName);
+                parameterClasses[i] = loader.loadClass(paramClassName);
                     
             } catch (ClassNotFoundException e) {
                 throw new ValidatorException(e.getMessage());
             }
         }
+
+        this.parameterClasses = parameterClasses;
     }
     
     /**



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