From 70c59429431f6811943521287ba2dab30a4699b3 Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Thu, 27 May 2010 13:39:53 +0000
Subject: [PATCH] Fix for issue #4553 - Referencial Integrity plugin fails when configure to check integrity on several attributes and only one is in the entry

---
 opends/src/server/org/opends/server/plugins/ReferentialIntegrityPlugin.java |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/opends/src/server/org/opends/server/plugins/ReferentialIntegrityPlugin.java b/opends/src/server/org/opends/server/plugins/ReferentialIntegrityPlugin.java
index cfc49f6..e279194 100644
--- a/opends/src/server/org/opends/server/plugins/ReferentialIntegrityPlugin.java
+++ b/opends/src/server/org/opends/server/plugins/ReferentialIntegrityPlugin.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2008 Sun Microsystems, Inc.
+ *      Copyright 2008-2010 Sun Microsystems, Inc.
  */
 package org.opends.server.plugins;
 
@@ -696,15 +696,20 @@
     {
       if(e.hasAttribute(type))
       {
-        mods.add(new Modification(ModificationType.DELETE, Attributes
-            .create(type, oldEntryDN.toString())));
-
-        // If the new entry DN exists, create an ADD modification for
-        // it.
-        if(newEntryDN != null)
+        AttributeValue value = AttributeValues
+            .create(type, oldEntryDN.toString());
+        if (e.hasValue(type, null, value))
         {
-          mods.add(new Modification(ModificationType.ADD, Attributes
-              .create(type, newEntryDN.toString())));
+          mods.add(new Modification(ModificationType.DELETE, Attributes
+              .create(type, value)));
+
+          // If the new entry DN exists, create an ADD modification for
+          // it.
+          if(newEntryDN != null)
+          {
+            mods.add(new Modification(ModificationType.ADD, Attributes
+                .create(type, newEntryDN.toString())));
+          }
         }
       }
     }

--
Gitblit v1.10.0