From 1cce5a276844d1a139686c67aca6b405abe487d3 Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Mon, 31 May 2010 09:23:36 +0000
Subject: [PATCH] Fix regression introduced when fixing issues #3395 and #3998

---
 opendj-sdk/opends/src/server/org/opends/server/replication/protocol/EntryMsg.java |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/EntryMsg.java b/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/EntryMsg.java
index e6bbbb6..475bdd7 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/EntryMsg.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/EntryMsg.java
@@ -115,15 +115,7 @@
       this.destination = Integer.valueOf(destinationString);
       pos += length +1;
 
-      // entry
-      length = getNextLength(in, pos);
-      this.entryByteArray = new byte[length];
-      for (int i=0; i<length; i++)
-      {
-        entryByteArray[i] = in[pos+i];
-      }
-      pos += length +1;
-
+      // msgCnt
       if (version >= ProtocolVersion.REPLICATION_PROTOCOL_V4)
       {
         // msgCnt
@@ -132,6 +124,14 @@
         this.msgId = Integer.valueOf(msgcntString);
         pos += length +1;
       }
+
+      // data
+      length = in.length - (pos + 1);
+      this.entryByteArray = new byte[length];
+      for (int i=0; i<length; i++)
+      {
+        entryByteArray[i] = in[pos+i];
+      }
     }
     catch (UnsupportedEncodingException e)
     {
@@ -188,9 +188,9 @@
 
       pos = addByteArray(senderBytes, resultByteArray, pos);
       pos = addByteArray(destinationBytes, resultByteArray, pos);
-      pos = addByteArray(entryBytes, resultByteArray, pos);
       if (version >= ProtocolVersion.REPLICATION_PROTOCOL_V4)
         pos = addByteArray(msgCntBytes, resultByteArray, pos);
+      pos = addByteArray(entryBytes, resultByteArray, pos);
 
       return resultByteArray;
     }

--
Gitblit v1.10.0