From 431ed6f0fce445f7375af1d154461674627deedf Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 14 Nov 2013 10:03:36 +0000
Subject: [PATCH] CompositeDBCursorTest.java: ADDED

---
 opends/src/server/org/opends/server/replication/server/changelog/je/CompositeDBCursor.java |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/changelog/je/CompositeDBCursor.java b/opends/src/server/org/opends/server/replication/server/changelog/je/CompositeDBCursor.java
index f531745..7f8e3c3 100644
--- a/opends/src/server/org/opends/server/replication/server/changelog/je/CompositeDBCursor.java
+++ b/opends/src/server/org/opends/server/replication/server/changelog/je/CompositeDBCursor.java
@@ -79,15 +79,18 @@
   @Override
   public boolean next() throws ChangelogException
   {
-    // try to recycle empty cursors in case the underlying ReplicaDBs received
-    // new changes. Copy the List to avoid ConcurrentModificationExceptions.
-    DBCursor<UpdateMsg>[] copy =
-        exhaustedCursors.toArray(new DBCursor[exhaustedCursors.size()]);
-    exhaustedCursors.clear();
-    for (DBCursor<UpdateMsg> cursor : copy)
+    if (!exhaustedCursors.isEmpty())
     {
-      cursor.next();
-      add(cursor);
+      // try to recycle empty cursors in case the underlying ReplicaDBs received
+      // new changes. Copy the List to avoid ConcurrentModificationExceptions.
+      final DBCursor<UpdateMsg>[] copy =
+          exhaustedCursors.toArray(new DBCursor[exhaustedCursors.size()]);
+      exhaustedCursors.clear();
+      for (DBCursor<UpdateMsg> cursor : copy)
+      {
+        cursor.next();
+        add(cursor);
+      }
     }
 
     if (cursors.isEmpty())

--
Gitblit v1.10.0