HBASE-2928 Fault in logic in BinaryPrefixComparator leads to ArrayIndexOutOfBoundsException (pranav via jgray)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@986969 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Gray 2010-08-18 22:27:58 +00:00
parent 0e481c64e8
commit 5e9f6d1528
3 changed files with 8 additions and 4 deletions

View File

@ -480,6 +480,8 @@ Release 0.21.0 - Unreleased
(Libor Dener via Stack)
HBASE-2923 Deadlock between HRegion.internalFlushCache and close
HBASE-2927 BaseScanner gets stale HRegionInfo in some race cases
HBASE-2928 Fault in logic in BinaryPrefixComparator leads to
ArrayIndexOutOfBoundsException (pranav via jgray)
IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable

View File

@ -42,8 +42,12 @@ public class BinaryPrefixComparator extends WritableByteArrayComparable {
@Override
public int compareTo(byte [] value) {
return Bytes.compareTo(this.value, 0, this.value.length, value, 0,
this.value.length);
if (this.value.length <= value.length) {
return Bytes.compareTo(this.value, 0, this.value.length, value, 0,
this.value.length);
} else {
return Bytes.compareTo(this.value, value);
}
}
}

View File

@ -20,9 +20,7 @@
package org.apache.hadoop.hbase.filter;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.KeyValue.Type;
import org.apache.hadoop.hbase.util.Bytes;
import java.io.DataOutput;