< prev index next >
src/java.naming/share/classes/javax/naming/spi/NamingManager.java
Print this page
@@ -157,11 +157,13 @@
clas = helper.loadClass(factoryName, codebase);
} catch (ClassNotFoundException e) {
}
}
- return (clas != null) ? (ObjectFactory) clas.newInstance() : null;
+ @SuppressWarnings("deprecation") // Class.newInstance
+ ObjectFactory result = (clas != null) ? (ObjectFactory) clas.newInstance() : null;
+ return result;
}
/**
* Creates an object using the factories specified in the
@@ -708,12 +710,13 @@
throw ne;
}
if (factory == null) {
try {
- factory = (InitialContextFactory)
- helper.loadClass(className).newInstance();
+ @SuppressWarnings("deprecation")
+ Object o = helper.loadClass(className).newInstance();
+ factory = (InitialContextFactory) o;
} catch (Exception e) {
NoInitialContextException ne =
new NoInitialContextException(
"Cannot instantiate class: " + className);
ne.setRootCause(e);
< prev index next >