From 4c7d89a5b8f1503bf63988ae13d47d269e1615de Mon Sep 17 00:00:00 2001
From: mrossign <mrossign@localhost>
Date: Fri, 31 Oct 2008 16:15:12 +0000
Subject: [PATCH] Partial fix for #3525: Attribute modifications are not replicated for modDN operations Warning: ModifyDNMsg PDU is updated and modifications are exchanged through the replication network. However at replay time, the moddn operation is re-created with the modifications, but they cannot be replayed at this time: The comment of the addModification() method for ModifyDNOperation states that "This should only be called by pre-operation plugins"

---
 opends/src/server/org/opends/server/replication/protocol/ModifyMsg.java |   55 +------------------------------------------------------
 1 files changed, 1 insertions(+), 54 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/protocol/ModifyMsg.java b/opends/src/server/org/opends/server/replication/protocol/ModifyMsg.java
index 5416659..9f6676f 100644
--- a/opends/src/server/org/opends/server/replication/protocol/ModifyMsg.java
+++ b/opends/src/server/org/opends/server/replication/protocol/ModifyMsg.java
@@ -31,16 +31,11 @@
 import org.opends.server.core.ModifyOperationBasis;
 import org.opends.server.protocols.asn1.ASN1Exception;
 import org.opends.server.protocols.asn1.ASN1OctetString;
-import org.opends.server.protocols.ldap.LDAPAttribute;
 import org.opends.server.protocols.ldap.LDAPModification;
 import org.opends.server.protocols.asn1.ASN1Element;
 import org.opends.server.protocols.internal.InternalClientConnection;
 import org.opends.server.replication.common.ChangeNumber;
-import org.opends.server.replication.plugin.Historical;
 import org.opends.server.types.AbstractOperation;
-import org.opends.server.types.Attribute;
-import org.opends.server.types.AttributeType;
-import org.opends.server.types.AttributeUsage;
 import org.opends.server.types.DN;
 import org.opends.server.types.LDAPException;
 import org.opends.server.types.Modification;
@@ -56,10 +51,8 @@
 /**
  * Message used to send Modify information.
  */
-public class ModifyMsg extends UpdateMsg
+public class ModifyMsg extends ModifyCommonMsg
 {
-  private byte[] encodedMods = null;
-
   /**
    * Creates a new Modify message from a ModifyOperation.
    *
@@ -170,42 +163,6 @@
   }
 
   /**
-   * Encode an ArrayList of Modification into a byte[] suitable
-   * for storage in a database or send on the network.
-   *
-   * @param mods the ArrayList of Modification to be encoded.
-   */
-  private byte[] modsToByte(List<Modification> mods)
-  {
-    ArrayList<ASN1Element> modsASN1;
-
-    modsASN1 = new ArrayList<ASN1Element>(mods.size());
-    for (Modification mod : mods)
-    {
-      Attribute attr = mod.getAttribute();
-      AttributeType type = attr.getAttributeType();
-      if (type != null )
-      {
-        if (AttributeUsage.DSA_OPERATION.equals(type.getUsage()))
-        {
-          // Attributes with a dsaOperation usage should not be synchronized.
-          // skip them.
-          continue;
-        }
-      }
-
-      if (!Historical.isHistoricalAttribute(attr))
-      {
-        LDAPModification ldapmod = new LDAPModification(
-          mod.getModificationType(), new LDAPAttribute(mod.getAttribute()));
-        modsASN1.add(ldapmod.encode());
-      }
-    }
-
-    return ASN1Element.encodeValue(modsASN1);
-  }
-
-  /**
    * {@inheritDoc}
    */
   @Override
@@ -235,16 +192,6 @@
   }
 
   /**
-   * Set the Modification associated to the UpdateMsg to the provided value.
-   *
-   * @param mods The new Modification associated to this ModifyMsg.
-   */
-  public void setMods(List<Modification> mods)
-  {
-    encodedMods = modsToByte(mods);
-  }
-
-  /**
    * {@inheritDoc}
    */
   @Override

--
Gitblit v1.10.0