directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1552586 - /directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java
Date Fri, 20 Dec 2013 10:38:57 GMT
Author: elecharny
Date: Fri Dec 20 10:38:56 2013
New Revision: 1552586

URL: http://svn.apache.org/r1552586
Log:
Small improvement in serialization

Modified:
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java?rev=1552586&r1=1552585&r2=1552586&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java
Fri Dec 20 10:38:56 2013
@@ -1324,11 +1324,10 @@ public class RecordManager
         // we just iterate on all the values
         ValueHolder<V> valueHolder = leaf.getValue( pos );
         int dataSize = 0;
+        int nbValues = valueHolder.size();
 
         if ( !valueHolder.isSubBtree() )
         {
-            int nbValues = valueHolder.size();
-
             // Write the nb elements first
             byte[] buffer = IntSerializer.serialize( nbValues );
             serializedData.add( buffer );
@@ -1343,14 +1342,14 @@ public class RecordManager
             serializedData.add( buffer );
             dataSize += INT_SIZE;
 
-            // and add the data
-            serializedData.add( data );
+            // and add the data if it's not 0
+            if ( data.length > 0 )
+            {
+                serializedData.add( data );
+            }
         }
         else
         {
-            // First take the number of values
-            int nbValues = valueHolder.size();
-
             if ( nbValues == 0 )
             {
                 // No value.



Mime
View raw message