From 4b7bf9f0b51c9f487a92c3686825ec57d0ebf156 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Mon, 19 Mar 2007 08:05:16 +0000
Subject: [PATCH] Fix for issue 1375 : Conflict between add and replace can be incorrectly resolved The problem happens because the historical information saved in the entry is badly read in the Historical.load() method

---
 opendj-sdk/opends/src/server/org/opends/server/synchronization/plugin/AttrInfo.java |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/synchronization/plugin/AttrInfo.java b/opendj-sdk/opends/src/server/org/opends/server/synchronization/plugin/AttrInfo.java
index a967b8d..33f6b32 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/synchronization/plugin/AttrInfo.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/synchronization/plugin/AttrInfo.java
@@ -27,6 +27,7 @@
 package org.opends.server.synchronization.plugin;
 
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.LinkedHashSet;
 
 import org.opends.server.synchronization.common.ChangeNumber;
@@ -121,19 +122,31 @@
                                                             this.valuesInfo);
      return dup;
    }
+
    /**
-    * Delete all historical information for this attribute type.
-    * Replace it with delete attribute state information
+    * Delete all historical information that is older than
+    * the provided ChangeNumber for this attribute type.
+    * Add the delete attribute state information
     * @param CN time when the delete was done
     */
    void delete(ChangeNumber CN)
    {
-     if (this.valuesInfo != null)
-      this.valuesInfo.clear();
+     // iterate through the values in the valuesInfo
+     // and suppress all the values that have not been added
+     // after the date of this delete.
+     Iterator<ValueInfo> it = this.valuesInfo.iterator();
+     while (it.hasNext())
+     {
+       ValueInfo info = it.next();
+       if (CN.newerOrEquals(info.getValueUpdateTime()))
+         it.remove();
+     }
+
      if (CN.newer(deleteTime))
      {
        deleteTime = CN;
      }
+
      if (CN.newer(lastUpdateTime))
      {
        lastUpdateTime = CN;

--
Gitblit v1.10.0