From 31a3bbd4e956110d2bd6107866cf774f4da340b5 Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Fri, 25 Jun 2010 09:40:08 +0000
Subject: [PATCH] Resolves an issue in Import due to entries with multiple RDNs. This patch changes the key format used by the DN2ID database. Rebuilding the index is required.

---
 opendj-sdk/opends/src/server/org/opends/server/backends/jeb/importLDIF/IndexBuffer.java |  168 -------------------------------------------------------
 1 files changed, 1 insertions(+), 167 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/importLDIF/IndexBuffer.java b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/importLDIF/IndexBuffer.java
index 0b87116..992ecc8 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/importLDIF/IndexBuffer.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/importLDIF/IndexBuffer.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2009 Sun Microsystems, Inc.
+ *      Copyright 2009-2010 Sun Microsystems, Inc.
  */
 
 
@@ -796,172 +796,6 @@
 
   /**
    * Implementation of ComparatorBuffer interface. Used to compare keys when
-   * they are DN index is being processed.
-   */
-  public static
-  class DNComparator implements IndexBuffer.ComparatorBuffer<byte[]>
-  {
-
-    /**
-     * Compare two offsets in an byte array using the DN compare algorithm.
-     * The specified index ID is used in the comparision if the byte arrays
-     * are equal.
-     *
-     * @param b The byte array.
-     * @param offset The first offset.
-     * @param length The first length.
-     * @param indexID The first index id.
-     * @param otherOffset The second offset.
-     * @param otherLength The second length.
-     * @param otherIndexID The second index id.
-     * @return a negative integer, zero, or a positive integer as the first
-     *         offset value is less than, equal to, or greater than the second.
-     */
-    public int compare(byte[] b, int offset, int length, int indexID,
-                       int otherOffset, int otherLength, int otherIndexID)
-    {
-      for (int i = length - 1, j = otherLength - 1;
-           i >= 0 && j >= 0; i--, j--) {
-        if (b[offset + i] > b[otherOffset + j])
-        {
-          return 1;
-        }
-        else if (b[offset + i] < b[otherOffset + j])
-        {
-          return -1;
-        }
-      }
-      //The arrays are equal, make sure they are in the same index since
-      //multiple suffixes might have the same key.
-      if(length == otherLength)
-      {
-        if(indexID == otherIndexID)
-        {
-          return 0;
-        }
-        else if(indexID > otherIndexID)
-        {
-          return 1;
-        }
-        else
-        {
-          return -1;
-        }
-      }
-      if(length > otherLength)
-      {
-        return 1;
-      }
-      else
-      {
-        return -1;
-      }
-    }
-
-
-    /**
-     * Compare an offset in an byte array with the specified byte array,
-     * using the DN compare algorithm. The specified index ID is used in the
-     * comparision if the byte arrays are equal.
-     *
-     * @param b The byte array.
-     * @param offset The first offset.
-     * @param length The first length.
-     * @param indexID The first index id.
-     * @param other The second byte array to compare to.
-     * @param otherLength The second object's length.
-     * @param otherIndexID The second index id.
-     * @return a negative integer, zero, or a positive integer as the first
-     *         offset value is less than, equal to, or greater than the second
-     *         byte array.
-     */
-    public int compare(byte[] b, int offset, int length, int indexID,
-                       byte[]other, int otherLength, int otherIndexID)
-    {
-      for (int i = length - 1, j = otherLength - 1;
-           i >= 0 && j >= 0; i--, j--) {
-        if (b[offset + i] > other[j])
-        {
-          return 1;
-        }
-        else if (b[offset + i] < other[j])
-        {
-          return -1;
-        }
-      }
-     //The arrays are equal, make sure they are in the same index since
-      //multiple suffixes might have the same key.
-      if(length == otherLength)
-      {
-        if(indexID == otherIndexID)
-        {
-          return 0;
-        }
-        else if(indexID > otherIndexID)
-        {
-          return 1;
-        }
-        else
-        {
-          return -1;
-        }
-      }
-      if(length > otherLength)
-      {
-        return 1;
-      }
-      else
-      {
-        return -1;
-      }
-    }
-
-
-    /**
-     * Compare an offset in an byte array with the specified byte array,
-     * using the DN compare algorithm.
-     *
-     * @param b The byte array.
-     * @param offset The first offset.
-     * @param length The first length.
-     * @param other The second byte array to compare to.
-     * @param otherLength The second object's length.
-     * @return a negative integer, zero, or a positive integer as the first
-     *         offset value is less than, equal to, or greater than the
-     *         second byte array.
-     */
-    public int compare(byte[] b, int offset, int length, byte[] other,
-                       int otherLength)
-    {
-      for (int i = length - 1, j = otherLength - 1;
-           i >= 0 && j >= 0; i--, j--) {
-        if (b[offset + i] > other[j])
-        {
-          return 1;
-        }
-        else if (b[offset + i] < other[j])
-        {
-          return -1;
-        }
-      }
-      if(length == otherLength)
-      {
-        return 0;
-      }
-      if(length > otherLength)
-      {
-        return 1;
-      }
-      else
-      {
-        return -1;
-      }
-    }
-  }
-
-
-  /**
-   * Implementation of ComparatorBuffer interface. Used to compare keys when
    * they are non-DN indexes.
    */
   public static

--
Gitblit v1.10.0