From fe9cb8a895f5afa731dc9d8ea3723d92a4af544b Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Wed, 11 Oct 2006 13:07:26 +0000
Subject: [PATCH] fix for issue 782 : need to encode/decode the assured flag as part of the update messages

---
 opendj-sdk/opends/src/server/org/opends/server/synchronization/UpdateMessage.java |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/synchronization/UpdateMessage.java b/opendj-sdk/opends/src/server/org/opends/server/synchronization/UpdateMessage.java
index b5df1ee..2d4d550 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/synchronization/UpdateMessage.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/synchronization/UpdateMessage.java
@@ -282,12 +282,13 @@
     byte[] byteEntryuuid = getUniqueId().getBytes("UTF-8");
 
     /* The message header is stored in the form :
-     * <operation type>changenumber><dn><entryuuid><change>
+     * <operation type>changenumber><dn><assured><entryuuid><change>
      * the length of result byte array is therefore :
-     *   1 + dn length + 1 + 24 + additional_length
+     *   1 + change number length + 1 + dn length + 1  + 1 +
+     *   uuid length + 1 + additional_length
      */
-    int length = 1 + changeNumberByte.length + 1 + byteDn.length + 1
-                 + byteEntryuuid.length + 1 + additionalLength;
+    int length = 5 + changeNumberByte.length + byteDn.length
+                 + byteEntryuuid.length + additionalLength;
 
     byte[] encodedMsg = new byte[length];
 
@@ -298,6 +299,9 @@
     /* put the ChangeNumber */
     pos = addByteArray(changeNumberByte, encodedMsg, pos);
 
+    /* put the assured information */
+    encodedMsg[pos++] = (assuredFlag ? (byte) 1 : 0);
+
     /* put the DN and a terminating 0 */
     pos = addByteArray(byteDn, encodedMsg, pos);
 
@@ -332,6 +336,12 @@
       pos += length + 1;
       changeNumber = new ChangeNumber(changenumberStr);
 
+      /* read the assured information */
+      if (encodedMsg[pos++] == 1)
+        assuredFlag = true;
+      else
+        assuredFlag = false;
+
       /* read the dn */
       length = getNextLength(encodedMsg, pos);
       dn = new String(encodedMsg, pos, length, "UTF-8");

--
Gitblit v1.10.0