directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r441708 - /directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/asn1ber/messages/bind/BindRequestAsn1Ber.java
Date Sat, 09 Sep 2006 00:56:41 GMT
Author: elecharny
Date: Fri Sep  8 17:56:40 2006
New Revision: 441708

URL: http://svn.apache.org/viewvc?view=rev&rev=441708
Log:
Fixed the encoding and length computation

Modified:
    directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/asn1ber/messages/bind/BindRequestAsn1Ber.java

Modified: directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/asn1ber/messages/bind/BindRequestAsn1Ber.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/asn1ber/messages/bind/BindRequestAsn1Ber.java?view=diff&rev=441708&r1=441707&r2=441708
==============================================================================
--- directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/asn1ber/messages/bind/BindRequestAsn1Ber.java
(original)
+++ directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/asn1ber/messages/bind/BindRequestAsn1Ber.java
Fri Sep  8 17:56:40 2006
@@ -55,6 +55,7 @@
     /** A speedup for logger */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
     
+    /** The message decorator */
     private MessageDecorator messageDecorator;
 
     /** The bind request length */
@@ -119,9 +120,6 @@
      */
     public int computeLength()
     {
-        // First, compute the encaplusing message length
-        messageLength = ((MessageAsn1Ber)messageDecorator).computeLength();
-        
         // Now, deal with the BindRequest protocolOp
         // Initialized with version
         bindRequestLength = 1 + 1 + 1; 
@@ -151,6 +149,9 @@
         
         // Compute the encapsulating message length, and add the protocolOp length,
         messageLength = messageDecorator.computeLength() + protocolOpLength;
+
+        // Update the upper messageAsn1Ber instance with the protocolOpLength
+        ((MessageAsn1Ber)messageDecorator).setProtocolOpLength( protocolOpLength );
         
         // Finally, compute the global size
         int length = 1 + Length.getNbBytes( messageLength ) + messageLength;
@@ -189,7 +190,7 @@
         int length = computeLength();
         buffer = ByteBuffer.allocate( length );
 
-        int protoclOpPos = length - ((MessageAsn1Ber)messageDecorator).getControlsSequenceLength()
- protocolOpLength; 
+        int protoclOpPos = messageLength - ((MessageAsn1Ber)messageDecorator).getControlsSequenceLength()
- protocolOpLength; 
         buffer.position( protoclOpPos ); 
  
         try
@@ -212,6 +213,9 @@
 
         // The authentication
         authenticationDecorator.encode( buffer );
+        
+        // Encode the Message header and the controls
+        messageDecorator.encode( buffer );
 
         return buffer;
     }



Mime
View raw message