You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2005/08/28 22:59:38 UTC

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

Author: elecharny
Date: Sun Aug 28 13:59:34 2005
New Revision: 263919

URL: http://svn.apache.org/viewcvs?rev=263919&view=rev
Log:
- Supressed the DEBUG member and replaced it by log.isDebugEnabled
- fixed a bug in the length evaluation (switched to a LENGTH_STATE_END instead of a DECODED_PDU)

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=263919&r1=263918&r2=263919&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 Aug 28 13:59:34 2005
@@ -48,9 +48,6 @@
     /** The logger */
     private static final Logger log = Logger.getLogger( Asn1Decoder.class );
 
-    /** Speeding up the logging */
-    private static final boolean DEBUG = log.isDebugEnabled();
-
     /** This flag is used to indicate that there are more bytes in the stream */
     private static final boolean MORE = true;
 
@@ -293,7 +290,7 @@
         throws DecoderException
     {
 
-        if ( DEBUG )
+        if ( log.isDebugEnabled() )
         {
             Tag tag = container.getCurrentTLV().getTag();
             log.debug( tag.toString() + " has been decoded" );
@@ -344,14 +341,7 @@
                 length.setCurrentLength( 0 );
                 length.setSize( 1 );
 
-                if ( octet == 0 )
-                {
-                    container.setState( TLVStateEnum.TLV_STATE_DONE );
-                }
-                else
-                {
-                    container.setState( TLVStateEnum.LENGTH_STATE_END );
-                }
+                container.setState( TLVStateEnum.LENGTH_STATE_END );
             }
             else if ( ( octet & Length.LENGTH_EXTENSION_RESERVED ) !=
                     Length.LENGTH_EXTENSION_RESERVED )
@@ -414,7 +404,7 @@
 
                 byte octet = stream.get();
 
-                if ( DEBUG )
+                if ( log.isDebugEnabled() )
                 {
                     log.debug( "  current byte : " + StringUtils.dumpByte( octet ) );
                 }
@@ -484,7 +474,7 @@
         // exceeded by the current TLV.
         TLV parentTLV = container.getParentTLV();
         
-        if (DEBUG)
+        if (log.isDebugEnabled())
         {
             log.debug(getParentLength(parentTLV));
         }
@@ -496,7 +486,7 @@
             tlv.setExpectedLength(length.getLength());
             container.setParentTLV(tlv);
             
-            if (DEBUG)
+            if (log.isDebugEnabled())
             {
                 log.debug("Root TLV[" + tlv.getLength().getLength() + "]");
             }
@@ -576,7 +566,7 @@
             
         }
 
-        if ( DEBUG )
+        if ( log.isDebugEnabled() )
         {
             log.debug( length.toString() + " has been decoded" );
         }
@@ -705,7 +695,7 @@
     private boolean treatTLVDoneState( ByteBuffer stream, IAsn1Container container )
         throws DecoderException
     {
-        if (DEBUG)
+        if (log.isDebugEnabled())
         {
             dumpTLVTree(container);
         }
@@ -804,7 +794,7 @@
 
         boolean hasRemaining = stream.hasRemaining();
 
-        if ( DEBUG )
+        if ( log.isDebugEnabled() )
         {
             log.debug( ">>>==========================================" );
             log.debug( "--> Decoding a PDU" );
@@ -814,7 +804,7 @@
         while ( hasRemaining )
         {
 
-            if ( DEBUG )
+            if ( log.isDebugEnabled() )
             {
                 log.debug( "--- State = " + stateToString( container.getState() ) + " ---" );
 
@@ -902,7 +892,7 @@
             }
         }
 
-        if ( DEBUG )
+        if ( log.isDebugEnabled() )
         {
             log.debug( "<<<------------------------------------------" );