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 2016/06/18 04:33:28 UTC

svn commit: r1748905 - /directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/ModifyRequestDecorator.java

Author: elecharny
Date: Sat Jun 18 04:33:28 2016
New Revision: 1748905

URL: http://svn.apache.org/viewvc?rev=1748905&view=rev
Log:
Fixed a potential NPE when the Value is null.

Modified:
    directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/ModifyRequestDecorator.java

Modified: directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/ModifyRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/ModifyRequestDecorator.java?rev=1748905&r1=1748904&r2=1748905&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/ModifyRequestDecorator.java (original)
+++ directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/ModifyRequestDecorator.java Sat Jun 18 04:33:28 2016
@@ -449,7 +449,16 @@ public class ModifyRequestDecorator exte
                 {
                     for ( Value value : modification.getAttribute() )
                     {
-                        localValuesLength += 1 + TLV.getNbBytes( value.getBytes().length ) + value.getBytes().length;
+                        byte[] valueBytes = value.getBytes();
+                        
+                        if ( valueBytes != null )
+                        {
+                            localValuesLength += 1 + TLV.getNbBytes( valueBytes.length ) + valueBytes.length;
+                        }
+                        else
+                        {
+                            localValuesLength += 1 + 1;
+                        }
                     }
                 }