src/share/classes/com/sun/jndi/cosnaming/CNCtx.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -1061,16 +1061,15 @@
 
     /**
       * Returns the current environment.
       * @return Environment.
       */
-    @SuppressWarnings("unchecked")
     public  Hashtable<String, java.lang.Object> getEnvironment() throws NamingException {
         if (_env == null) {
             return new Hashtable<>(5, 0.75f);
         } else {
-            return (Hashtable<String, java.lang.Object>)_env.clone();
+            return _env.clone();
         }
     }
 
     public String composeName(String name, String prefix) throws NamingException {
         return composeName(new CompositeName(name),

@@ -1088,31 +1087,29 @@
       *
       * @param propName The property name.
       * @param propVal  The ORB.
       * @return the previous value of this property if any.
       */
-    @SuppressWarnings("unchecked")
     public java.lang.Object addToEnvironment(String propName,
         java.lang.Object propValue)
         throws NamingException {
             if (_env == null) {
                 _env = new Hashtable<>(7, 0.75f);
             } else {
                 // copy-on-write
-                _env = (Hashtable<String, java.lang.Object>)_env.clone();
+                _env = _env.clone();
             }
 
             return _env.put(propName, propValue);
     }
 
     // Record change but do not reinitialize ORB
-    @SuppressWarnings("unchecked")
     public java.lang.Object removeFromEnvironment(String propName)
         throws NamingException {
             if (_env != null  && _env.get(propName) != null) {
                 // copy-on-write
-                _env = (Hashtable<String, java.lang.Object>)_env.clone();
+                _env = _env.clone();
                 return _env.remove(propName);
             }
             return null;
     }