Merge
authormchung
Mon, 15 Feb 2010 10:18:55 -0800
changeset 4920 901f98d292c2
parent 4918 13ed75166139 (current diff)
parent 4919 b00f729ee70a (diff)
child 4921 8ff9a8e09752
Merge
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java	Fri Feb 12 10:24:02 2010 +0800
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java	Mon Feb 15 10:18:55 2010 -0800
@@ -27,7 +27,6 @@
 
 import java.io.*;
 import java.util.*;
-import java.util.logging.Level;
 import com.sun.java.util.jar.pack.Package.Class;
 import com.sun.java.util.jar.pack.Package.File;
 import com.sun.java.util.jar.pack.Package.InnerClass;
@@ -162,7 +161,7 @@
 
             ok = true;
         } catch (Exception ee) {
-            Utils.log.log(Level.WARNING, "Error on input: "+ee, ee);
+            Utils.log.warning("Error on input: "+ee, ee);
             if (verbose > 0)
                 Utils.log.info("Stream offsets:"+
                                  " served="+in.getBytesServed()+
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java	Fri Feb 12 10:24:02 2010 +0800
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java	Mon Feb 15 10:18:55 2010 -0800
@@ -27,7 +27,6 @@
 
 import java.io.*;
 import java.util.*;
-import java.util.logging.Level;
 import com.sun.java.util.jar.pack.Package.Class;
 import com.sun.java.util.jar.pack.Package.File;
 import com.sun.java.util.jar.pack.Package.InnerClass;
@@ -84,7 +83,7 @@
 
             ok = true;
         } catch (Exception ee) {
-            Utils.log.log(Level.WARNING, "Error on output: "+ee, ee);
+            Utils.log.warning("Error on output: "+ee, ee);
             //if (verbose > 0)  ee.printStackTrace();
             // Write partial output only if we are verbose.
             if (verbose > 0)  finalOut.close();
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/Utils.java	Fri Feb 12 10:24:02 2010 +0800
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/Utils.java	Mon Feb 15 10:18:55 2010 -0800
@@ -28,9 +28,10 @@
 import java.util.*;
 import java.util.jar.*;
 import java.util.zip.*;
-import java.util.logging.*;
 import java.io.*;
 
+import sun.util.logging.PlatformLogger;
+
 class Utils {
     static final String COM_PREFIX = "com.sun.java.util.jar.pack.";
     static final String METAINF    = "META-INF";
@@ -130,31 +131,53 @@
         = Boolean.getBoolean(Utils.COM_PREFIX+"nolog");
 
 
-    static final Logger log
-        = new Logger("java.util.jar.Pack200", null) {
-            public void log(LogRecord record) {
-                int verbose = currentPropMap().getInteger(DEBUG_VERBOSE);
-                if (verbose > 0) {
-                    if (nolog &&
-                        record.getLevel().intValue() < Level.WARNING.intValue()) {
-                        System.out.println(record.getMessage());
-                    } else {
-                        super.log(record);
-                    }
+    static class Pack200Logger {
+        private final String name;
+        private PlatformLogger log;
+        Pack200Logger(String name) {
+            this.name = name;
+        }
+
+        private synchronized PlatformLogger getLogger() {
+            if (log == null) {
+                log = PlatformLogger.getLogger(name);
+            }
+            return log;
+        }
+
+        public void warning(String msg, Object param) {
+            int verbose = currentPropMap().getInteger(DEBUG_VERBOSE);
+            if (verbose > 0) {
+                getLogger().warning(msg, param);
+            }
+        }
+
+        public void warning(String msg) {
+            warning(msg, null);
+        }
+
+        public void info(String msg) {
+            int verbose = currentPropMap().getInteger(DEBUG_VERBOSE);
+            if (verbose > 0) {
+                if (nolog) {
+                    System.out.println(msg);
+                } else {
+                    getLogger().info(msg);
                 }
             }
+        }
 
-            public void fine(String msg) {
-                int verbose = currentPropMap().getInteger(DEBUG_VERBOSE);
-                if (verbose > 0) {
-                        System.out.println(msg);
-                }
+        public void fine(String msg) {
+            int verbose = currentPropMap().getInteger(DEBUG_VERBOSE);
+            if (verbose > 0) {
+                    System.out.println(msg);
             }
-        };
-    static {
-        LogManager.getLogManager().addLogger(log);
+        }
     }
 
+    static final Pack200Logger log
+        = new Pack200Logger("java.util.jar.Pack200");
+
     // Returns the Max Version String of this implementation
     static String getVersionString() {
         return "Pack200, Vendor: Sun Microsystems, Version: " +