From 83325bf8cc3b480c00a01ee4c43391cd0238e041 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 12 Mar 2015 16:32:12 +0000
Subject: [PATCH] Simplified loops in import/rebuild-index code.
---
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexOutputBuffer.java | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexOutputBuffer.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexOutputBuffer.java
index 365dcf1..a0d4c25 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexOutputBuffer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexOutputBuffer.java
@@ -449,13 +449,19 @@
* @param bIndexID The index key to compare.
* @return <CODE>True</CODE> if the byte arrays are equal.
*/
- public boolean recordsEqual(byte[] b, int bIndexID)
+ public boolean sameKeyAndIndexID(byte[] b, int bIndexID)
{
+ if (b == null)
+ {
+ return false;
+ }
+
int offset = getOffset(position);
int indexID = getIndexIDFromOffset(offset);
offset += REC_OVERHEAD + LONG_SIZE;
int keyLen = readInt(buffer, offset);
int key = INT_SIZE + offset;
+
return indexComparator.compare(buffer, key, keyLen, b, b.length) == 0
&& indexID == bIndexID;
}
@@ -533,7 +539,7 @@
* @param position The index pointing to the byte array to compare.
* @return {@code true} if the byte arrays are equal, or {@code false} otherwise
*/
- public boolean byteArraysEqual(int position)
+ public boolean sameKeyAndIndexID(int position)
{
return compare(position, this.position) == 0;
}
--
Gitblit v1.10.0