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/09/03 01:48:29 UTC

svn commit: r267350 - /directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/AddRequest.java

Author: elecharny
Date: Fri Sep  2 16:48:26 2005
New Revision: 267350

URL: http://svn.apache.org/viewcvs?rev=267350&view=rev
Log:
- Added logs
- cleaned the code

Modified:
    directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/AddRequest.java

Modified: directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/AddRequest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/AddRequest.java?rev=267350&r1=267349&r2=267350&view=diff
==============================================================================
--- directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/AddRequest.java (original)
+++ directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/AddRequest.java Fri Sep  2 16:48:26 2005
@@ -21,6 +21,7 @@
 import org.apache.asn1new.ber.tlv.UniversalTag;
 import org.apache.asn1new.ber.tlv.Value;
 import org.apache.asn1new.primitives.OctetString;
+import org.apache.asn1new.util.StringUtils;
 import org.apache.asn1new.ldap.codec.LdapConstants;
 import org.apache.asn1new.ldap.codec.primitives.LdapDN;
 import org.apache.asn1new.ldap.codec.primitives.LdapString;
@@ -62,9 +63,6 @@
     /** The logger */
     private transient static final Logger log = LoggerFactory.getLogger( AddRequest.class );
 
-    /** Logging speed up  */
-    //private transient static final boolean DEBUG = log.isDebugEnabled();
-
     //~ Instance fields ----------------------------------------------------------------------------
 
     /** The DN to be added. */
@@ -270,7 +268,14 @@
         addRequestLength += 1 + Length.getNbBytes( attributesLength ) + attributesLength;
 
         // Return the result.
-        return 1 + Length.getNbBytes( addRequestLength ) + addRequestLength;
+        int result = 1 + Length.getNbBytes( addRequestLength ) + addRequestLength; 
+        
+        if ( log.isDebugEnabled() )
+        {
+        	log.debug( "AddRequest PDU length = " + result );
+        }
+        
+        return result;
     }
     
     /**
@@ -372,6 +377,12 @@
             throw new EncoderException("The PDU buffer size is too small !"); 
         }
 
+        if ( log.isDebugEnabled() )
+        {
+        	log.debug( "AddRequest encoding : " + StringUtils.dumpBytes( buffer.array() ) );
+        	log.debug( "AddRequest initial value : " + toString() );
+        }
+        
         return buffer;
     }