From 4add2283ddd046acc42909973067e9507abec821 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 10 Oct 2013 15:34:19 +0000
Subject: [PATCH] ECLServerHandler.java: Fixed a regression introduced in r9677. It was found by Christophe Sovant with the functional test suite: When throwing a DirectoryException with ERR_RESYNC_REQUIRED_UNKNOWN_DOMAIN_IN_PROVIDED_COOKIE, the domainCtxts is read before it is written to. This code should have been changed to iterate on the Set<DomainContext> rather than the domainCtxts field which has not been assigned at this point.

---
 opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
index 9ebbcd3..e8c6aa4 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
@@ -833,9 +833,8 @@
       // If there are domain missing in the provided cookie,
       // the request is rejected and a full resync is required.
       throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
-        ERR_RESYNC_REQUIRED_MISSING_DOMAIN_IN_PROVIDED_COOKIE.get(
-            missingDomains,
-            "<" + providedCookie + missingDomains + ">"));
+          ERR_RESYNC_REQUIRED_MISSING_DOMAIN_IN_PROVIDED_COOKIE.get(
+              missingDomains, "<" + providedCookie + missingDomains + ">"));
     }
 
     /*
@@ -863,14 +862,14 @@
       This domain has probably been removed or replication disabled on it.
       The request is rejected and full resync is required.
       */
-      StringBuilder sb = new StringBuilder();
-      for (DomainContext domainCtxt : domainCtxts) {
+      final StringBuilder sb = new StringBuilder();
+      for (DomainContext domainCtxt : results) {
         sb.append(domainCtxt.rsDomain.getBaseDN()).append(":")
           .append(domainCtxt.startState).append(";");
       }
       throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
           ERR_RESYNC_REQUIRED_UNKNOWN_DOMAIN_IN_PROVIDED_COOKIE.get(
-              startStatesFromProvidedCookie.toString() ,sb.toString()));
+              startStatesFromProvidedCookie.toString(), sb.toString()));
     }
 
     return results;

--
Gitblit v1.10.0