directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1546504 - /directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/TupleCursorImpl.java
Date Fri, 29 Nov 2013 03:39:08 GMT
Author: elecharny
Date: Fri Nov 29 03:39:08 2013
New Revision: 1546504

URL: http://svn.apache.org/r1546504
Log:
o Fixed some bad positioning in the nextKey method, when we try to move after one key which
is in the last page

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

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/TupleCursorImpl.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/TupleCursorImpl.java?rev=1546504&r1=1546503&r2=1546504&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/TupleCursorImpl.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/TupleCursorImpl.java
Fri Nov 29 03:39:08 2013
@@ -600,14 +600,24 @@ public class TupleCursorImpl<K, V> imple
         {
             // End of the leaf. We have to go back into the stack up to the
             // parent, and down to the next leaf
-            parentPos = findNextParentPos();
+            ParentPos<K, V> newParentPos = findNextParentPos();
 
             // we also need to check the result of the call to
             // findNextParentPos as it will return a null ParentPos
-            if ( ( parentPos == null ) || ( parentPos.page == null ) )
+            if ( ( newParentPos == null ) || ( newParentPos.page == null ) )
             {
                 // This is the end : no more value
-                throw new NoSuchElementException( "No more tuples present" );
+                Leaf<K, V> leaf = ( Leaf<K, V> ) ( parentPos.page );
+                ValueHolder<V> valueHolder = leaf.values[parentPos.pos];
+                parentPos.pos = AFTER_LAST;
+                parentPos.valueCursor = valueHolder.getCursor();
+                parentPos.valueCursor.afterLast();
+                
+                return null;
+            }
+            else
+            {
+                parentPos = newParentPos;
             }
         }
         else



Mime
View raw message