geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r516641 - /geronimo/xbean/trunk/xbean-naming/src/main/java/org/apache/xbean/naming/context/AbstractContext.java
Date Sat, 10 Mar 2007 02:25:25 GMT
Author: dain
Date: Fri Mar  9 18:25:24 2007
New Revision: 516641

URL: http://svn.apache.org/viewvc?view=rev&rev=516641
Log:
Add simple check for recursive calls

Modified:
    geronimo/xbean/trunk/xbean-naming/src/main/java/org/apache/xbean/naming/context/AbstractContext.java

Modified: geronimo/xbean/trunk/xbean-naming/src/main/java/org/apache/xbean/naming/context/AbstractContext.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-naming/src/main/java/org/apache/xbean/naming/context/AbstractContext.java?view=diff&rev=516641&r1=516640&r2=516641
==============================================================================
--- geronimo/xbean/trunk/xbean-naming/src/main/java/org/apache/xbean/naming/context/AbstractContext.java
(original)
+++ geronimo/xbean/trunk/xbean-naming/src/main/java/org/apache/xbean/naming/context/AbstractContext.java
Fri Mar  9 18:25:24 2007
@@ -40,6 +40,7 @@
     private final Name parsedNameInNamespace;
     private final ContextAccess contextAccess;
     private final boolean modifiable;
+    private final ThreadLocal inCall = new ThreadLocal();
 
     protected AbstractContext(String nameInNamespace) {
         this(nameInNamespace, ContextAccess.MODIFIABLE);
@@ -171,12 +172,15 @@
      * @return the value or null if no fault value could be found
      */
     protected Object faultLookup(String stringName, Name parsedName) {
-        if (stringName.indexOf(':') > 0) {
+        if (!stringName.startsWith(nameInNamespace) && stringName.indexOf(':') >
0 && inCall.get() == null) {
+            inCall.set(parsedName);
             try {
                 Context ctx = new InitialContext();
                 return ctx.lookup(parsedName);
             } catch (NamingException ignored) {
                 // thrown below
+            } finally {
+                inCall.set(null);                
             }
         }
         return null;



Mime
View raw message