[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: gnu classpath debugging logger

Kaffe CVS cvs-commits at kaffe.org
Sat Jul 16 14:24:17 PDT 2005


PatchSet 6736 
Date: 2005/07/16 21:19:11
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: gnu classpath debugging logger

2005-07-16  Dalibor Topic  <robilad at kaffe.org>

        * Resynced with GNU Classpath.

        2005-07-10  Casey Marshall  <csm at gnu.org>

        * gnu/classpath/debug/Component.java: new file.
        * gnu/classpath/debug/PreciseFilter.java: new file.
        * gnu/classpath/debug/SystemLogger.java: new file.
        * gnu/java/security/x509/X509Certificate.java
        (DEBUG, debug, debug): removed.
        (logger): new constant; use 'logger' with 'Component.X509'
        for debug messages throughout.
        (parse): always read the next DER value after reading the
        version-specific values.

Members: 
	ChangeLog:1.4260->1.4261 
	libraries/javalib/Makefile.am:1.373->1.374 
	libraries/javalib/Makefile.in:1.463->1.464 
	libraries/javalib/all.files:1.144->1.145 
	libraries/javalib/gnu/classpath/debug/Component.java:INITIAL->1.1 
	libraries/javalib/gnu/classpath/debug/PreciseFilter.java:INITIAL->1.1 
	libraries/javalib/gnu/classpath/debug/SystemLogger.java:INITIAL->1.1 
	libraries/javalib/gnu/java/security/x509/X509Certificate.java:1.6->1.7 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4260 kaffe/ChangeLog:1.4261
--- kaffe/ChangeLog:1.4260	Fri Jul 15 15:39:16 2005
+++ kaffe/ChangeLog	Sat Jul 16 21:19:11 2005
@@ -1,3 +1,19 @@
+2005-07-16  Dalibor Topic  <robilad at kaffe.org>
+
+	* Resynced with GNU Classpath.
+
+	2005-07-10  Casey Marshall  <csm at gnu.org>
+
+        * gnu/classpath/debug/Component.java: new file.
+        * gnu/classpath/debug/PreciseFilter.java: new file.
+        * gnu/classpath/debug/SystemLogger.java: new file.
+        * gnu/java/security/x509/X509Certificate.java
+        (DEBUG, debug, debug): removed.
+        (logger): new constant; use 'logger' with 'Component.X509'
+        for debug messages throughout.
+        (parse): always read the next DER value after reading the
+        version-specific values.
+
 2005-07-15  Guilhem Lavaux  <guilhem at kaffe.org>
 
 	* config/i386/solaris2/jit3-md.h: Enabled JIT3 on solaris/x86.
Index: kaffe/libraries/javalib/Makefile.am
diff -u kaffe/libraries/javalib/Makefile.am:1.373 kaffe/libraries/javalib/Makefile.am:1.374
--- kaffe/libraries/javalib/Makefile.am:1.373	Sun Jul 10 02:11:32 2005
+++ kaffe/libraries/javalib/Makefile.am	Sat Jul 16 21:19:15 2005
@@ -62,6 +62,7 @@
 	$(gnu_CORBA_Poa_SRCS) \
 	$(gnu_bytecode_SRCS) \
 	$(gnu_classpath_SRCS) \
+	$(gnu_classpath_debug_SRCS) \
 	$(gnu_classpath_tools_SRCS) \
 	$(gnu_classpath_tools_javap_SRCS) \
 	$(gnu_classpath_tools_native2ascii_SRCS) \
@@ -535,6 +536,10 @@
 	gnu/classpath/SystemProperties.java \
 	gnu/classpath/VMStackWalker.java \
 	gnu/classpath/VMSystemProperties.java
+gnu_classpath_debug_SRCS = \
+	gnu/classpath/debug/Component.java \
+	gnu/classpath/debug/PreciseFilter.java \
+	gnu/classpath/debug/SystemLogger.java
 gnu_classpath_tools_SRCS = \
 	gnu/classpath/tools/Util.java
 gnu_classpath_tools_javap_SRCS = \
Index: kaffe/libraries/javalib/Makefile.in
diff -u kaffe/libraries/javalib/Makefile.in:1.463 kaffe/libraries/javalib/Makefile.in:1.464
--- kaffe/libraries/javalib/Makefile.in:1.463	Sun Jul 10 02:11:33 2005
+++ kaffe/libraries/javalib/Makefile.in	Sat Jul 16 21:19:15 2005
@@ -417,6 +417,7 @@
 	$(gnu_CORBA_Poa_SRCS) \
 	$(gnu_bytecode_SRCS) \
 	$(gnu_classpath_SRCS) \
+	$(gnu_classpath_debug_SRCS) \
 	$(gnu_classpath_tools_SRCS) \
 	$(gnu_classpath_tools_javap_SRCS) \
 	$(gnu_classpath_tools_native2ascii_SRCS) \
@@ -901,6 +902,11 @@
 	gnu/classpath/SystemProperties.java \
 	gnu/classpath/VMStackWalker.java \
 	gnu/classpath/VMSystemProperties.java
+
+gnu_classpath_debug_SRCS = \
+	gnu/classpath/debug/Component.java \
+	gnu/classpath/debug/PreciseFilter.java \
+	gnu/classpath/debug/SystemLogger.java
 
 gnu_classpath_tools_SRCS = \
 	gnu/classpath/tools/Util.java
Index: kaffe/libraries/javalib/all.files
diff -u kaffe/libraries/javalib/all.files:1.144 kaffe/libraries/javalib/all.files:1.145
--- kaffe/libraries/javalib/all.files:1.144	Sun Jul 10 02:11:36 2005
+++ kaffe/libraries/javalib/all.files	Sat Jul 16 21:19:16 2005
@@ -154,6 +154,9 @@
 gnu/classpath/SystemProperties.java
 gnu/classpath/VMStackWalker.java
 gnu/classpath/VMSystemProperties.java
+gnu/classpath/debug/Component.java
+gnu/classpath/debug/PreciseFilter.java
+gnu/classpath/debug/SystemLogger.java
 gnu/classpath/tools/Util.java
 gnu/classpath/tools/javap/GnuByteCodeJavap.java
 gnu/classpath/tools/javap/Javap.java
===================================================================
Checking out kaffe/libraries/javalib/gnu/classpath/debug/Component.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/gnu/classpath/debug/Component.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/gnu/classpath/debug/Component.java	Sat Jul 16 21:24:16 2005
@@ -0,0 +1,159 @@
+/* Component.java -- a component log level.
+   Copyright (C) 2005  Free Software Foundation, Inc.
+
+This file is a part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under terms
+of your choice, provided that you also meet, for each linked independent
+module, the terms and conditions of the license of that module.  An
+independent module is a module which is not derived from or based on
+this library.  If you modify this library, you may extend this exception
+to your version of the library, but you are not obligated to do so.  If
+you do not wish to do so, delete this exception statement from your
+version.  */
+
+
+package gnu.classpath.debug;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.logging.Level;
+
+public final class Component extends Level
+{
+
+  /*
+   * HOW TO ADD NEW COMPONENTS:
+   *
+   * If you want to add a new, simple component, that you will use in
+   * logging statements, simply create a new class variable that
+   * instantiates this class, and choose an appropriate string name
+   * and a integer constant not used by any other component level.
+   *
+   * For example, if my component had to do with 'frobbing', I would
+   * add this entry below:
+   *
+   *   private static final Component FROBBING = new Component ("FROBBING", 7);
+   *
+   * Then, I would update the component 'EVERYTHING' to have and end
+   * index ONE GREATER THAN the index of the new component.
+   *
+   * ADDING NEW COMPONENT CLASSES:
+   *
+   * A "component class" is a run of more than one component, which can
+   * be enabled all at once. EVERYTHING and SSL are examples of component
+   * classes. To add a new class, create a new component with a start index
+   * equal to the index of the first member component, and with an end
+   * index equal to the index of the last member component plus one.
+   */
+
+  /**
+   * Signifies that everything should be logged. This should be used to
+   * enable or disable levels only; logging code should not use it.
+   */
+  public static final Component EVERYTHING = new Component ("*", 0, 7);
+
+  /**
+   * Signifies that all SSL related messages should be logged. This should
+   * be used to enable or disable levels only; logging code should not use
+   * it.
+   */
+  public static final Component SSL = new Component ("SSL", 0, 5);
+
+  /**
+   * Traces the progression of an SSL handshake.
+   */
+  public static final Component SSL_HANDSHAKE = new Component ("SSL HANDSHAKE", 0);
+
+  /**
+   * Traces the application messages during SSL communications.
+   */
+  public static final Component SSL_APPLICATION = new Component ("SSL APPLICATION", 1);
+
+  /**
+   * Trace details about the SSL key exchange.
+   */
+  public static final Component SSL_KEY_EXCHANGE = new Component ("SSL KEY EXCHANGE", 2);
+
+  /* Indices 3 and 4 reserved for future use by SSL components. */
+
+  /**
+   * Trace the operation of cryptographic primitives.
+   */
+  public static final Component CRYPTO = new Component ("CRYPTO", 5);
+
+  /**
+   * Trace the parsing of X.509 certificates and related objects.
+   */
+  public static final Component X509 = new Component ("X.509", 6);
+
+  private final int startIndex;
+  private final int endIndex;
+
+  private Component (final String name, final int bitIndex)
+  {
+    this (name, bitIndex, bitIndex + 1);
+  }
+
+  private Component (final String name, final int startIndex, final int endIndex)
+  {
+    super (name, Level.FINE.intValue ());
+    this.startIndex = startIndex;
+    this.endIndex = endIndex;
+  }
+
+  /**
+   * Return the component for the given name.
+   *
+   * @param name The name of the component to get.
+   * @return The named component, or null if there is no such component.
+   */
+  public static Component forName (final String name)
+  {
+    try
+      {
+	Field f = Component.class.getField (name.toUpperCase ());
+	if (!Modifier.isStatic (f.getModifiers ())
+	    || Component.class.isAssignableFrom (f.getClass ()))
+	  return null;
+	return (Component) f.get (null);
+      }
+    catch (Throwable _)
+      {
+	return null;
+      }
+  }
+
+  public int startIndex ()
+  {
+    return startIndex;
+  }
+
+  public int endIndex ()
+  {
+    return endIndex;
+  }
+}
\ No newline at end of file
===================================================================
Checking out kaffe/libraries/javalib/gnu/classpath/debug/PreciseFilter.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/gnu/classpath/debug/PreciseFilter.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/gnu/classpath/debug/PreciseFilter.java	Sat Jul 16 21:24:17 2005
@@ -0,0 +1,105 @@
+/* PreciseFilter.java -- filter log messages by precise level.
+   Copyright (C) 2005  Free Software Foundation, Inc.
+
+This file is a part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under terms
+of your choice, provided that you also meet, for each linked independent
+module, the terms and conditions of the license of that module.  An
+independent module is a module which is not derived from or based on
+this library.  If you modify this library, you may extend this exception
+to your version of the library, but you are not obligated to do so.  If
+you do not wish to do so, delete this exception statement from your
+version.  */
+
+
+package gnu.classpath.debug;
+
+import java.util.BitSet;
+import java.util.logging.Filter;
+import java.util.logging.LogRecord;
+
+public final class PreciseFilter implements Filter
+{
+
+  /**
+   * The singleton filter instance.
+   */
+  public static final PreciseFilter GLOBAL = new PreciseFilter ();
+
+  private final BitSet enabled;
+
+  private PreciseFilter ()
+  {
+    enabled = new BitSet ();
+  }
+
+  /**
+   * Disable logging of a component.
+   *
+   * @param component The component to disable logging for.
+   * @throws NullPointerException If component is null.
+   */
+  public void disable (final Component component)
+  {
+    enabled.clear (component.startIndex (), component.endIndex ());
+  }
+
+  /**
+   * Enable logging of a component.
+   *
+   * @param component The component to enable logging for.
+   * @throws NullPointerException If component is null.
+   */
+  public void enable (final Component component)
+  {
+    enabled.set (component.startIndex (), component.endIndex ());
+  }
+
+  /**
+   * Tell if a component is enabled for logging.
+   *
+   * @param component The component to test.
+   * @return True iff the specified component is enabled for logging.
+   * @throws NullPointerException If component is null.
+   */
+  public boolean isEnabled (final Component component)
+  {
+    return (enabled.get (component.startIndex ()));
+  }
+
+  public boolean isLoggable (final LogRecord record)
+  {
+    try
+      {
+	return isEnabled ((Component) record.getLevel ());
+      }
+    catch (ClassCastException cce)
+      {
+	return true;
+      }
+  }
+}
\ No newline at end of file
===================================================================
Checking out kaffe/libraries/javalib/gnu/classpath/debug/SystemLogger.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/gnu/classpath/debug/SystemLogger.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/gnu/classpath/debug/SystemLogger.java	Sat Jul 16 21:24:17 2005
@@ -0,0 +1,71 @@
+/* SystemLogger.java -- Classpath's system debugging logger.
+   Copyright (C) 2005  Free Software Foundation, Inc.
+
+This file is a part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under terms
+of your choice, provided that you also meet, for each linked independent
+module, the terms and conditions of the license of that module.  An
+independent module is a module which is not derived from or based on
+this library.  If you modify this library, you may extend this exception
+to your version of the library, but you are not obligated to do so.  If
+you do not wish to do so, delete this exception statement from your
+version.  */
+
+
+package gnu.classpath.debug;
+
+import gnu.classpath.SystemProperties;
+import java.util.StringTokenizer;
+import java.util.logging.Logger;
+
+public final class SystemLogger
+{
+  public static final Logger SYSTEM = Logger.getLogger ("gnu.classpath");
+
+  static
+  {
+    SYSTEM.setFilter (PreciseFilter.GLOBAL);
+
+    String defaults = SystemProperties.getProperty ("gnu.classpath.debug.components");
+
+    if (defaults != null)
+      {
+        StringTokenizer tok = new StringTokenizer (defaults, ",");
+        while (tok.hasMoreTokens ())
+          {
+            Component c = Component.forName (tok.nextToken ());
+            if (c != null)
+              PreciseFilter.GLOBAL.enable (c);
+            SYSTEM.log (java.util.logging.Level.INFO, "enabled: {0}", c);
+          }
+      }
+
+    java.util.logging.Handler[] h = SYSTEM.getHandlers ();
+    for (int i = 0; i < h.length; i++)
+        System.out.println (h[i]);
+  }
+}
Index: kaffe/libraries/javalib/gnu/java/security/x509/X509Certificate.java
diff -u kaffe/libraries/javalib/gnu/java/security/x509/X509Certificate.java:1.6 kaffe/libraries/javalib/gnu/java/security/x509/X509Certificate.java:1.7
--- kaffe/libraries/javalib/gnu/java/security/x509/X509Certificate.java:1.6	Mon Jul  4 00:05:41 2005
+++ kaffe/libraries/javalib/gnu/java/security/x509/X509Certificate.java	Sat Jul 16 21:19:17 2005
@@ -38,6 +38,9 @@
 
 package gnu.java.security.x509;
 
+import gnu.classpath.debug.Component;
+import gnu.classpath.debug.SystemLogger;
+
 import gnu.java.security.OID;
 import gnu.java.security.der.BitString;
 import gnu.java.security.der.DER;
@@ -86,6 +89,9 @@
 import java.util.Map;
 import java.util.Set;
 
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
 import javax.security.auth.x500.X500Principal;
 
 /**
@@ -100,23 +106,7 @@
   // Constants and fields.
   // ------------------------------------------------------------------------
 
-  private static final boolean DEBUG = false;
-  private static void debug(String msg)
-  {
-    if (DEBUG)
-      {
-        System.err.print(">> X509Certificate: ");
-        System.err.println(msg);
-      }
-  }
-  private static void debug(Throwable t)
-  {
-    if (DEBUG)
-      {
-        System.err.print(">> X509Certificate: ");
-        t.printStackTrace();
-      }
-  }
+  private static final Logger logger = SystemLogger.SYSTEM;
 
   protected static final OID ID_DSA = new OID ("1.2.840.10040.4.1");
   protected static final OID ID_DSA_WITH_SHA1 = new OID ("1.2.840.10040.4.3");
@@ -177,12 +167,12 @@
       }
     catch (IOException ioe)
       {
-        debug(ioe);
+        logger.log (Component.X509, "", ioe);
         throw ioe;
       }
     catch (Exception e)
       {
-        debug(e);
+        logger.log (Component.X509, "", e);
         CertificateException ce = new CertificateException(e.getMessage());
         ce.initCause (e);
         throw ce;
@@ -543,7 +533,8 @@
   private void doVerify(Signature sig, PublicKey key)
     throws CertificateException, InvalidKeyException, SignatureException
   {
-    debug("verifying sig=" + sig + " key=" + key);
+    logger.log (Component.X509, "verifying sig={0} key={1}",
+                new Object[] { sig, key });
     sig.initVerify(key);
     sig.update(tbsCertBytes);
     if (!sig.verify(signature))
@@ -563,7 +554,8 @@
 
     // Certificate ::= SEQUENCE {
     DERValue cert = der.read();
-    debug("start Certificate  len == " + cert.getLength());
+    logger.log (Component.X509, "start Certificate  len == {0}",
+                new Integer (cert.getLength()));
 
     this.encoded = cert.getEncoded();
     if (!cert.isConstructed())
@@ -578,7 +570,8 @@
         throw new IOException("malformed TBSCertificate");
       }
     tbsCertBytes = tbsCert.getEncoded();
-    debug("start TBSCertificate  len == " + tbsCert.getLength());
+    logger.log (Component.X509, "start TBSCertificate  len == {0}",
+                new Integer (tbsCert.getLength()));
 
     // Version ::= INTEGER [0] { v1(0), v2(1), v3(2) }
     DERValue val = der.read();
@@ -591,11 +584,12 @@
       {
         version = 1;
       }
-    debug("read version == " + version);
+    logger.log (Component.X509, "read version == {0}",
+                new Integer (version));
 
     // SerialNumber ::= INTEGER
     serialNo = (BigInteger) val.getValue();
-    debug("read serial number == " + serialNo);
+    logger.log (Component.X509, "read serial number == {0}", serialNo);
 
     // AlgorithmIdentifier ::= SEQUENCE {
     val = der.read();
@@ -604,12 +598,13 @@
         throw new IOException("malformed AlgorithmIdentifier");
       }
     int certAlgLen = val.getLength();
-    debug("start AlgorithmIdentifier  len == " + certAlgLen);
+    logger.log (Component.X509, "start AlgorithmIdentifier  len == {0}",
+                new Integer (certAlgLen));
     val = der.read();
 
     //   algorithm    OBJECT IDENTIFIER,
     algId = (OID) val.getValue();
-    debug("read algorithm ID == " + algId);
+    logger.log (Component.X509, "read algorithm ID == {0}", algId);
 
     //   parameters   ANY DEFINED BY algorithm OPTIONAL }
     if (certAlgLen > val.getEncodedLength())
@@ -622,18 +617,18 @@
         else
           {
             algVal = val.getEncoded();
-	    
-	    if (val.isConstructed())
-	      encoded.skip(val.getLength());
+
+            if (val.isConstructed())
+              encoded.skip(val.getLength());
           }
-        debug("read algorithm parameters == " + algVal);
+        logger.log (Component.X509, "read algorithm parameters == {0}", algVal);
       }
 
     // issuer   Name,
     val = der.read();
     issuer = new X500DistinguishedName(val.getEncoded());
     der.skip(val.getLength());
-    debug("read issuer == " + issuer);
+    logger.log (Component.X509, "read issuer == {0}", issuer);
 
     // Validity ::= SEQUENCE {
     //   notBefore   Time,
@@ -643,15 +638,15 @@
         throw new IOException("malformed Validity");
       }
     notBefore = (Date) der.read().getValue();
+    logger.log (Component.X509, "read notBefore == {0}", notBefore);
     notAfter  = (Date) der.read().getValue();
-    debug("read notBefore == " + notBefore);
-    debug("read notAfter == " + notAfter);
+    logger.log (Component.X509, "read notAfter == {0}", notAfter);
 
     // subject   Name,
     val = der.read();
     subject = new X500DistinguishedName(val.getEncoded());
     der.skip(val.getLength());
-    debug("read subject == " + subject);
+    logger.log (Component.X509, "read subject == {0}", subject);
 
     // SubjectPublicKeyInfo ::= SEQUENCE {
     //   algorithm         AlgorithmIdentifier,
@@ -664,7 +659,7 @@
     KeyFactory spkFac = KeyFactory.getInstance("X.509");
     subjectKey = spkFac.generatePublic(new X509EncodedKeySpec(spki.getEncoded()));
     der.skip(spki.getLength());
-    debug("read subjectPublicKey == " + subjectKey);
+    logger.log (Component.X509, "read subjectPublicKey == {0}", subjectKey);
 
     if (version > 1)
       {
@@ -674,43 +669,50 @@
       {
         byte[] b = (byte[]) val.getValue();
         issuerUniqueId = new BitString(b, 1, b.length-1, b[0] & 0xFF);
-        debug("read issuerUniqueId == " + issuerUniqueId);
+        logger.log (Component.X509, "read issuerUniqueId == {0}", issuerUniqueId);
         val = der.read();
       }
     if (version >= 2 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 2)
       {
         byte[] b = (byte[]) val.getValue();
         subjectUniqueId = new BitString(b, 1, b.length-1, b[0] & 0xFF);
-        debug("read subjectUniqueId == " + subjectUniqueId);
+        logger.log (Component.X509, "read subjectUniqueId == {0}", subjectUniqueId);
         val = der.read();
       }
     if (version >= 3 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 3)
       {
         val = der.read();
-        debug("start Extensions  len == " + val.getLength());
+        logger.log (Component.X509, "start Extensions  len == {0}",
+                    new Integer (val.getLength()));
         int len = 0;
         while (len < val.getLength())
           {
             DERValue ext = der.read();
-            debug("start extension  len == " + ext.getLength());
+            logger.log (Component.X509, "start extension  len == {0}",
+                        new Integer (ext.getLength()));
             Extension e = new Extension(ext.getEncoded());
             extensions.put(e.getOid(), e);
             der.skip(ext.getLength());
             len += ext.getEncodedLength();
-            debug("count == " + len);
+            logger.log (Component.X509, "read extension {0} == {1}",
+                        new Object[] { e.getOid (), e });
+            logger.log (Component.X509, "count == {0}", new Integer (len));
           }
+
+        val = der.read ();
       }
 
-    val = der.read();
+    logger.log (Component.X509, "read value {0}", val);
     if (!val.isConstructed())
       {
-        throw new IOException("malformed AlgorithmIdentifier");
+        throw new CertificateException ("malformed AlgorithmIdentifier");
       }
     int sigAlgLen = val.getLength();
-    debug("start AlgorithmIdentifier  len == " + sigAlgLen);
+    logger.log (Component.X509, "start AlgorithmIdentifier  len == {0}",
+                new Integer (sigAlgLen));
     val = der.read();
     sigAlgId = (OID) val.getValue();
-    debug("read algorithm id == " + sigAlgId);
+    logger.log (Component.X509, "read algorithm id == {0}", sigAlgId);
     if (sigAlgLen > val.getEncodedLength())
       {
         val = der.read();
@@ -735,9 +737,9 @@
           {
             encoded.skip(val.getLength());
           }
-        debug("read parameters == " + sigAlgVal);
+        logger.log (Component.X509, "read parameters == {0}", sigAlgVal);
       }
     signature = ((BitString) der.read().getValue()).toByteArray();
-    debug("read signature ==\n" + Util.hexDump(signature, ">>>> "));
+    logger.log (Component.X509, "read signature ==\n{0}", Util.hexDump(signature, ">>>> "));
   }
 }




More information about the kaffe mailing list