src/share/classes/com/sun/jndi/toolkit/url/GenericURLContext.java

Print this page

        

*** 51,61 **** protected Hashtable<String, Object> myEnv = null; @SuppressWarnings("unchecked") // Expect Hashtable<String, Object> public GenericURLContext(Hashtable<?,?> env) { // context that is not tied to any specific URL ! myEnv = (Hashtable<String, Object>)env; // copied on write } public void close() throws NamingException { myEnv = null; } --- 51,62 ---- protected Hashtable<String, Object> myEnv = null; @SuppressWarnings("unchecked") // Expect Hashtable<String, Object> public GenericURLContext(Hashtable<?,?> env) { // context that is not tied to any specific URL ! myEnv = ! (Hashtable<String, Object>)(env == null ? null : env.clone()); } public void close() throws NamingException { myEnv = null; }
*** 492,511 **** public Object removeFromEnvironment(String propName) throws NamingException { if (myEnv == null) { return null; } - myEnv = (Hashtable<String, Object>)myEnv.clone(); return myEnv.remove(propName); } @SuppressWarnings("unchecked") // clone() public Object addToEnvironment(String propName, Object propVal) throws NamingException { ! myEnv = (myEnv == null) ! ? new Hashtable<String, Object>(11, 0.75f) ! : (Hashtable<String, Object>)myEnv.clone(); return myEnv.put(propName, propVal); } @SuppressWarnings("unchecked") // clone() public Hashtable<String, Object> getEnvironment() throws NamingException { --- 493,511 ---- public Object removeFromEnvironment(String propName) throws NamingException { if (myEnv == null) { return null; } return myEnv.remove(propName); } @SuppressWarnings("unchecked") // clone() public Object addToEnvironment(String propName, Object propVal) throws NamingException { ! if (myEnv == null) { ! myEnv = new Hashtable<String, Object>(11, 0.75f); ! } return myEnv.put(propName, propVal); } @SuppressWarnings("unchecked") // clone() public Hashtable<String, Object> getEnvironment() throws NamingException {