directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1541437 - in /directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed: BTree.java Leaf.java
Date Wed, 13 Nov 2013 09:30:46 GMT
Author: elecharny
Date: Wed Nov 13 09:30:46 2013
New Revision: 1541437

URL: http://svn.apache.org/r1541437
Log:
o Fixed some issue when browsing from a non existing key outside of the range of keys

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

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/BTree.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/BTree.java?rev=1541437&r1=1541436&r2=1541437&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/BTree.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/BTree.java
Wed Nov 13 09:30:46 2013
@@ -956,7 +956,9 @@ public class BTree<K, V> implements Clos
         Transaction<K, V> transaction = beginReadTransaction();
 
         // Fetch the root page for this revision
-        TupleCursor<K, V> cursor = rootPage.browse( key, transaction, new ParentPos[32],
0 );
+        @SuppressWarnings("unchecked")
+        ParentPos<K, V>[] stack = new ParentPos[32];
+        TupleCursor<K, V> cursor = rootPage.browse( key, transaction, stack, 0 );
 
         return cursor;
     }

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/Leaf.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/Leaf.java?rev=1541437&r1=1541436&r2=1541437&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/Leaf.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/Leaf.java
Wed Nov 13 09:30:46 2013
@@ -667,9 +667,28 @@ import org.apache.directory.mavibot.btre
 
                 cursor = new TupleCursorImpl<K, V>( btree, transaction, stack, 0 );
             }
+            else if ( nbElems > 0 )
+            {
+                // after the last element
+                ParentPos<K, V> parentPos = new ParentPos<K, V>( this, nbElems
- 1 );
+                
+                stack[depth] = parentPos;
+
+                cursor = new TupleCursorImpl<K, V>( btree, transaction, stack, 0 );
+                
+                try
+                {
+                    cursor.afterLast();
+                }
+                catch ( IOException e )
+                {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+            }
             else
             {
-                // Not found : return a null cursor
+                // Not found, because there are no elements : return a null cursor
                 stack[depth] = null;
 
                 return new TupleCursorImpl<K, V>( btree, transaction, null, 0 );



Mime
View raw message