vmassol 2002/08/31 07:45:42
Modified: framework/src/java/share/org/apache/cactus/util
ClassLoaderUtils.java
documentation/docs/xdocs changes.xml
Log:
Some JDK implementation return "null" when Class.getClassLoader() is called to
indicate that the given class has been loaded by the bootstrap class loader. This was
leading to <code>NullPointerException</code> being thrown by Cactus in some cases.
Revision Changes Path
1.4 +17 -4
jakarta-cactus/framework/src/java/share/org/apache/cactus/util/ClassLoaderUtils.java
Index: ClassLoaderUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/framework/src/java/share/org/apache/cactus/util/ClassLoaderUtils.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ClassLoaderUtils.java 28 Aug 2002 19:56:03 -0000 1.3
+++ ClassLoaderUtils.java 31 Aug 2002 14:45:41 -0000 1.4
@@ -150,9 +150,22 @@
try
{
- // Then, try to load from the referrer class loader first
- bundle = PropertyResourceBundle.getBundle(theName,
- Locale.getDefault(), theReferrer.getClassLoader());
+ // Try to load from the referrer class loader first
+
+ // Some JDK implementation will return "null" when calling
+ // getClassLoader(), signalling that the classloader is the
+ // bootstrap class loader. However, getBundle() does not support
+ // passing null for the class loader, hence the following test.
+ if (theReferrer.getClassLoader() == null)
+ {
+ bundle = PropertyResourceBundle.getBundle(theName,
+ Locale.getDefault());
+ }
+ else
+ {
+ bundle = PropertyResourceBundle.getBundle(theName,
+ Locale.getDefault(), theReferrer.getClassLoader());
+ }
}
catch (MissingResourceException e)
{
1.43 +7 -0 jakarta-cactus/documentation/docs/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/jakarta-cactus/documentation/docs/xdocs/changes.xml,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- changes.xml 30 Aug 2002 20:20:57 -0000 1.42
+++ changes.xml 31 Aug 2002 14:45:41 -0000 1.43
@@ -73,6 +73,13 @@
</release>
<release version="1.4.1" date="31 August 2002">
+ <action dev="VMA" type="fix" due-to="Gerhard Kreutzer"
due-to-email="[EMAIL PROTECTED]">
+ Some JDK implementation return "null" when Class.getClassLoader() is
+ called to indicate that the given class has been loaded by the
+ bootstrap class loader. This was leading to
+ <code>NullPointerException</code> being thrown by Cactus in some
+ cases.
+ </action>
<action dev="VMA" type="fix" due-to="Ville Skyttä"
due-to-email="[EMAIL PROTECTED]">
Fixed import bug in sample-servlet which prevented building Cactus
from the sources on JDK 1.4.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>