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/factory ResourceLinkFactory.java
Date Fri, 09 Nov 2001 19:32:21 GMT
remm        01/11/09 11:32:21

  Modified:    catalina/src/share/org/apache/naming/factory
                        ResourceLinkFactory.java
  Log:
  - Make the factory tolerant with globalNames used.
  - First, it will try globalName as absolute, then will try again with "/comp" and
    "/comp/env" prefixes.
  
  Revision  Changes    Path
  1.2       +24 -5     jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/ResourceLinkFactory.java
  
  Index: ResourceLinkFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/ResourceLinkFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ResourceLinkFactory.java	2001/11/08 19:33:20	1.1
  +++ ResourceLinkFactory.java	2001/11/09 19:32:21	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/ResourceLinkFactory.java,v
1.1 2001/11/08 19:33:20 remm Exp $
  - * $Revision: 1.1 $
  - * $Date: 2001/11/08 19:33:20 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/ResourceLinkFactory.java,v
1.2 2001/11/09 19:32:21 remm Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/11/09 19:32:21 $
    *
    * ====================================================================
    *
  @@ -80,7 +80,7 @@
    * <p>Object factory for resource links.</p>
    * 
    * @author Remy Maucherat
  - * @version $Revision: 1.1 $ $Date: 2001/11/08 19:33:20 $
  + * @version $Revision: 1.2 $ $Date: 2001/11/09 19:32:21 $
    */
   
   public class ResourceLinkFactory
  @@ -139,7 +139,26 @@
           RefAddr refAddr = ref.get(ResourceLinkRef.GLOBALNAME);
           if (refAddr != null) {
               globalName = refAddr.getContent().toString();
  -            Object result = globalContext.lookup(globalName);
  +            Object result = null;
  +            try {
  +                result = globalContext.lookup(globalName);
  +            } catch (NamingException e) {
  +                // Ignore
  +            }
  +            if ((result == null) && (!globalName.startsWith("/comp"))) {
  +                try {
  +                    result = globalContext.lookup("/comp/" + globalName);
  +                } catch (NamingException e) {
  +                    // Ignore
  +                }
  +            }
  +            if ((result == null) && (!globalName.startsWith("/comp/env"))) {
  +                try {
  +                    result = globalContext.lookup("/comp/env/" + globalName);
  +                } catch (NamingException e) {
  +                    // Ignore
  +                }
  +            }
               // FIXME: Check type
               return result;
           }
  
  
  

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