From 48ad33e4575b1b5b9d7b128f657c504da3c9a1f0 Mon Sep 17 00:00:00 2001
From: pgamba <pgamba@localhost>
Date: Thu, 15 Oct 2009 13:15:17 +0000
Subject: [PATCH] Fix #4263 ECL entries should include creatorsName and createTimestamp

---
 opendj-sdk/opends/src/server/org/opends/server/replication/protocol/DeleteMsg.java |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/DeleteMsg.java b/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/DeleteMsg.java
index b3d685e..4068db1 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/DeleteMsg.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/DeleteMsg.java
@@ -43,6 +43,8 @@
  */
 public class DeleteMsg extends LDAPUpdateMsg
 {
+  String initiatorsName;
+
   /**
    * Creates a new delete message.
    *
@@ -137,13 +139,28 @@
 
     byte[] byteEntryAttrLen =
       String.valueOf(encodedEclIncludes.length).getBytes("UTF-8");
+
     bodyLength += byteEntryAttrLen.length + 1;
     bodyLength += encodedEclIncludes.length + 1;
+    byte[] byteInitiatorsName = null;
+    if (initiatorsName != null)
+    {
+      byteInitiatorsName = initiatorsName.getBytes("UTF-8");
+      bodyLength += byteInitiatorsName.length + 1;
+    }
+    else
+    {
+      bodyLength++;
+    }
 
     /* encode the header in a byte[] large enough to also contain the mods */
     byte [] encodedMsg = encodeHeader(MSG_TYPE_DELETE, bodyLength,
         ProtocolVersion.REPLICATION_PROTOCOL_V4);
     int pos = encodedMsg.length - bodyLength;
+    if (byteInitiatorsName != null)
+      pos = addByteArray(byteInitiatorsName, encodedMsg, pos);
+    else
+      encodedMsg[pos++] = 0;
     pos = addByteArray(byteEntryAttrLen, encodedMsg, pos);
     pos = addByteArray(encodedEclIncludes, encodedMsg, pos);
     return encodedMsg;
@@ -158,6 +175,17 @@
   {
     // Read ecl attr len
     int length = getNextLength(in, pos);
+    if (length != 0)
+    {
+      initiatorsName = new String(in, pos, length, "UTF-8");
+      pos += length + 1;
+    }
+    else
+    {
+      initiatorsName = null;
+      pos += 1;
+    }
+    length = getNextLength(in, pos);
     int eclAttrLen = Integer.valueOf(new String(in, pos, length,"UTF-8"));
     pos += length + 1;
 
@@ -216,4 +244,23 @@
     return encodedEclIncludes.length + headerSize();
   }
 
+  /**
+   * Set the initiator's name of this change.
+   *
+   * @param iname the initiator's name.
+   */
+  public void setInitiatorsName(String iname)
+  {
+    initiatorsName = iname;
+  }
+
+  /**
+   * Get the initiator's name of this change.
+   * @return the initiator's name.
+   */
+  public String getInitiatorsName()
+  {
+    return initiatorsName;
+  }
+
 }

--
Gitblit v1.10.0