Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4397810F8B for ; Wed, 13 Nov 2013 09:34:43 +0000 (UTC) Received: (qmail 52823 invoked by uid 500); 13 Nov 2013 09:31:31 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 52200 invoked by uid 500); 13 Nov 2013 09:31:15 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 52181 invoked by uid 99); 13 Nov 2013 09:31:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Nov 2013 09:31:08 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Nov 2013 09:31:06 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id AAD95238896F; Wed, 13 Nov 2013 09:30:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131113093046.AAD95238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 implements Clos Transaction transaction = beginReadTransaction(); // Fetch the root page for this revision - TupleCursor cursor = rootPage.browse( key, transaction, new ParentPos[32], 0 ); + @SuppressWarnings("unchecked") + ParentPos[] stack = new ParentPos[32]; + TupleCursor 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( btree, transaction, stack, 0 ); } + else if ( nbElems > 0 ) + { + // after the last element + ParentPos parentPos = new ParentPos( this, nbElems - 1 ); + + stack[depth] = parentPos; + + cursor = new TupleCursorImpl( 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( btree, transaction, null, 0 );