sanders 01/05/01 19:36:57
Modified: digester/src/java/org/apache/commons/digester
CallMethodRule.java ObjectCreateRule.java
SetNextRule.java SetTopRule.java
Log:
Update to JDK 1.2 method of loading classes that is multiple classloader
friendly. Helps in server environments.
Thanks to Colin Sampaleanu ([EMAIL PROTECTED]) for the heads up
Revision Changes Path
1.3 +7 -5
jakarta-commons-sandbox/digester/src/java/org/apache/commons/digester/CallMethodRule.java
Index: CallMethodRule.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/digester/src/java/org/apache/commons/digester/CallMethodRule.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CallMethodRule.java 2001/04/16 21:30:42 1.2
+++ CallMethodRule.java 2001/05/02 02:36:52 1.3
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-commons-sandbox/digester/src/java/org/apache/commons/digester/CallMethodRule.java,v
1.2 2001/04/16 21:30:42 geirm Exp $
- * $Revision: 1.2 $
- * $Date: 2001/04/16 21:30:42 $
+ * $Header:
/home/cvs/jakarta-commons-sandbox/digester/src/java/org/apache/commons/digester/CallMethodRule.java,v
1.3 2001/05/02 02:36:52 sanders Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/05/02 02:36:52 $
*
* ====================================================================
*
@@ -75,7 +75,7 @@
* element.
*
* @author Craig McClanahan
- * @version $Revision: 1.2 $ $Date: 2001/04/16 21:30:42 $
+ * @version $Revision: 1.3 $ $Date: 2001/05/02 02:36:52 $
*/
public class CallMethodRule extends Rule {
@@ -127,7 +127,9 @@
this.paramTypes = new Class[paramTypes.length];
for (int i = 0; i < this.paramTypes.length; i++) {
try {
- this.paramTypes[i] = Class.forName(paramTypes[i]);
+ this.paramTypes[i] = Thread.currentThread()
+ .getContextClassLoader()
+ .loadClass(paramTypes[i]);
} catch (ClassNotFoundException e) {
this.paramTypes[i] = null; // Will cause NPE later
}
1.2 +7 -5
jakarta-commons-sandbox/digester/src/java/org/apache/commons/digester/ObjectCreateRule.java
Index: ObjectCreateRule.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/digester/src/java/org/apache/commons/digester/ObjectCreateRule.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ObjectCreateRule.java 2001/04/16 21:16:29 1.1
+++ ObjectCreateRule.java 2001/05/02 02:36:53 1.2
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-commons-sandbox/digester/src/java/org/apache/commons/digester/ObjectCreateRule.java,v
1.1 2001/04/16 21:16:29 sanders Exp $
- * $Revision: 1.1 $
- * $Date: 2001/04/16 21:16:29 $
+ * $Header:
/home/cvs/jakarta-commons-sandbox/digester/src/java/org/apache/commons/digester/ObjectCreateRule.java,v
1.2 2001/05/02 02:36:53 sanders Exp $
+ * $Revision: 1.2 $
+ * $Date: 2001/05/02 02:36:53 $
*
* ====================================================================
*
@@ -72,7 +72,7 @@
* object will be popped
*
* @author Craig McClanahan
- * @version $Revision: 1.1 $ $Date: 2001/04/16 21:16:29 $
+ * @version $Revision: 1.2 $ $Date: 2001/05/02 02:36:53 $
*/
public class ObjectCreateRule extends Rule {
@@ -149,7 +149,9 @@
digester.log("New " + realClassName);
// Instantiate the new object and push it on the context stack
- Class clazz = Class.forName(realClassName);
+ Class clazz = Thread.currentThread()
+ .getContextClassLoader()
+ .loadClass(realClassName);
Object instance = clazz.newInstance();
digester.push(instance);
1.2 +7 -5
jakarta-commons-sandbox/digester/src/java/org/apache/commons/digester/SetNextRule.java
Index: SetNextRule.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/digester/src/java/org/apache/commons/digester/SetNextRule.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SetNextRule.java 2001/04/16 21:16:30 1.1
+++ SetNextRule.java 2001/05/02 02:36:53 1.2
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-commons-sandbox/digester/src/java/org/apache/commons/digester/SetNextRule.java,v
1.1 2001/04/16 21:16:30 sanders Exp $
- * $Revision: 1.1 $
- * $Date: 2001/04/16 21:16:30 $
+ * $Header:
/home/cvs/jakarta-commons-sandbox/digester/src/java/org/apache/commons/digester/SetNextRule.java,v
1.2 2001/05/02 02:36:53 sanders Exp $
+ * $Revision: 1.2 $
+ * $Date: 2001/05/02 02:36:53 $
*
* ====================================================================
*
@@ -73,7 +73,7 @@
* commonly used to establish parent-child relationships.
*
* @author Craig McClanahan
- * @version $Revision: 1.1 $ $Date: 2001/04/16 21:16:30 $
+ * @version $Revision: 1.2 $ $Date: 2001/05/02 02:36:53 $
*/
public class SetNextRule extends Rule {
@@ -150,7 +150,9 @@
// Call the specified method
Class paramTypes[] = new Class[1];
if (paramType != null)
- paramTypes[0] = Class.forName(paramType);
+ paramTypes[0] = Thread.currentThread()
+ .getContextClassLoader()
+ .loadClass(paramType);
else
paramTypes[0] = child.getClass();
Method method = parent.getClass().getMethod(methodName, paramTypes);
1.2 +7 -5
jakarta-commons-sandbox/digester/src/java/org/apache/commons/digester/SetTopRule.java
Index: SetTopRule.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/digester/src/java/org/apache/commons/digester/SetTopRule.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SetTopRule.java 2001/04/16 21:16:30 1.1
+++ SetTopRule.java 2001/05/02 02:36:54 1.2
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-commons-sandbox/digester/src/java/org/apache/commons/digester/SetTopRule.java,v
1.1 2001/04/16 21:16:30 sanders Exp $
- * $Revision: 1.1 $
- * $Date: 2001/04/16 21:16:30 $
+ * $Header:
/home/cvs/jakarta-commons-sandbox/digester/src/java/org/apache/commons/digester/SetTopRule.java,v
1.2 2001/05/02 02:36:54 sanders Exp $
+ * $Revision: 1.2 $
+ * $Date: 2001/05/02 02:36:54 $
*
* ====================================================================
*
@@ -72,7 +72,7 @@
* object, passing the (top-1) (child) object as an argument.
*
* @author Craig McClanahan
- * @version $Revision: 1.1 $ $Date: 2001/04/16 21:16:30 $
+ * @version $Revision: 1.2 $ $Date: 2001/05/02 02:36:54 $
*/
public class SetTopRule extends Rule {
@@ -149,7 +149,9 @@
// Call the specified method
Class paramTypes[] = new Class[1];
if (paramType != null)
- paramTypes[0] = Class.forName(paramType);
+ paramTypes[0] = Thread.currentThread()
+ .getContextClassLoader()
+ .loadClass(paramType);
else
paramTypes[0] = child.getClass();
Method method = parent.getClass().getMethod(methodName, paramTypes);