directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r427194 - in /directory/trunks/shared/asn1/src/main/java/org/apache/directory/shared/asn1/ber: Asn1Decoder.java grammar/AbstractGrammar.java
Date Mon, 31 Jul 2006 18:40:57 GMT
Author: elecharny
Date: Mon Jul 31 11:40:56 2006
New Revision: 427194

URL: http://svn.apache.org/viewvc?rev=427194&view=rev
Log:
Merging changes form optimization branch of shared/asn1 back into this 1.1 trunks
branch.  Here's the merge command used: svn merge -r 414084:427187 https://svn.apache.org/repos/asf/directory/branches/shared/optimization
.

Modified:
    directory/trunks/shared/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java
    directory/trunks/shared/asn1/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java

Modified: directory/trunks/shared/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java?rev=427194&r1=427193&r2=427194&view=diff
==============================================================================
--- directory/trunks/shared/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java
(original)
+++ directory/trunks/shared/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java
Mon Jul 31 11:40:56 2006
@@ -49,7 +49,10 @@
 
     /** The logger */
     private static final Logger log = LoggerFactory.getLogger( Asn1Decoder.class );
-
+    
+    /** A speedup for logger */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+    
     /** This flag is used to indicate that there are more bytes in the stream */
     private static final boolean MORE = true;
 
@@ -249,7 +252,10 @@
             current = current.getParent();
         }
 
-        log.debug( "TLV Tree : {}", sb.toString() );
+        if ( IS_DEBUG ) 
+        {
+            log.debug( "TLV Tree : {}", sb.toString() );
+        }
     }
 
 
@@ -301,7 +307,7 @@
     private void treatTagEndState( IAsn1Container container ) throws DecoderException, NamingException
     {
 
-        if ( log.isDebugEnabled() )
+        if ( IS_DEBUG )
         {
             Tag tag = container.getCurrentTLV().getTag();
             log.debug( "Tag {} has been decoded", tag.toString() );
@@ -417,7 +423,7 @@
 
                 byte octet = stream.get();
 
-                if ( log.isDebugEnabled() )
+                if ( IS_DEBUG )
                 {
                     log.debug( "  current byte : {}", Asn1StringUtils.dumpByte( octet ) );
                 }
@@ -490,7 +496,7 @@
         // exceeded by the current TLV.
         TLV parentTLV = container.getParentTLV();
 
-        if ( log.isDebugEnabled() )
+        if ( IS_DEBUG )
         {
             log.debug( "Parent length : {}", getParentLength( parentTLV ) );
         }
@@ -502,7 +508,7 @@
             tlv.setExpectedLength( length.getLength() );
             container.setParentTLV( tlv );
 
-            if ( log.isDebugEnabled() )
+            if ( IS_DEBUG )
             {
                 log.debug( "Root TLV[{}]", new Integer( tlv.getLength().getLength() ) );
             }
@@ -608,7 +614,7 @@
 
         }
 
-        if ( log.isDebugEnabled() )
+        if ( IS_DEBUG )
         {
             log.debug( "Length {} has been decoded", length.toString() );
         }
@@ -742,7 +748,7 @@
      */
     private boolean treatTLVDoneState( ByteBuffer stream, IAsn1Container container ) throws
DecoderException, NamingException
     {
-        if ( log.isDebugEnabled() )
+        if ( IS_DEBUG )
         {
             dumpTLVTree( container );
         }
@@ -862,14 +868,17 @@
 
         boolean hasRemaining = stream.hasRemaining();
 
-        log.debug( ">>>==========================================" );
-        log.debug( "--> Decoding a PDU" );
-        log.debug( ">>>------------------------------------------" );
+        if ( IS_DEBUG )
+        {
+            log.debug( ">>>==========================================" );
+            log.debug( "--> Decoding a PDU" );
+            log.debug( ">>>------------------------------------------" );
+        }
 
         while ( hasRemaining )
         {
 
-            if ( log.isDebugEnabled() )
+            if ( IS_DEBUG )
             {
                 log.debug( "--- State = {} ---", stateToString( container.getState() ) );
 
@@ -956,7 +965,7 @@
             }
         }
 
-        if ( log.isDebugEnabled() )
+        if ( IS_DEBUG )
         {
             log.debug( "<<<------------------------------------------" );
 

Modified: directory/trunks/shared/asn1/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/asn1/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java?rev=427194&r1=427193&r2=427194&view=diff
==============================================================================
--- directory/trunks/shared/asn1/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java
(original)
+++ directory/trunks/shared/asn1/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java
Mon Jul 31 11:40:56 2006
@@ -44,6 +44,9 @@
     /** The logger */
     private static final Logger log = LoggerFactory.getLogger( AbstractGrammar.class );
 
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
     // ~ Instance fields
     // ----------------------------------------------------------------------------
 
@@ -114,7 +117,7 @@
 
         int tlvLength = tlv.getSize();
 
-        if ( log.isDebugEnabled() )
+        if ( IS_DEBUG )
         {
             log.debug( "Expected Length = " + ( ( Asn1Object ) object ).getExpectedLength()
+ ", current length = "
                 + ( ( Asn1Object ) object ).getCurrentLength() + ", added length = " + expectedLength
@@ -203,7 +206,7 @@
 
                     if ( container.isGrammarPopAllowed() )
                     {
-                        if ( log.isDebugEnabled() )
+                        if ( IS_DEBUG )
                         {
                             log.debug( "Pop grammar {}, state = {}", container.getStates().getGrammarName(
                                 currentGrammar ), currentGrammar.getStatesEnum().getState(
@@ -211,6 +214,7 @@
                         }
 
                         currentState = container.restoreGrammar();
+                        container.setTransition( currentState );
                         continue;
                     }
                     else
@@ -225,7 +229,7 @@
                 }
             }
 
-            if ( log.isDebugEnabled() )
+            if ( IS_DEBUG )
             {
                 log.debug( transition.toString( container.getCurrentGrammarType(), currentGrammar.getStatesEnum()
) );
             }
@@ -240,7 +244,7 @@
                     transition.getAction().action( container );
                 }
 
-                if ( log.isDebugEnabled() )
+                if ( IS_DEBUG )
                 {
                     log.debug( "Switching from grammar {} to grammar {}", container.getStates().getGrammarName(
                         currentGrammar ), container.getStates().getGrammarName( ( nextState
>> 8 ) - 1 ) );



Mime
View raw message