From commits-return-31853-apmail-directory-commits-archive=directory.apache.org@directory.apache.org Mon May 23 13:00:38 2011 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 D14214FD7 for ; Mon, 23 May 2011 13:00:38 +0000 (UTC) Received: (qmail 86585 invoked by uid 500); 23 May 2011 13:00:38 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 86531 invoked by uid 500); 23 May 2011 13:00:38 -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 86524 invoked by uid 99); 23 May 2011 13:00:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 May 2011 13:00:38 +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; Mon, 23 May 2011 13:00:36 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3A3802388A3C; Mon, 23 May 2011 13:00:15 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1126479 - in /directory: apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorIterator.java Date: Mon, 23 May 2011 13:00:15 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110523130015.3A3802388A3C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elecharny Date: Mon May 23 13:00:14 2011 New Revision: 1126479 URL: http://svn.apache.org/viewvc?rev=1126479&view=rev Log: Fix for DIRSHARED-124 : we call next() in the cursor, and if there is no result, we catch the exception, and set the available flag to false. The test has been changed to use a foreach instead of a while, to check the fix. Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorIterator.java Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java?rev=1126479&r1=1126478&r2=1126479&view=diff ============================================================================== --- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java (original) +++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java Mon May 23 13:00:14 2011 @@ -1681,7 +1681,8 @@ public class SearchIT extends AbstractLd Cursor cursor = connection.search( req ); long i = 0; - while ( cursor.next() ) + // Equivalent to : while ( cursor.next() ) + for ( Response response : cursor ) { ++i; } Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorIterator.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorIterator.java?rev=1126479&r1=1126478&r2=1126479&view=diff ============================================================================== --- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorIterator.java (original) +++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorIterator.java Mon May 23 13:00:14 2011 @@ -49,7 +49,16 @@ public class CursorIterator implement public CursorIterator( Cursor cursor ) { this.cursor = cursor; - this.available = cursor.available(); + + try + { + cursor.next(); + this.available = true; + } + catch ( Exception e ) + { + this.available = false; + } }