< prev index next >
src/java.logging/share/classes/java/util/logging/LogManager.java
Print this page
*** 227,243 ****
String cname = null;
try {
cname = System.getProperty("java.util.logging.manager");
if (cname != null) {
try {
! Class<?> clz = ClassLoader.getSystemClassLoader()
! .loadClass(cname);
! mgr = (LogManager) clz.newInstance();
} catch (ClassNotFoundException ex) {
! Class<?> clz = Thread.currentThread()
! .getContextClassLoader().loadClass(cname);
! mgr = (LogManager) clz.newInstance();
}
}
} catch (Exception ex) {
System.err.println("Could not load Logmanager \"" + cname + "\"");
ex.printStackTrace();
--- 227,245 ----
String cname = null;
try {
cname = System.getProperty("java.util.logging.manager");
if (cname != null) {
try {
! @SuppressWarnings("deprecation")
! Object tmp = ClassLoader.getSystemClassLoader()
! .loadClass(cname).newInstance();
! mgr = (LogManager) tmp;
} catch (ClassNotFoundException ex) {
! @SuppressWarnings("deprecation")
! Object tmp = Thread.currentThread()
! .getContextClassLoader().loadClass(cname).newInstance();
! mgr = (LogManager) tmp;
}
}
} catch (Exception ex) {
System.err.println("Could not load Logmanager \"" + cname + "\"");
ex.printStackTrace();
*** 974,985 ****
{
String names[] = parseClassNames(handlersPropertyName);
List<Handler> handlers = new ArrayList<>(names.length);
for (String type : names) {
try {
! Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(type);
! Handler hdl = (Handler) clz.newInstance();
// Check if there is a property defining the
// this handler's level.
String levs = getProperty(type + ".level");
if (levs != null) {
Level l = Level.findLevel(levs);
--- 976,988 ----
{
String names[] = parseClassNames(handlersPropertyName);
List<Handler> handlers = new ArrayList<>(names.length);
for (String type : names) {
try {
! @SuppressWarnings("deprecation")
! Object o = ClassLoader.getSystemClassLoader().loadClass(type).newInstance();
! Handler hdl = (Handler) o;
// Check if there is a property defining the
// this handler's level.
String levs = getProperty(type + ".level");
if (levs != null) {
Level l = Level.findLevel(levs);
*** 1313,1327 ****
// Instantiate the named class. It is its constructor's
// responsibility to initialize the logging configuration, by
// calling readConfiguration(InputStream) with a suitable stream.
try {
Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(cname);
! clz.newInstance();
return;
} catch (ClassNotFoundException ex) {
Class<?> clz = Thread.currentThread().getContextClassLoader().loadClass(cname);
! clz.newInstance();
return;
}
} catch (Exception ex) {
System.err.println("Logging configuration class \"" + cname + "\" failed");
System.err.println("" + ex);
--- 1316,1332 ----
// Instantiate the named class. It is its constructor's
// responsibility to initialize the logging configuration, by
// calling readConfiguration(InputStream) with a suitable stream.
try {
Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(cname);
! @SuppressWarnings("deprecation")
! Object witness = clz.newInstance();
return;
} catch (ClassNotFoundException ex) {
Class<?> clz = Thread.currentThread().getContextClassLoader().loadClass(cname);
! @SuppressWarnings("deprecation")
! Object witness = clz.newInstance();
return;
}
} catch (Exception ex) {
System.err.println("Logging configuration class \"" + cname + "\" failed");
System.err.println("" + ex);
*** 1544,1554 ****
String names[] = parseClassNames("config");
for (String word : names) {
try {
Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(word);
! clz.newInstance();
} catch (Exception ex) {
System.err.println("Can't load config class \"" + word + "\"");
System.err.println("" + ex);
// ex.printStackTrace();
}
--- 1549,1560 ----
String names[] = parseClassNames("config");
for (String word : names) {
try {
Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(word);
! @SuppressWarnings("deprecation")
! Object witness = clz.newInstance();
} catch (Exception ex) {
System.err.println("Can't load config class \"" + word + "\"");
System.err.println("" + ex);
// ex.printStackTrace();
}
*** 2290,2301 ****
// we return the defaultValue.
Filter getFilterProperty(String name, Filter defaultValue) {
String val = getProperty(name);
try {
if (val != null) {
! Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(val);
! return (Filter) clz.newInstance();
}
} catch (Exception ex) {
// We got one of a variety of exceptions in creating the
// class or creating an instance.
// Drop through.
--- 2296,2308 ----
// we return the defaultValue.
Filter getFilterProperty(String name, Filter defaultValue) {
String val = getProperty(name);
try {
if (val != null) {
! @SuppressWarnings("deprecation")
! Object o = ClassLoader.getSystemClassLoader().loadClass(val).newInstance();
! return (Filter) o;
}
} catch (Exception ex) {
// We got one of a variety of exceptions in creating the
// class or creating an instance.
// Drop through.
*** 2311,2322 ****
// we return the defaultValue.
Formatter getFormatterProperty(String name, Formatter defaultValue) {
String val = getProperty(name);
try {
if (val != null) {
! Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(val);
! return (Formatter) clz.newInstance();
}
} catch (Exception ex) {
// We got one of a variety of exceptions in creating the
// class or creating an instance.
// Drop through.
--- 2318,2330 ----
// we return the defaultValue.
Formatter getFormatterProperty(String name, Formatter defaultValue) {
String val = getProperty(name);
try {
if (val != null) {
! @SuppressWarnings("deprecation")
! Object o = ClassLoader.getSystemClassLoader().loadClass(val).newInstance();
! return (Formatter) o;
}
} catch (Exception ex) {
// We got one of a variety of exceptions in creating the
// class or creating an instance.
// Drop through.
< prev index next >