directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r278637 - /directory/asn1/branches/asn1-new-ber/ber-new/src/java/main/org/apache/asn1new/ber/Asn1Decoder.java
Date Sun, 04 Sep 2005 22:38:34 GMT
Author: elecharny
Date: Sun Sep  4 15:38:29 2005
New Revision: 278637

URL: http://svn.apache.org/viewcvs?rev=278637&view=rev
Log:
Add a static DEBUG which is initialized in the constructor, to speed up the logging.

Modified:
    directory/asn1/branches/asn1-new-ber/ber-new/src/java/main/org/apache/asn1new/ber/Asn1Decoder.java

Modified: directory/asn1/branches/asn1-new-ber/ber-new/src/java/main/org/apache/asn1new/ber/Asn1Decoder.java
URL: http://svn.apache.org/viewcvs/directory/asn1/branches/asn1-new-ber/ber-new/src/java/main/org/apache/asn1new/ber/Asn1Decoder.java?rev=278637&r1=278636&r2=278637&view=diff
==============================================================================
--- directory/asn1/branches/asn1-new-ber/ber-new/src/java/main/org/apache/asn1new/ber/Asn1Decoder.java
(original)
+++ directory/asn1/branches/asn1-new-ber/ber-new/src/java/main/org/apache/asn1new/ber/Asn1Decoder.java
Sun Sep  4 15:38:29 2005
@@ -47,6 +47,9 @@
 
     /** The logger */
     private static final Logger log = Logger.getLogger( Asn1Decoder.class );
+    
+    /** A speedup for logs */
+    private static boolean DEBUG;
 
     /** This flag is used to indicate that there are more bytes in the stream */
     private static final boolean MORE = true;
@@ -72,9 +75,10 @@
      */
     public Asn1Decoder()
     {
-        this.indefiniteLengthAllowed = false;
-        this.maxLengthLength         = 1;
-        this.maxTagLength            = 1;
+        indefiniteLengthAllowed = false;
+        maxLengthLength         = 1;
+        maxTagLength            = 1;
+        DEBUG = log.isDebugEnabled();
     }
 
     //~ Methods ------------------------------------------------------------------------------------
@@ -290,7 +294,7 @@
         throws DecoderException
     {
 
-        if ( log.isDebugEnabled() )
+        if ( DEBUG )
         {
             Tag tag = container.getCurrentTLV().getTag();
             log.debug( tag.toString() + " has been decoded" );
@@ -404,7 +408,7 @@
 
                 byte octet = stream.get();
 
-                if ( log.isDebugEnabled() )
+                if ( DEBUG )
                 {
                     log.debug( "  current byte : " + StringUtils.dumpByte( octet ) );
                 }
@@ -474,7 +478,7 @@
         // exceeded by the current TLV.
         TLV parentTLV = container.getParentTLV();
         
-        if (log.isDebugEnabled())
+        if ( DEBUG )
         {
             log.debug(getParentLength(parentTLV));
         }
@@ -486,7 +490,7 @@
             tlv.setExpectedLength(length.getLength());
             container.setParentTLV(tlv);
             
-            if (log.isDebugEnabled())
+            if ( DEBUG )
             {
                 log.debug("Root TLV[" + tlv.getLength().getLength() + "]");
             }
@@ -566,7 +570,7 @@
             
         }
 
-        if ( log.isDebugEnabled() )
+        if ( DEBUG )
         {
             log.debug( length.toString() + " has been decoded" );
         }
@@ -695,7 +699,7 @@
     private boolean treatTLVDoneState( ByteBuffer stream, IAsn1Container container )
         throws DecoderException
     {
-        if (log.isDebugEnabled())
+        if ( DEBUG )
         {
             dumpTLVTree(container);
         }
@@ -794,7 +798,7 @@
 
         boolean hasRemaining = stream.hasRemaining();
 
-        if ( log.isDebugEnabled() )
+        if ( DEBUG )
         {
             log.debug( ">>>==========================================" );
             log.debug( "--> Decoding a PDU" );
@@ -804,7 +808,7 @@
         while ( hasRemaining )
         {
 
-            if ( log.isDebugEnabled() )
+            if ( DEBUG )
             {
                 log.debug( "--- State = " + stateToString( container.getState() ) + " ---"
);
 
@@ -892,7 +896,7 @@
             }
         }
 
-        if ( log.isDebugEnabled() )
+        if ( DEBUG )
         {
             log.debug( "<<<------------------------------------------" );
             



Mime
View raw message