tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1005789 - in /tomcat/trunk/java/org/apache/naming: NamingContext.java NamingContextBindingsEnumeration.java
Date Fri, 08 Oct 2010 11:57:04 GMT
Author: markt
Date: Fri Oct  8 11:57:04 2010
New Revision: 1005789

URL: http://svn.apache.org/viewvc?rev=1005789&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49994
Lookup of JNDI references should return a new object instance each time

Modified:
    tomcat/trunk/java/org/apache/naming/NamingContext.java
    tomcat/trunk/java/org/apache/naming/NamingContextBindingsEnumeration.java

Modified: tomcat/trunk/java/org/apache/naming/NamingContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/NamingContext.java?rev=1005789&r1=1005788&r2=1005789&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/NamingContext.java (original)
+++ tomcat/trunk/java/org/apache/naming/NamingContext.java Fri Oct  8 11:57:04 2010
@@ -797,10 +797,6 @@ public class NamingContext implements Co
                 try {
                     Object obj = NamingManager.getObjectInstance
                         (entry.value, name, this, env);
-                    if (obj != null) {
-                        entry.value = obj;
-                        entry.type = NamingEntry.ENTRY;
-                    }
                     return obj; 
                 } catch (NamingException e) {
                     throw e;

Modified: tomcat/trunk/java/org/apache/naming/NamingContextBindingsEnumeration.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/NamingContextBindingsEnumeration.java?rev=1005789&r1=1005788&r2=1005789&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/NamingContextBindingsEnumeration.java (original)
+++ tomcat/trunk/java/org/apache/naming/NamingContextBindingsEnumeration.java Fri Oct  8 11:57:04
2010
@@ -105,13 +105,13 @@ public class NamingContextBindingsEnumer
     
     private Binding nextElementInternal() throws NamingException {
         NamingEntry entry = iterator.next();
+        Object value;
         
         // If the entry is a reference, resolve it
         if (entry.type == NamingEntry.REFERENCE
                 || entry.type == NamingEntry.LINK_REF) {
             try {
-                // A lookup will resolve the entry
-                ctx.lookup(new CompositeName(entry.name));
+                value = ctx.lookup(new CompositeName(entry.name));
             } catch (NamingException e) {
                 throw e;
             } catch (Exception e) {
@@ -119,12 +119,11 @@ public class NamingContextBindingsEnumer
                 ne.initCause(e);
                 throw ne;
             }
+        } else {
+            value = entry.value;
         }
         
-        return new Binding(entry.name, entry.value.getClass().getName(), 
-                           entry.value, true);
+        return new Binding(entry.name, value.getClass().getName(), value, true);
     }
-
-
 }
 



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


Mime
View raw message