From d2fe340f67619135f69eb58a11897753fff88739 Mon Sep 17 00:00:00 2001
From: dugan <dugan@localhost>
Date: Thu, 12 Oct 2006 20:27:35 +0000
Subject: [PATCH] Re-write entries in sorted order. Andy suggested changes

---
 opends/src/server/org/opends/server/tools/LDIFModify.java |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/opends/src/server/org/opends/server/tools/LDIFModify.java b/opends/src/server/org/opends/server/tools/LDIFModify.java
index e84f2ea..55cde7f 100644
--- a/opends/src/server/org/opends/server/tools/LDIFModify.java
+++ b/opends/src/server/org/opends/server/tools/LDIFModify.java
@@ -129,7 +129,8 @@
       DNComparator comparator = new DNComparator();
       TreeMap<DN,AddChangeRecordEntry> adds =
           new TreeMap<DN,AddChangeRecordEntry>(comparator);
-
+      TreeMap<DN,Entry> ldifEntries =
+          new TreeMap<DN,Entry>(comparator);
     HashMap<DN,DeleteChangeRecordEntry> deletes =
          new HashMap<DN,DeleteChangeRecordEntry>();
     HashMap<DN,LinkedList<Modification>> modifications =
@@ -306,8 +307,8 @@
 
 
       // If we've gotten here, then the (possibly updated) entry should be
-      // written to the output LDIF.
-      targetWriter.writeEntry(entry);
+      // written to the LDIF entry Map.
+      ldifEntries.put(entry.getDN(),entry);
     }
 
 
@@ -358,7 +359,8 @@
 
       Entry e = new Entry(add.getDN(), objectClasses, userAttributes,
                           operationalAttributes);
-      targetWriter.writeEntry(e);
+      //Put the entry to be added into the LDIF entry map.
+      ldifEntries.put(e.getDN(),e);
     }
 
 
@@ -381,8 +383,8 @@
         errorList.add(getMessage(msgID, String.valueOf(dn)));
       }
     }
-
-    return errorList.isEmpty();
+    return targetWriter.writeEntries(ldifEntries.values()) &&
+            errorList.isEmpty();
   }
 
 

--
Gitblit v1.10.0