tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/naming ContextBindings.java
Date Fri, 31 May 2002 02:55:21 GMT
remm        2002/05/30 19:55:21

  Modified:    catalina/src/share/org/apache/naming ContextBindings.java
  Log:
  - Make the JNDI context available from webapp created CL (as long as one
    of the parents in the hierarchy is the webapp CL).
  - Patch submitted by David Haraburda <david-tomcat at haraburda.com>
  
  Revision  Changes    Path
  1.7       +31 -18    jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/ContextBindings.java
  
  Index: ContextBindings.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/ContextBindings.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ContextBindings.java	16 Apr 2002 00:42:10 -0000	1.6
  +++ ContextBindings.java	31 May 2002 02:55:21 -0000	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/ContextBindings.java,v
1.6 2002/04/16 00:42:10 remm Exp $
  - * $Revision: 1.6 $
  - * $Date: 2002/04/16 00:42:10 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/ContextBindings.java,v
1.7 2002/05/31 02:55:21 remm Exp $
  + * $Revision: 1.7 $
  + * $Date: 2002/05/31 02:55:21 $
    *
    * ====================================================================
    *
  @@ -76,7 +76,7 @@
    * </ul>
    *
    * @author Remy Maucherat
  - * @version $Revision: 1.6 $ $Date: 2002/04/16 00:42:10 $
  + * @version $Revision: 1.7 $ $Date: 2002/05/31 02:55:21 $
    */
   
   public class ContextBindings {
  @@ -361,12 +361,16 @@
        */
       public static Context getClassLoader()
           throws NamingException {
  -        Context context = (Context) clBindings.get
  -            (Thread.currentThread().getContextClassLoader());
  -        if (context == null)
  -            throw new NamingException
  -                (sm.getString("contextBindings.noContextBoundToCL"));
  -        return context;
  +        ClassLoader cl = Thread.currentThread().getContextClassLoader();
  +        Context context = null;
  +        do {
  +            context = (Context) clBindings.get(cl);
  +            if (context != null) {
  +                return context;
  +            }
  +        } while ((cl = cl.getParent()) != null);
  +        throw new NamingException
  +            (sm.getString("contextBindings.noContextBoundToCL"));
       }
   
   
  @@ -375,12 +379,16 @@
        */
       static Object getClassLoaderName()
           throws NamingException {
  -        Object name = 
  -            clNameBindings.get(Thread.currentThread().getContextClassLoader());
  -        if (name == null)
  -            throw new NamingException
  -                (sm.getString("contextBindings.noContextBoundToCL"));
  -        return name;
  +        ClassLoader cl = Thread.currentThread().getContextClassLoader();
  +        Object name = null;
  +        do {
  +            name = clNameBindings.get(cl);
  +            if (name != null) {
  +                return name;
  +            }
  +        } while ((cl = cl.getParent()) != null);
  +        throw new NamingException
  +            (sm.getString("contextBindings.noContextBoundToCL"));
       }
   
   
  @@ -388,8 +396,13 @@
        * Tests if current class loader is bound to a context.
        */
       public static boolean isClassLoaderBound() {
  -        return (clBindings.containsKey
  -                (Thread.currentThread().getContextClassLoader()));
  +        ClassLoader cl = Thread.currentThread().getContextClassLoader();
  +        do {
  +            if (clBindings.containsKey(cl)) {
  +                return true;
  +            }
  +        } while ((cl = cl.getParent()) != null);
  +        return false;
       }
   
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message