activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r905958 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/jndi/ReadOnlyContext.java
Date Wed, 03 Feb 2010 09:49:22 GMT
Author: rajdavies
Date: Wed Feb  3 09:49:21 2010
New Revision: 905958

URL: http://svn.apache.org/viewvc?rev=905958&view=rev
Log:
applied patch for https://issues.apache.org/activemq/browse/AMQ-2220

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/jndi/ReadOnlyContext.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/jndi/ReadOnlyContext.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/jndi/ReadOnlyContext.java?rev=905958&r1=905957&r2=905958&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/jndi/ReadOnlyContext.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/jndi/ReadOnlyContext.java
Wed Feb  3 09:49:21 2010
@@ -23,7 +23,6 @@
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.Map;
-
 import javax.naming.Binding;
 import javax.naming.CompositeName;
 import javax.naming.Context;
@@ -38,6 +37,8 @@
 import javax.naming.OperationNotSupportedException;
 import javax.naming.Reference;
 import javax.naming.spi.NamingManager;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * A read-only Context <p/> This version assumes it and all its subcontext are
@@ -61,7 +62,7 @@
  */
 @SuppressWarnings("unchecked")
 public class ReadOnlyContext implements Context, Serializable {
-
+    private static final Log LOG = LogFactory.getLog(ReadOnlyContext.class);
     public static final String SEPARATOR = "/";
     protected static final NameParser NAME_PARSER = new NameParserImpl();
     private static final long serialVersionUID = -5754338187296859149L;
@@ -95,7 +96,17 @@
         } else {
             this.environment = new Hashtable<String, Object>(environment);
         }
-        this.bindings = bindings;
+        this.bindings = new HashMap<String, Object>();
+        if (bindings != null) {
+            for (Map.Entry<String, Object> binding : bindings.entrySet()) {
+                try {
+                    internalBind(binding.getKey(), binding.getValue());
+                } catch (NamingException e) {
+                    LOG.error("Failed to bind " + binding.getKey() + "=" + binding.getValue(),
e);
+                }
+            }
+        }
+
         treeBindings = new HashMap<String, Object>();
         frozen = true;
     }
@@ -373,7 +384,7 @@
     }
 
     private abstract class LocalNamingEnumeration implements NamingEnumeration {
-        private Iterator i = bindings.entrySet().iterator();
+        private final Iterator i = bindings.entrySet().iterator();
 
         public boolean hasMore() throws NamingException {
             return i.hasNext();



Mime
View raw message