src/share/classes/java/util/logging/LogManager.java

Print this page
rev 4802 : 7117249: fix warnings in java.util.jar, .logging, .prefs, .zip
Reviewed-by: alanb, dholmes, forax, sherman, smarks
Contributed-by: London Java Community and Michael Barker <mikeb01@gmail.com>

@@ -177,14 +177,14 @@
                     String cname = null;
                     try {
                         cname = System.getProperty("java.util.logging.manager");
                         if (cname != null) {
                             try {
-                                Class clz = ClassLoader.getSystemClassLoader().loadClass(cname);
+                                Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(cname);
                                 manager = (LogManager) clz.newInstance();
                             } catch (ClassNotFoundException ex) {
-                                Class clz = Thread.currentThread().getContextClassLoader().loadClass(cname);
+                                Class<?> clz = Thread.currentThread().getContextClassLoader().loadClass(cname);
                                 manager = (LogManager) clz.newInstance();
                             }
                         }
                     } catch (Exception ex) {
                         System.err.println("Could not load Logmanager \"" + cname + "\"");

@@ -198,12 +198,12 @@
                     manager.rootLogger = manager.new RootLogger();
                     manager.addLogger(manager.rootLogger);
 
                     // Adding the global Logger. Doing so in the Logger.<clinit>
                     // would deadlock with the LogManager.<clinit>.
-                    Logger.global.setLogManager(manager);
-                    manager.addLogger(Logger.global);
+                    Logger.getGlobal().setLogManager(manager);
+                    manager.addLogger(Logger.getGlobal());
 
                     // We don't call readConfiguration() here, as we may be running
                     // very early in the JVM startup sequence.  Instead readConfiguration
                     // will be called lazily in getLogManager().
                     return null;

@@ -413,11 +413,11 @@
 
                 String names[] = parseClassNames(handlersPropertyName);
                 for (int i = 0; i < names.length; i++) {
                     String word = names[i];
                     try {
-                        Class   clz = ClassLoader.getSystemClassLoader().loadClass(word);
+                        Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(word);
                         Handler hdl = (Handler) clz.newInstance();
                         try {
                             // Check if there is a property defining the
                             // this handler's level.
                             String levs = getProperty(word + ".level");

@@ -780,15 +780,15 @@
             try {
                 // 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);
+                    Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(cname);
                     clz.newInstance();
                     return;
                 } catch (ClassNotFoundException ex) {
-                    Class clz = Thread.currentThread().getContextClassLoader().loadClass(cname);
+                    Class<?> clz = Thread.currentThread().getContextClassLoader().loadClass(cname);
                     clz.newInstance();
                     return;
                 }
             } catch (Exception ex) {
                 System.err.println("Logging configuration class \"" + cname + "\" failed");

@@ -835,13 +835,13 @@
             props = new Properties();
             // Since we are doing a reset we no longer want to initialize
             // the global handlers, if they haven't been initialized yet.
             initializedGlobalHandlers = true;
         }
-        Enumeration enum_ = getLoggerNames();
+        Enumeration<String> enum_ = getLoggerNames();
         while (enum_.hasMoreElements()) {
-            String name = (String)enum_.nextElement();
+            String name = enum_.nextElement();
             resetLogger(name);
         }
     }
 
 

@@ -924,11 +924,11 @@
         String names[] = parseClassNames("config");
 
         for (int i = 0; i < names.length; i++) {
             String word = names[i];
             try {
-                Class clz = ClassLoader.getSystemClassLoader().loadClass(word);
+                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();

@@ -1022,11 +1022,11 @@
     // we return the defaultValue.
     Filter getFilterProperty(String name, Filter defaultValue) {
         String val = getProperty(name);
         try {
             if (val != null) {
-                Class clz = ClassLoader.getSystemClassLoader().loadClass(val);
+                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.

@@ -1043,11 +1043,11 @@
     // we return the defaultValue.
     Formatter getFormatterProperty(String name, Formatter defaultValue) {
         String val = getProperty(name);
         try {
             if (val != null) {
-                Class clz = ClassLoader.getSystemClassLoader().loadClass(val);
+                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.

@@ -1161,11 +1161,11 @@
 
 
     // Private method to be called when the configuration has
     // changed to apply any level settings to any pre-existing loggers.
     synchronized private void setLevelsOnExistingLoggers() {
-        Enumeration enum_ = props.propertyNames();
+        Enumeration<?> enum_ = props.propertyNames();
         while (enum_.hasMoreElements()) {
             String key = (String)enum_.nextElement();
             if (!key.endsWith(".level")) {
                 // Not a level definition.
                 continue;