From e42dc413aa0397458248ceb336a667ee314632f0 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 06 Dec 2013 16:13:01 +0000
Subject: [PATCH] OPENDJ-1088 (CR-2677) Wrong error message and result code when deleting branch as a user with insufficient access rights

---
 opendj-sdk/opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java
index 158ca25..fa30a1d 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java
@@ -128,8 +128,10 @@
          * running later do not generate CSN, solve conflicts and forward the
          * operation to the replication server.
          */
-        for (Control c : op.getRequestControls())
+        final List<Control> controls = op.getRequestControls();
+        for (Iterator<Control> iter = controls.iterator(); iter.hasNext();)
         {
+          Control c = iter.next();
           if (c.getOID().equals(OID_REPLICATION_REPAIR_CONTROL))
           {
             op.setSynchronizationOperation(true);
@@ -139,25 +141,20 @@
             processed and the local backend will fail if it finds a control that
             it does not know about and that is marked as critical.
             */
-            List<Control> controls = op.getRequestControls();
-            controls.remove(c);
+            iter.remove();
             return null;
           }
         }
     }
 
 
-    LDAPReplicationDomain domain;
+    LDAPReplicationDomain domain = null;
     DN temp = dn;
-    do
+    while (domain == null && temp != null)
     {
       domain = domains.get(temp);
       temp = temp.getParentDNInSuffix();
-      if (temp == null)
-      {
-        break;
-      }
-    } while (domain == null);
+    }
 
     return domain;
   }

--
Gitblit v1.10.0