From a9f9fcc56c81c61857eea46e019e8426b089eca3 Mon Sep 17 00:00:00 2001
From: dugan <dugan@localhost>
Date: Fri, 21 Aug 2009 20:13:18 +0000
Subject: [PATCH] Fix for issue 4178: Only base entry visible after on-line import

---
 opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java b/opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java
index aac3a7a..2349132 100644
--- a/opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java
+++ b/opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java
@@ -1607,7 +1607,6 @@
         dbValue1.setData(v);
         DN dn = DN.decode(ByteString.wrap(dbKey1.getData()));
 
-
         entryID = new EntryID(v1);
         if(parentIDMap.isEmpty())
         {
@@ -1633,16 +1632,17 @@
         }
         else
         {
-          DN pDN = entryContainer.getParentWithinBase(dn);
-          if(parentIDMap.containsKey(pDN)) {
-            DN lastKey = parentIDMap.lastKey();
-            Map<DN, EntryID> subMap = parentIDMap.subMap(pDN, lastKey);
-            for(Map.Entry<DN, EntryID> e : subMap.entrySet())
-            {
-              subMap.remove(e.getKey());
+          DN newParentDN = entryContainer.getParentWithinBase(dn);
+          if(parentIDMap.containsKey(newParentDN))
+          {
+            EntryID newParentID = parentIDMap.get(newParentDN);
+            DN lastDN = parentIDMap.lastKey();
+            while(!newParentDN.equals(lastDN)) {
+              parentIDMap.remove(lastDN);
+              lastDN = parentIDMap.lastKey();
             }
-            parentDN = pDN;
-            parentID = parentIDMap.get(pDN);
+            parentDN = newParentDN;
+            parentID = newParentID;
             lastDN = dn;
             lastID = entryID;
           }
@@ -1659,7 +1659,7 @@
       }
 
 
-    private void id2child(EntryID childID)
+      private void id2child(EntryID childID)
     {
       ImportIDSet idSet;
       if(!id2childTree.containsKey(parentID.getDatabaseEntry().getData()))

--
Gitblit v1.10.0