As per recent messages about classloading in the Digester, below is a patch
for the Digester...

One other possible effect that has not been discussed is that there may be a
few environments where Class.forname() would work, but the context
classloader loadclass() variant would not, due to security restrictions on
obtaining the context classloader. This is a common operation and should not
be an issue, but if it is, the could could try the context classloader
approach, and simply try the Class.forName approach on any SecurityException
caught...


PATCH:
---

Index: CallMethodRule.java
===================================================================
RCS file:
/home/cvspublic/jakarta-struts/src/share/org/apache/struts/digester/CallMeth
odRule.java,v
retrieving revision 1.10
diff -r1.10 CallMethodRule.java
130c130
<                     this.paramTypes[i] = Class.forName(paramTypes[i]);
---
>                     this.paramTypes[i] =
Thread.currentThread().getContextClassLoader().loadClass(paramTypes[i]);
Index: ObjectCreateRule.java
===================================================================
RCS file:
/home/cvspublic/jakarta-struts/src/share/org/apache/struts/digester/ObjectCr
eateRule.java,v
retrieving revision 1.3
diff -r1.3 ObjectCreateRule.java
152c152
<       Class clazz = Class.forName(realClassName);
---
>       Class clazz =
Thread.currentThread().getContextClassLoader().loadClass(realClassName);
Index: SetNextRule.java
===================================================================
RCS file:
/home/cvspublic/jakarta-struts/src/share/org/apache/struts/digester/SetNextR
ule.java,v
retrieving revision 1.4
diff -r1.4 SetNextRule.java
153c153
<           paramTypes[0] = Class.forName(paramType);
---
>           paramTypes[0] =
Thread.currentThread().getContextClassLoader().loadClass(paramType);
Index: SetTopRule.java
===================================================================
RCS file:
/home/cvspublic/jakarta-struts/src/share/org/apache/struts/digester/SetTopRu
le.java,v
retrieving revision 1.5
diff -r1.5 SetTopRule.java
152c152
<           paramTypes[0] = Class.forName(paramType);
---
>           paramTypes[0] =
Thread.currentThread().getContextClassLoader().loadClass(paramType);

Reply via email to