From d408e72de6b31ec6e44a073beb47c067f09fea78 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Wed, 12 Jul 2006 09:23:19 +0000
Subject: [PATCH] - pre-operation plugins are not called anymore when processing synchronization operations   for ADD,DELELTE and MODIFYDN as it was already the case for MODIFY operation   This is necessary to make sure that entries use the same unique ID everywhere.

---
 opends/src/server/org/opends/server/synchronization/DeleteMsg.java |   34 ++++++++++++++++++++--------------
 1 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/opends/src/server/org/opends/server/synchronization/DeleteMsg.java b/opends/src/server/org/opends/server/synchronization/DeleteMsg.java
index 275d901..3e7388f 100644
--- a/opends/src/server/org/opends/server/synchronization/DeleteMsg.java
+++ b/opends/src/server/org/opends/server/synchronization/DeleteMsg.java
@@ -26,10 +26,10 @@
  */
 package org.opends.server.synchronization;
 
-import static org.opends.server.protocols.ldap.LDAPConstants.*;
 import static org.opends.server.synchronization.SynchMessages.SYNCHRONIZATION;
 
 import java.io.UnsupportedEncodingException;
+import java.util.zip.DataFormatException;
 
 import org.opends.server.core.DeleteOperation;
 import org.opends.server.core.Operation;
@@ -58,13 +58,13 @@
    * Creates a new Add message from a byte[].
    *
    * @param in The byte[] from which the operation must be read.
-   * @throws Exception The input byte[] is not a valid AddMsg
+   * @throws DataFormatException The input byte[] is not a valid AddMsg
    */
-  public DeleteMsg(byte[] in) throws Exception
+  public DeleteMsg(byte[] in) throws DataFormatException
   {
     /* first byte is the type */
-    if (in[0] != OP_TYPE_DELETE_REQUEST)
-      throw new Exception("byte[] is not a valid delete msg");
+    if (in[0] != MSG_TYPE_DELETE_REQUEST)
+      throw new DataFormatException("byte[] is not a valid delete msg");
     int pos = 1;
 
     /* read the dn
@@ -75,16 +75,22 @@
     while (in[pos++] != 0)
     {
       if (pos > in.length)
-        throw new Exception("byte[] is not a valid delete msg");
+        throw new DataFormatException("byte[] is not a valid delete msg");
       length++;
     }
-    dn = new String(in, offset, length, "UTF-8");
+    try
+    {
+      dn = new String(in, offset, length, "UTF-8");
 
-    /* read the changeNumber
-     * it is always 24 characters long
-     */
-    String changenumberStr = new String(in, pos, 24, "UTF-8");
-    changeNumber = new ChangeNumber(changenumberStr);
+      /* read the changeNumber
+       * it is always 24 characters long
+       */
+      String changenumberStr = new String(in, pos, 24, "UTF-8");
+      changeNumber = new ChangeNumber(changenumberStr);
+    } catch (UnsupportedEncodingException e)
+    {
+      throw new DataFormatException("UTF-8 is not supported by this jvm.");
+    }
   }
 
 
@@ -111,7 +117,7 @@
    * @return The byte array representation of this Message.
    */
   @Override
-  public byte[] getByte()
+  public byte[] getBytes()
   {
     byte[] byteDn;
     try
@@ -128,7 +134,7 @@
       int pos = 1;
 
       /* put the type of the operation */
-      resultByteArray[0] = OP_TYPE_DELETE_REQUEST;
+      resultByteArray[0] = MSG_TYPE_DELETE_REQUEST;
 
       /* put the DN and a terminating 0 */
       for (int i = 0; i< byteDn.length; i++,pos++)

--
Gitblit v1.10.0