提交 dca2798b 编写于 作者: M mchung

Merge

...@@ -27,7 +27,6 @@ package com.sun.java.util.jar.pack; ...@@ -27,7 +27,6 @@ package com.sun.java.util.jar.pack;
import java.io.*; import java.io.*;
import java.util.*; 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.Class;
import com.sun.java.util.jar.pack.Package.File; import com.sun.java.util.jar.pack.Package.File;
import com.sun.java.util.jar.pack.Package.InnerClass; import com.sun.java.util.jar.pack.Package.InnerClass;
...@@ -162,7 +161,7 @@ class PackageReader extends BandStructure { ...@@ -162,7 +161,7 @@ class PackageReader extends BandStructure {
ok = true; ok = true;
} catch (Exception ee) { } catch (Exception ee) {
Utils.log.log(Level.WARNING, "Error on input: "+ee, ee); Utils.log.warning("Error on input: "+ee, ee);
if (verbose > 0) if (verbose > 0)
Utils.log.info("Stream offsets:"+ Utils.log.info("Stream offsets:"+
" served="+in.getBytesServed()+ " served="+in.getBytesServed()+
......
...@@ -27,7 +27,6 @@ package com.sun.java.util.jar.pack; ...@@ -27,7 +27,6 @@ package com.sun.java.util.jar.pack;
import java.io.*; import java.io.*;
import java.util.*; 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.Class;
import com.sun.java.util.jar.pack.Package.File; import com.sun.java.util.jar.pack.Package.File;
import com.sun.java.util.jar.pack.Package.InnerClass; import com.sun.java.util.jar.pack.Package.InnerClass;
...@@ -84,7 +83,7 @@ class PackageWriter extends BandStructure { ...@@ -84,7 +83,7 @@ class PackageWriter extends BandStructure {
ok = true; ok = true;
} catch (Exception ee) { } 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(); //if (verbose > 0) ee.printStackTrace();
// Write partial output only if we are verbose. // Write partial output only if we are verbose.
if (verbose > 0) finalOut.close(); if (verbose > 0) finalOut.close();
......
...@@ -28,9 +28,10 @@ package com.sun.java.util.jar.pack; ...@@ -28,9 +28,10 @@ package com.sun.java.util.jar.pack;
import java.util.*; import java.util.*;
import java.util.jar.*; import java.util.jar.*;
import java.util.zip.*; import java.util.zip.*;
import java.util.logging.*;
import java.io.*; import java.io.*;
import sun.util.logging.PlatformLogger;
class Utils { class Utils {
static final String COM_PREFIX = "com.sun.java.util.jar.pack."; static final String COM_PREFIX = "com.sun.java.util.jar.pack.";
static final String METAINF = "META-INF"; static final String METAINF = "META-INF";
...@@ -130,31 +131,53 @@ class Utils { ...@@ -130,31 +131,53 @@ class Utils {
= Boolean.getBoolean(Utils.COM_PREFIX+"nolog"); = Boolean.getBoolean(Utils.COM_PREFIX+"nolog");
static final Logger log static class Pack200Logger {
= new Logger("java.util.jar.Pack200", null) { private final String name;
public void log(LogRecord record) { private PlatformLogger log;
int verbose = currentPropMap().getInteger(DEBUG_VERBOSE); Pack200Logger(String name) {
if (verbose > 0) { this.name = name;
if (nolog && }
record.getLevel().intValue() < Level.WARNING.intValue()) {
System.out.println(record.getMessage()); private synchronized PlatformLogger getLogger() {
} else { if (log == null) {
super.log(record); 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 fine(String msg) { public void warning(String msg) {
int verbose = currentPropMap().getInteger(DEBUG_VERBOSE); warning(msg, null);
if (verbose > 0) { }
System.out.println(msg);
public void info(String msg) {
int verbose = currentPropMap().getInteger(DEBUG_VERBOSE);
if (verbose > 0) {
if (nolog) {
System.out.println(msg);
} else {
getLogger().info(msg);
} }
} }
}; }
static {
LogManager.getLogManager().addLogger(log); public void fine(String msg) {
int verbose = currentPropMap().getInteger(DEBUG_VERBOSE);
if (verbose > 0) {
System.out.println(msg);
}
}
} }
static final Pack200Logger log
= new Pack200Logger("java.util.jar.Pack200");
// Returns the Max Version String of this implementation // Returns the Max Version String of this implementation
static String getVersionString() { static String getVersionString() {
return "Pack200, Vendor: Sun Microsystems, Version: " + return "Pack200, Vendor: Sun Microsystems, Version: " +
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册