src/share/classes/javax/naming/InitialContext.java

Print this page

        

@@ -230,14 +230,16 @@
      * @throws  NamingException if a naming exception is encountered
      *
      * @see #InitialContext(boolean)
      * @since 1.3
      */
+    @SuppressWarnings("unchecked")
     protected void init(Hashtable<?,?> environment)
         throws NamingException
     {
-        myProps = ResourceManager.getInitialEnvironment(environment);
+        myProps = (Hashtable<Object,Object>)
+                ResourceManager.getInitialEnvironment(environment);
 
         if (myProps.get(Context.INITIAL_CONTEXT_FACTORY) != null) {
             // user has specified initial context factory; try to get it
             getDefaultInitCtx();
         }

@@ -263,10 +265,11 @@
      *
      * @see #doLookup(String)
      * @see #lookup(Name)
      * @since 1.6
      */
+    @SuppressWarnings("unchecked")
     public static <T> T doLookup(Name name)
         throws NamingException {
         return (T) (new InitialContext()).lookup(name);
     }
 

@@ -277,10 +280,11 @@
      *          the name of the object to look up
      * @return  the object bound to <tt>name</tt>
      * @throws  NamingException if a naming exception is encountered
       * @since 1.6
      */
+    @SuppressWarnings("unchecked")
     public static <T> T doLookup(String name)
         throws NamingException {
         return (T) (new InitialContext()).lookup(name);
     }