directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r414936 - /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponse.java
Date Fri, 16 Jun 2006 21:48:53 GMT
Author: elecharny
Date: Fri Jun 16 14:48:52 2006
New Revision: 414936

URL: http://svn.apache.org/viewvc?rev=414936&view=rev
Log:
- Fixed the computeLength() method to accept a null responseName
with a not null responseValue
- formated the javadoc

Modified:
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponse.java

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponse.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponse.java?rev=414936&r1=414935&r2=414936&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponse.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponse.java
Fri Jun 16 14:48:52 2006
@@ -126,11 +126,19 @@
 
 
     /**
-     * Compute the ExtendedResponse length ExtendedResponse : 0x78 L1 | +-->
-     * LdapResult [+--> 0x8A L2 name [+--> 0x8B L3 response]] L1 =
-     * Length(LdapResult) [ + Length(0x8A) + Length(L2) + L2 [ + Length(0x8B) +
-     * Length(L3) + L3]] Length(ExtendedResponse) = Length(0x78) + Length(L1) +
-     * L1
+     * Compute the ExtendedResponse length 
+     * ExtendedResponse : 
+     * 0x78 L1 
+     *   | 
+     *   +--> LdapResult 
+     *  [+--> 0x8A L2 name 
+     *  [+--> 0x8B L3 response]] 
+     *  
+     * L1 = Length(LdapResult) 
+     *   [ + Length(0x8A) + Length(L2) + L2 
+     *   [ + Length(0x8B) + Length(L3) + L3]] 
+     * 
+     * Length(ExtendedResponse) = Length(0x78) + Length(L1) + L1
      * 
      * @return The ExtendedResponse length
      */
@@ -142,19 +150,19 @@
         {
             responseNameLength = responseName.toString().length();
             extendedResponseLength += 1 + Length.getNbBytes( responseNameLength ) + responseNameLength;
+        }
 
-            if ( response != null )
+        if ( response != null )
+        {
+            if ( response instanceof String )
+            {
+                int responseLength = StringTools.getBytesUtf8( ( String ) response ).length;
+                extendedResponseLength += 1 + Length.getNbBytes( responseLength ) + responseLength;
+            }
+            else
             {
-                if ( response instanceof String )
-                {
-                    int responseLength = StringTools.getBytesUtf8( ( String ) response ).length;
-                    extendedResponseLength += 1 + Length.getNbBytes( responseLength ) + responseLength;
-                }
-                else
-                {
-                    extendedResponseLength += 1 + Length.getNbBytes( ( ( byte[] ) response
).length )
-                        + ( ( byte[] ) response ).length;
-                }
+                extendedResponseLength += 1 + Length.getNbBytes( ( ( byte[] ) response ).length
)
+                    + ( ( byte[] ) response ).length;
             }
         }
 



Mime
View raw message