< prev index next >

src/java.naming/share/classes/com/sun/naming/internal/FactoryEnumeration.java

Print this page

        

@@ -84,11 +84,13 @@
                 if (answer == null) {   // reload class if weak ref cleared
                     Class<?> cls = Class.forName(className, true, loader);
                     answer = cls;
                 }
                 // Instantiate Class to get factory
-                answer = ((Class) answer).newInstance();
+                @SuppressWarnings("deprecation")
+                Object tmp = ((Class) answer).newInstance();
+                answer = tmp;
                 ref = new NamedWeakReference<>(answer, className);
                 factories.set(posn-1, ref);  // replace Class object or null
                 return answer;
             } catch (ClassNotFoundException e) {
                 NamingException ne =
< prev index next >