directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r411929 - /directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResult.java
Date Mon, 05 Jun 2006 21:57:06 GMT
Author: elecharny
Date: Mon Jun  5 14:57:06 2006
New Revision: 411929

URL: http://svn.apache.org/viewvc?rev=411929&view=rev
Log:
Fixed a nasty NPE in LdapDN : maatchedDn is not anymore a String

Modified:
    directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResult.java

Modified: directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResult.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResult.java?rev=411929&r1=411928&r2=411929&view=diff
==============================================================================
--- directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResult.java
(original)
+++ directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResult.java
Mon Jun  5 14:57:06 2006
@@ -124,7 +124,7 @@
      */
     public String getMatchedDN()
     {
-        return ( ( matchedDN == null ) ? null : matchedDN.toString() );
+        return ( ( matchedDN == null ) ? "" : matchedDN.toString() );
     }
 
 
@@ -205,7 +205,14 @@
         ldapResultLength = 1 + 1 + 1;
 
         // The matchedDN length
-        ldapResultLength += 1 + Length.getNbBytes( LdapDN.getNbBytes( matchedDN ) ) + LdapDN.getNbBytes(
matchedDN );
+        if ( matchedDN == null )
+        {
+            ldapResultLength += 1 + 1;
+        }
+        else
+        {
+            ldapResultLength += 1 + Length.getNbBytes( LdapDN.getNbBytes( matchedDN ) ) +
LdapDN.getNbBytes( matchedDN );
+        }
 
         // The errorMessage length
         ldapResultLength += 1 + Length.getNbBytes( errorMessage.getNbBytes() ) + errorMessage.getNbBytes();



Mime
View raw message