I'm checking (most of) this in to Classpath, and all of it to libgcj
trunk and RH 4.1 branch.

This fixes a couple buglets in logging.

First, JarUtils was creating a logger.  This doesn't seem very useful,
and it interacts strangely with the libgcj startup.  So, I'm inclined
to just remove it.  Please let me know if you don't like this for
Classpath; I'm putting it in libgcj, though.

Second, despite what the docs say, 'handlers' can be comma separated.
In Java6 the javadoc was updated to reflect this; Tomcat relied on this.
And, if a handler can't be found, we just skip it; Tomcat relies on
this too.

This patch was made against the libgcj repository so the paths are a
bit screwy vis a vis the Classpath tree.  But, you'll get the idea.

Tom

Index: classpath/ChangeLog
from  Tom Tromey  <[EMAIL PROTECTED]>

        PR libgcj/29869:
        * gnu/java/util/jar/JarUtils.java (log): Commented out.
        (readSFManifest): Don't log.

Index: ChangeLog
from  Tom Tromey  <[EMAIL PROTECTED]>

        PR libgcj/29869:
        * java/util/logging/LogManager.java (readConfiguration): Handle
        comma-separated 'handlers'.  Don't try to add a non-existing
        handler.

Index: classpath/gnu/java/util/jar/JarUtils.java
===================================================================
--- classpath/gnu/java/util/jar/JarUtils.java   (revision 123266)
+++ classpath/gnu/java/util/jar/JarUtils.java   (working copy)
@@ -1,5 +1,5 @@
 /* JarUtils.java -- Utility methods for reading/writing Manifest[-like] files
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -62,7 +62,10 @@
  */
 public abstract class JarUtils
 {
-  private static final Logger log = Logger.getLogger(JarUtils.class.getName());
+  // We used to log here, but this causes problems during bootstrap,
+  // and it didn't seem worthwhile to preserve this.  Still, this
+  // might be useful for debugging.
+  // private static final Logger log = 
Logger.getLogger(JarUtils.class.getName());
   public static final String META_INF = "META-INF/";
   public static final String DSA_SUFFIX = ".DSA";
   public static final String SF_SUFFIX = ".SF";
@@ -112,9 +115,10 @@
       {
         String version = expectHeader(version_header, br);
         attr.putValue(SIGNATURE_VERSION, version);
-        if (! DEFAULT_SF_VERSION.equals(version))
-          log.warning("Unexpected version number: " + version
-                      + ". Continue (but may fail later)");
+       // This may cause problems during VM bootstrap.
+        // if (! DEFAULT_SF_VERSION.equals(version))
+        //  log.warning("Unexpected version number: " + version
+        //              + ". Continue (but may fail later)");
       }
     catch (IOException ioe)
       {
Index: java/util/logging/LogManager.java
===================================================================
--- java/util/logging/LogManager.java   (revision 123266)
+++ java/util/logging/LogManager.java   (working copy)
@@ -559,13 +559,21 @@
 
        if ("handlers".equals(key))
          {
-           StringTokenizer tokenizer = new StringTokenizer(value);
+           // In Java 5 and earlier this was specified to be
+           // whitespace-separated, but in reality it also accepted
+           // commas (tomcat relied on this), and in Java 6 the
+           // documentation was updated to fit the implementation.
+           StringTokenizer tokenizer = new StringTokenizer(value,
+                                                           " \t\n\r\f,");
            while (tokenizer.hasMoreTokens())
              {
                String handlerName = tokenizer.nextToken();
                 Handler handler = (Handler)
                   createInstance(handlerName, Handler.class, key);
-                Logger.root.addHandler(handler);
+               // Tomcat also relies on the implementation ignoring
+               // items in 'handlers' which are not class names.
+               if (handler != null)
+                 Logger.root.addHandler(handler);
              }
          }
 

Reply via email to