From 8601139b9dac2d351ab7783141e5e0ecc18773a3 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Tue, 10 Mar 2009 08:00:05 +0000
Subject: [PATCH] Fix for issue 3816 (problems with replication, to find DN when uppercase are presents in DN)

---
 opendj-sdk/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java |   47 +++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
index 3b7e07c..6c65c33 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -2626,11 +2626,8 @@
 
     if (replicationDomain == null)
     {
-      MessageBuilder mb = new MessageBuilder(ERR_NO_MATCHING_DOMAIN.get());
-      mb.append(" ");
-      mb.append(String.valueOf(baseDn));
       throw new DirectoryException(ResultCode.OTHER,
-         mb.toMessage());
+          ERR_NO_MATCHING_DOMAIN.get(String.valueOf(baseDn)));
     }
     return replicationDomain;
   }
@@ -3043,4 +3040,46 @@
 
     return attributes;
   }
+
+  /**
+   * Verifies that the given string represents a valid source
+   * from which this server can be initialized.
+   * @param sourceString The string representing the source
+   * @return The source as a short value
+   * @throws DirectoryException if the string is not valid
+   */
+  short decodeSource(String sourceString)
+  throws DirectoryException
+  {
+    short  source = 0;
+    Throwable cause = null;
+    try
+    {
+      source = Integer.decode(sourceString).shortValue();
+      if ((source >= -1) && (source != serverId))
+      {
+        // TODO Verifies serverID is in the domain
+        // We should check here that this is a server implied
+        // in the current domain.
+        return source;
+      }
+    }
+    catch(Exception e)
+    {
+      cause = e;
+    }
+
+    ResultCode resultCode = ResultCode.OTHER;
+    Message message = ERR_INVALID_IMPORT_SOURCE.get();
+    if (cause != null)
+    {
+      throw new DirectoryException(
+          resultCode, message, cause);
+    }
+    else
+    {
+      throw new DirectoryException(
+          resultCode, message);
+    }
+  }
 }

--
Gitblit v1.10.0