vmassol     2002/08/31 07:43:40

  Modified:    framework/src/java/share/org/apache/cactus/util Tag:
                        CACTUS_14_BRANCH ClassLoaderUtils.java
               documentation/docs/xdocs Tag: CACTUS_14_BRANCH 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
  No                   revision
  
  
  No                   revision
  
  
  1.2.6.1   +14 -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.2
  retrieving revision 1.2.6.1
  diff -u -r1.2 -r1.2.6.1
  --- ClassLoaderUtils.java     12 May 2002 19:41:14 -0000      1.2
  +++ ClassLoaderUtils.java     31 Aug 2002 14:43:40 -0000      1.2.6.1
  @@ -148,9 +148,19 @@
           ResourceBundle bundle;
   
           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) {
               // Then, try to load from context classloader
               bundle = PropertyResourceBundle.getBundle(theName,
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.35.2.11 +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.35.2.10
  retrieving revision 1.35.2.11
  diff -u -r1.35.2.10 -r1.35.2.11
  --- changes.xml       30 Aug 2002 20:17:59 -0000      1.35.2.10
  +++ changes.xml       31 Aug 2002 14:43:40 -0000      1.35.2.11
  @@ -48,6 +48,13 @@
       </devs>
   
       <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]>

Reply via email to