commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons/jelly/src/java/org/apache/commons/jelly/tags/core InvokeStaticTag.java
Date Thu, 20 Feb 2003 15:57:57 GMT
jstrachan    2003/02/20 07:57:57

  Modified:    jelly/src/java/org/apache/commons/jelly/tags/core
                        InvokeStaticTag.java
  Log:
  patch to handle null thread context class loader which was spotted by eagle-eyed dIon :)
  
  Revision  Changes    Path
  1.2       +14 -9     jakarta-commons/jelly/src/java/org/apache/commons/jelly/tags/core/InvokeStaticTag.java
  
  Index: InvokeStaticTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/src/java/org/apache/commons/jelly/tags/core/InvokeStaticTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InvokeStaticTag.java	19 Feb 2003 07:44:35 -0000	1.1
  +++ InvokeStaticTag.java	20 Feb 2003 15:57:56 -0000	1.2
  @@ -195,11 +195,16 @@
        * current threads context class loader
        */ 
       protected Class loadClass() throws ClassNotFoundException {
  -        Class theClass = getClass().getClassLoader().loadClass( className );
  -        if (theClass == null ) {
  -            theClass = Thread.currentThread().getContextClassLoader().loadClass( className
);
  +        ClassLoader loader = getClass().getClassLoader();
  +        if (loader != null) {
  +            try {
  +                return loader.loadClass( className );
  +            }
  +            catch (ClassNotFoundException e) {
  +                // ignore this exception as we'll try another loader
  +            }
           }
  -        return theClass; 
  +        return getClass().getClassLoader().loadClass( className );
       }
   
   	/**
  
  
  

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