src/share/classes/javax/naming/spi/NamingManager.java

Print this page

        

@@ -137,11 +137,11 @@
     static ObjectFactory getObjectFactoryFromReference(
         Reference ref, String factoryName)
         throws IllegalAccessException,
         InstantiationException,
         MalformedURLException {
-        Class clas = null;
+        Class<?> clas = null;
 
         // Try to use current class loader
         try {
              clas = helper.loadClass(factoryName);
         } catch (ClassNotFoundException e) {

@@ -170,11 +170,11 @@
      * or of the provider resource file associated with <tt>nameCtx</tt>.
      *
      * @return factory created; null if cannot create
      */
     private static Object createObjectFromFactories(Object obj, Name name,
-            Context nameCtx, Hashtable environment) throws Exception {
+            Context nameCtx, Hashtable<?,?> environment) throws Exception {
 
         FactoryEnumeration factories = ResourceManager.getFactories(
             Context.OBJECT_FACTORIES, environment, nameCtx);
 
         if (factories == null)

@@ -347,11 +347,11 @@
      * Ref has no factory.  For each address of type "URL", try its URL
      * context factory.  Returns null if unsuccessful in creating and
      * invoking a factory.
      */
     static Object processURLAddrs(Reference ref, Name name, Context nameCtx,
-                                  Hashtable environment)
+                                  Hashtable<?,?> environment)
             throws NamingException {
 
         for (int i = 0; i < ref.size(); i++) {
             RefAddr addr = ref.get(i);
             if (addr instanceof StringRefAddr &&

@@ -366,11 +366,11 @@
         }
         return null;
     }
 
     private static Object processURL(Object refInfo, Name name,
-                                     Context nameCtx, Hashtable environment)
+                                     Context nameCtx, Hashtable<?,?> environment)
             throws NamingException {
         Object answer;
 
         // If refInfo is a URL string, try to use its URL context factory
         // If no context found, continue to try object factories.

@@ -425,11 +425,11 @@
      * @return A context identified by <code>obj</code>.
      *
      * @see #getObjectInstance
      */
     static Context getContext(Object obj, Name name, Context nameCtx,
-                              Hashtable environment) throws NamingException {
+                              Hashtable<?,?> environment) throws NamingException {
         Object answer;
 
         if (obj instanceof Context) {
             // %%% Ignore environment for now.  OK since method not public.
             return (Context)obj;

@@ -450,11 +450,11 @@
             : null;
     }
 
     // Used by ContinuationContext
     static Resolver getResolver(Object obj, Name name, Context nameCtx,
-                                Hashtable environment) throws NamingException {
+                                Hashtable<?,?> environment) throws NamingException {
         Object answer;
 
         if (obj instanceof Resolver) {
             // %%% Ignore environment for now.  OK since method not public.
             return (Resolver)obj;

@@ -583,11 +583,11 @@
      * @param environment Environment properties for creating the context
      * @see javax.naming.InitialContext
      */
     private static Object getURLObject(String scheme, Object urlInfo,
                                        Name name, Context nameCtx,
-                                       Hashtable environment)
+                                       Hashtable<?,?> environment)
             throws NamingException {
 
         // e.g. "ftpURLContextFactory"
         ObjectFactory factory = (ObjectFactory)ResourceManager.getFactory(
             Context.URL_PKG_PREFIXES, environment, nameCtx,

@@ -769,19 +769,20 @@
      * @param cpe
      *          The non-null exception that triggered this continuation.
      * @return A non-null Context object for continuing the operation.
      * @exception NamingException If a naming exception occurred.
      */
+    @SuppressWarnings("unchecked")
     public static Context getContinuationContext(CannotProceedException cpe)
             throws NamingException {
 
-        Hashtable env = cpe.getEnvironment();
+        Hashtable<Object,Object> env = (Hashtable<Object,Object>)cpe.getEnvironment();
         if (env == null) {
-            env = new Hashtable(7);
+            env = new Hashtable<>(7);
         } else {
             // Make a (shallow) copy of the environment.
-            env = (Hashtable) env.clone();
+            env = (Hashtable<Object,Object>)env.clone();
         }
         env.put(CPE, cpe);
 
         ContinuationContext cctx = new ContinuationContext(cpe, env);
         return cctx.getTargetContext();