--- old/src/share/classes/com/sun/jndi/toolkit/url/GenericURLContext.java Mon May 13 06:49:21 2013 +++ new/src/share/classes/com/sun/jndi/toolkit/url/GenericURLContext.java Mon May 13 06:49:19 2013 @@ -53,7 +53,8 @@ @SuppressWarnings("unchecked") // Expect Hashtable public GenericURLContext(Hashtable env) { // context that is not tied to any specific URL - myEnv = (Hashtable)env; // copied on write + myEnv = + (Hashtable)(env == null ? null : env.clone()); } public void close() throws NamingException { @@ -494,7 +495,6 @@ if (myEnv == null) { return null; } - myEnv = (Hashtable)myEnv.clone(); return myEnv.remove(propName); } @@ -501,9 +501,9 @@ @SuppressWarnings("unchecked") // clone() public Object addToEnvironment(String propName, Object propVal) throws NamingException { - myEnv = (myEnv == null) - ? new Hashtable(11, 0.75f) - : (Hashtable)myEnv.clone(); + if (myEnv == null) { + myEnv = new Hashtable(11, 0.75f); + } return myEnv.put(propName, propVal); }