directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
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 GMT
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<Response> 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<E> implement
     public CursorIterator( Cursor<E> cursor )
     {
         this.cursor = cursor;
-        this.available = cursor.available();
+        
+        try
+        {
+            cursor.next();
+            this.available = true;
+        }
+        catch ( Exception e )
+        {
+            this.available = false;
+        }
     }
 
 



Mime
View raw message