提交 dca2798b 编写于 作者: M mchung

Merge

......@@ -27,7 +27,6 @@ package com.sun.java.util.jar.pack;
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 @@ class PackageReader extends BandStructure {
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()+
......
......@@ -27,7 +27,6 @@ package com.sun.java.util.jar.pack;
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 @@ class PackageWriter extends BandStructure {
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();
......
......@@ -28,9 +28,10 @@ package com.sun.java.util.jar.pack;
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,16 +131,38 @@ class Utils {
= Boolean.getBoolean(Utils.COM_PREFIX+"nolog");
static final Logger log
= new Logger("java.util.jar.Pack200", null) {
public void log(LogRecord 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) {
if (nolog &&
record.getLevel().intValue() < Level.WARNING.intValue()) {
System.out.println(record.getMessage());
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 {
super.log(record);
getLogger().info(msg);
}
}
}
......@@ -150,11 +173,11 @@ class Utils {
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: " +
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册