--- old/src/share/classes/com/sun/jndi/toolkit/ctx/Continuation.java Mon May 13 06:49:15 2013 +++ new/src/share/classes/com/sun/jndi/toolkit/ctx/Continuation.java Mon May 13 06:49:13 2013 @@ -90,14 +90,15 @@ * Constructs a new instance of Continuation. * @param top The name of the object that is to be resolved/operated upon. * This becomes the Continuation's 'starter' and is used to - * calculate the "resolved name" when filling in a NamingException. + * calculate the "resolved name" when filling in a NamingException. * @param environment The environment used by the caller. It is used - * when setting the "environment" of a CannotProceedException. + * when setting the "environment" of a CannotProceedException. */ public Continuation(Name top, Hashtable environment) { super(); starter = top; - this.environment = environment; + this.environment = (Hashtable) + ((environment == null) ? null : environment.clone()); } /** --- old/src/share/classes/com/sun/jndi/toolkit/dir/LazySearchEnumerationImpl.java Mon May 13 06:49:18 2013 +++ new/src/share/classes/com/sun/jndi/toolkit/dir/LazySearchEnumerationImpl.java Mon May 13 06:49:16 2013 @@ -69,6 +69,7 @@ } } + @SuppressWarnings("unchecked") // For Hashtable clone: env.clone() public LazySearchEnumerationImpl(NamingEnumeration candidates, AttrFilter filter, SearchControls cons, Context ctx, Hashtable env, boolean useFactory) @@ -76,7 +77,8 @@ this.candidates = candidates; this.filter = filter; - this.env = env; + this.env = (Hashtable) + ((env == null) ? null : env.clone()); this.context = ctx; this.useFactory = useFactory; --- 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); }