mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
12.19.2015 ae6b4362fce94c2d5c81f64d612a604971239d31
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/IndexOutputBuffer.java
@@ -26,6 +26,8 @@
 */
package org.opends.server.backends.jeb;
import static org.opends.server.backends.jeb.Importer.indexComparator;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
@@ -100,9 +102,6 @@
  /** Used to iterate over the buffer when writing to a scratch file. */
  private int position;
  /** The comparator to use sort the keys. */
  private ComparatorBuffer<byte[]> comparator;
  /**
   * Used to make sure that an instance of this class is put on the
   * correct scratch file writer work queue for processing.
@@ -148,7 +147,6 @@
    recordOffset = size - 1;
    keys = 0;
    position = 0;
    comparator = null;
    indexKey = null;
  }
@@ -228,18 +226,6 @@
  }
  /**
   * Set the comparator to be used in the buffer processing to the specified
   * comparator.
   *
   * @param comparator The comparator to set the buffer's comparator to.
   */
  public void setComparator(ComparatorBuffer<byte[]> comparator)
  {
    this.comparator = comparator;
  }
  /**
   * Return a buffer's current position value.
   *
   * @return The buffer's current position value.
@@ -249,7 +235,6 @@
    return position;
  }
  /**
   * Set a buffer's position value to the specified position.
   *
@@ -260,7 +245,6 @@
    this.position = position;
  }
  /**
   * Sort the buffer.
   */
@@ -268,7 +252,6 @@
    sort(0, keys);
  }
  /**
   * Add the specified key byte array and EntryID to the buffer.
   *
@@ -461,7 +444,7 @@
    int yKeyLen = PackedInteger.readInt(buffer, yoffSet);
    int yKey = PackedInteger.getReadIntLength(buffer, yoffSet) + yoffSet;
    int cmp = comparator.compare(buffer, xKey, xKeyLen, xIndexID, yKey, yKeyLen, yIndexID);
    int cmp = indexComparator.compare(buffer, xKey, xKeyLen, xIndexID, yKey, yKeyLen, yIndexID);
    return evaluateReturnCode(cmp, op);
  }
@@ -474,7 +457,7 @@
    int xKeyLen = PackedInteger.readInt(buffer, xoffSet);
    int xKey = PackedInteger.getReadIntLength(buffer, xoffSet) + xoffSet;
    int cmp = comparator.compare(buffer, xKey, xKeyLen, xIndexID, yKey, yKey.length, yIndexID);
    int cmp = indexComparator.compare(buffer, xKey, xKeyLen, xIndexID, yKey, yKey.length, yIndexID);
    return evaluateReturnCode(cmp, op);
  }
@@ -497,7 +480,7 @@
    offset += PackedInteger.getReadLongLength(buffer, offset);
    int keyLen = PackedInteger.readInt(buffer, offset);
    int key = PackedInteger.getReadIntLength(buffer, offset) + offset;
    return comparator.compare(buffer, key, keyLen, b, b.length) == 0
    return indexComparator.compare(buffer, key, keyLen, b, b.length) == 0
        && indexID == bIndexID;
  }
@@ -523,7 +506,7 @@
    int keyLen = PackedInteger.readInt(buffer, offset);
    int key = PackedInteger.getReadIntLength(buffer, offset) + offset;
    final int cmp = comparator.compare(buffer, key, keyLen, keyBuf.array(), keyBuf.limit());
    final int cmp = indexComparator.compare(buffer, key, keyLen, keyBuf.array(), keyBuf.limit());
    if (cmp != 0)
    {
      return cmp;