directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r463697 - /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponse.java
Date Fri, 13 Oct 2006 15:00:05 GMT
Author: elecharny
Date: Fri Oct 13 08:00:04 2006
New Revision: 463697

URL: http://svn.apache.org/viewvc?view=rev&rev=463697
Log:
The computeLength() was not handling a case where the response was not empty while the responseName
was empty,
generatoing some BufferOutOfBound exception. Fixed

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?view=diff&rev=463697&r1=463696&r2=463697
==============================================================================
--- 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 Oct 13 08:00:04 2006
@@ -155,19 +155,19 @@
         {
             responseNameLength = responseName.toString().length();
             extendedResponseLength += 1 + TLV.getNbBytes( responseNameLength ) + responseNameLength;
+        }
 
-            if ( response != null )
+        if ( response != null )
+        {
+            if ( response instanceof String )
             {
-                if ( response instanceof String )
-                {
-                    int responseLength = StringTools.getBytesUtf8( ( String ) response ).length;
-                    extendedResponseLength += 1 + TLV.getNbBytes( responseLength ) + responseLength;
-                }
-                else
-                {
-                    extendedResponseLength += 1 + TLV.getNbBytes( ( ( byte[] ) response ).length
)
-                        + ( ( byte[] ) response ).length;
-                }
+                int responseLength = StringTools.getBytesUtf8( ( String ) response ).length;
+                extendedResponseLength += 1 + TLV.getNbBytes( responseLength ) + responseLength;
+            }
+            else
+            {
+                extendedResponseLength += 1 + TLV.getNbBytes( ( ( byte[] ) response ).length
)
+                    + ( ( byte[] ) response ).length;
             }
         }
 



Mime
View raw message