From 5709c7a44071720b0a35bf8360011f87a745cdd1 Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Fri, 28 May 2010 09:23:25 +0000
Subject: [PATCH] Fix an issue in replication changes dependancy computing related to Mod DNs
---
opends/src/server/org/opends/server/replication/protocol/ModifyDNMsg.java | 39 ++++++++++++++++++++++++---------------
1 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/protocol/ModifyDNMsg.java b/opends/src/server/org/opends/server/replication/protocol/ModifyDNMsg.java
index cda7822..8232018 100644
--- a/opends/src/server/org/opends/server/replication/protocol/ModifyDNMsg.java
+++ b/opends/src/server/org/opends/server/replication/protocol/ModifyDNMsg.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2006-2009 Sun Microsystems, Inc.
+ * Copyright 2006-2010 Sun Microsystems, Inc.
*/
package org.opends.server.replication.protocol;
@@ -672,6 +672,27 @@
}
/**
+ * Computes and return the new DN that the entry should
+ * have after this operation.
+ *
+ * @return the newDN.
+ * @throws DirectoryException in case of decoding problems.
+ */
+ private DN computeNewDN() throws DirectoryException
+ {
+ if (newSuperior == null)
+ {
+ DN parentDn = DN.decode(this.getDn()).getParent();
+ return parentDn.concat(RDN.decode(newRDN));
+ }
+ else
+ {
+ String newStringDN = newRDN + "," + newSuperior;
+ return DN.decode(newStringDN);
+ }
+ }
+
+ /**
* Check if this MSG will change the DN of the target entry to be
* the same as the dn given as a parameter.
* @param targetDn the DN to use when checking if this MSG will change
@@ -683,18 +704,7 @@
{
try
{
- DN newDN;
- if (newSuperior == null)
- {
- DN parentDn = DN.decode(this.getDn()).getParent();
- newDN = parentDn.concat(RDN.decode(newRDN));
- }
- else
- {
- String newStringDN = newRDN + "," + newSuperior;
- newDN = DN.decode(newStringDN);
- }
-
+ DN newDN = computeNewDN();
if (newDN.isAncestorOf(targetDn))
return true;
@@ -721,8 +731,7 @@
{
try
{
- String newStringDN = newRDN + "," + newSuperior;
- DN newDN = DN.decode(newStringDN);
+ DN newDN = computeNewDN();
if (newDN.equals(targetDN))
return true;
--
Gitblit v1.10.0