From e61d6d0a55d022a0768e730521bfea36ad506f9d Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 13 Jul 2016 14:16:36 +0000
Subject: [PATCH] dsreplication: Code cleanup

---
 opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContext.java |   18 ++++--------------
 1 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContext.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContext.java
index 0645cbe..c0d4835 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContext.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContext.java
@@ -91,7 +91,7 @@
   /** Enumeration containing the different server properties that are stored in the ADS. */
   public enum ServerProperty
   {
-    /** The ID used to identify the server. */
+    /** The ID used to identify the server (hostname + port). */
     ID("id",ADSPropertySyntax.STRING),
     /** The host name of the server. */
     HOST_NAME("hostname",ADSPropertySyntax.STRING),
@@ -379,7 +379,7 @@
       }
       groupList.add(ALL_SERVERGROUP_NAME);
       serverProperties.put(ServerProperty.GROUPS, groupList);
-      updateServer(serverProperties, null);
+      updateServer(serverProperties);
     }
     catch (ADSContextException ace)
     {
@@ -405,23 +405,13 @@
    * @throws ADSContextException
    *           if the server could not be registered.
    */
-  private void updateServer(Map<ServerProperty, Object> serverProperties, String newServerId)
+  private void updateServer(Map<ServerProperty, Object> serverProperties)
       throws ADSContextException
   {
     DN dn = makeDNFromServerProperties(serverProperties);
 
     try
     {
-      if (newServerId != null)
-      {
-        Map<ServerProperty, Object> newServerProps = new HashMap<>(serverProperties);
-        newServerProps.put(ServerProperty.ID, newServerId);
-        DN newDn = makeDNFromServerProperties(newServerProps);
-        throwIfNotSuccess(connectionWrapper.getConnection().modifyDN(dn.toString(), newDn.toString()));
-        dn = newDn;
-        serverProperties.put(ServerProperty.ID, newServerId);
-      }
-
       ModifyRequest request = newModifyRequest(dn);
       for (ServerProperty prop : serverProperties.keySet())
       {
@@ -596,7 +586,7 @@
     {
       if (x.getError() == ErrorType.ALREADY_REGISTERED)
       {
-        updateServer(serverProperties, null);
+        updateServer(serverProperties);
         return 1;
       }
 

--
Gitblit v1.10.0