From aca21e0f8ae2cfcc1326cfa6afffd64c7c35625f Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 11 May 2015 08:54:59 +0000
Subject: [PATCH] Code cleanup

---
 opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java |   35 +++++++++++++++--------------------
 1 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java
index a003477..2358e65 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java
@@ -28,6 +28,7 @@
 
 import static org.opends.messages.BackendMessages.*;
 import static org.opends.server.admin.std.meta.BackendIndexCfgDefn.IndexType.*;
+import static org.opends.server.backends.pluggable.DnKeyFormat.*;
 import static org.opends.server.backends.pluggable.EntryIDSet.*;
 import static org.opends.server.backends.pluggable.SuffixContainer.*;
 import static org.opends.server.util.DynamicConstants.*;
@@ -1214,11 +1215,12 @@
               boolean success = cursor.positionToKeyOrNext(key);
               if (success && key.equals(cursor.getKey()))
               {
-                // This is the base entry for a branch that was excluded in the
-                // import so we must migrate all entries in this branch over to
-                // the new entry container.
-                ByteStringBuilder end = new ByteStringBuilder(key.length() + 1);
-                end.append((byte) 0x01);
+                /*
+                 * This is the base entry for a branch that was excluded in the
+                 * import so we must migrate all entries in this branch over to
+                 * the new entry container.
+                 */
+                ByteStringBuilder end = afterKey(key);
 
                 while (success
                     && ByteSequence.COMPARATOR.compare(key, end) < 0
@@ -1287,21 +1289,16 @@
               }
               else
               {
-                // This is the base entry for a branch that will be included
-                // in the import so we don't want to copy the branch to the
-                //  new entry container.
-
+                /*
+                 * This is the base entry for a branch that will be included
+                 * in the import so we do not want to copy the branch to the
+                 * new entry container.
+                 */
                 /*
                  * Advance the cursor to next entry at the same level in the DIT
-                 * skipping all the entries in this branch. Set the next
-                 * starting value to a value of equal length but slightly
-                 * greater than the previous DN. Since keys are compared in
-                 * reverse order we must set the first byte (the comma). No
-                 * possibility of overflow here.
+                 * skipping all the entries in this branch.
                  */
-                ByteStringBuilder begin = new ByteStringBuilder(key.length() + 1);
-                begin.append(key);
-                begin.append((byte) 0x01);
+                ByteStringBuilder begin = afterKey(key);
                 success = cursor.positionToKeyOrNext(begin);
               }
             }
@@ -1335,9 +1332,7 @@
     }
   }
 
-  /**
-   * Task to perform append/replace processing.
-   */
+  /** Task to perform append/replace processing. */
   private class AppendReplaceTask extends ImportTask
   {
     public AppendReplaceTask(final Storage storage)

--
Gitblit v1.10.0