hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nspiegelb...@apache.org
Subject svn commit: r1181356 - in /hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/filter: BinaryPrefixComparator.java ColumnPrefixFilter.java
Date Tue, 11 Oct 2011 02:01:32 GMT
Author: nspiegelberg
Date: Tue Oct 11 02:01:31 2011
New Revision: 1181356

URL: http://svn.apache.org/viewvc?rev=1181356&view=rev
Log:
HBASE 2928: Fault in logic in BinaryPrefixComparator leads to ArrayIndexOutOfBoundsException

Summary:
Following statement makes an incorrect assumption that value.length >=
this.value.length.

return Bytes.compareTo(this.value, 0, this.value.length, value, 0,
this.value.length);

(Also, removed a couple of unused imports)

Change is committed to public trunk

Test Plan:
All tests related to PrefixFilter are passing

DiffCamp Revision: 147534
Reviewed By: jgray
CC: jgray, hbase@lists
Tasks:
#318619: Resolving exceptions in BinaryPrefixFilter

Revert Plan:
OK

Modified:
    hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/filter/BinaryPrefixComparator.java
    hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/filter/ColumnPrefixFilter.java

Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/filter/BinaryPrefixComparator.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/filter/BinaryPrefixComparator.java?rev=1181356&r1=1181355&r2=1181356&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/filter/BinaryPrefixComparator.java
(original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/filter/BinaryPrefixComparator.java
Tue Oct 11 02:01:31 2011
@@ -42,8 +42,12 @@ public class BinaryPrefixComparator exte
 
   @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);
+    }
   }
 
 }

Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/filter/ColumnPrefixFilter.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/filter/ColumnPrefixFilter.java?rev=1181356&r1=1181355&r2=1181356&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/filter/ColumnPrefixFilter.java
(original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/filter/ColumnPrefixFilter.java
Tue Oct 11 02:01:31 2011
@@ -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;



Mime
View raw message