diff --git a/CHANGES.txt b/CHANGES.txt index 5e2f7ca8a59..e7b92583951 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -28,6 +28,8 @@ Release 0.21.0 - Unreleased HBASE-1821 Filtering by SingleColumnValueFilter bug HBASE-1840 RowLock fails when used with IndexTable (Keith Thomas via Stack) HBASE-818 HFile code review and refinement (Schubert Zhang via Stack) + HBASE-1830 HbaseObjectWritable methods should allow null HBCs + for when Writable is not Configurable (Stack via jgray) IMPROVEMENTS HBASE-1760 Cleanup TODOs in HTable diff --git a/src/java/org/apache/hadoop/hbase/filter/CompareFilter.java b/src/java/org/apache/hadoop/hbase/filter/CompareFilter.java index 49a49ed739e..c181cc219d3 100644 --- a/src/java/org/apache/hadoop/hbase/filter/CompareFilter.java +++ b/src/java/org/apache/hadoop/hbase/filter/CompareFilter.java @@ -27,6 +27,7 @@ import java.util.Arrays; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.KeyValue; +import org.apache.hadoop.hbase.io.HbaseObjectWritable; import org.apache.hadoop.io.ObjectWritable; /** @@ -125,18 +126,16 @@ public abstract class CompareFilter implements Filter { compareOp.name()); } } - - private static final HBaseConfiguration hbc = new HBaseConfiguration(); - + public void readFields(DataInput in) throws IOException { compareOp = CompareOp.valueOf(in.readUTF()); comparator = (WritableByteArrayComparable) - ObjectWritable.readObject(in, hbc); + HbaseObjectWritable.readObject(in, null); } public void write(DataOutput out) throws IOException { out.writeUTF(compareOp.name()); - ObjectWritable.writeObject(out, comparator, - WritableByteArrayComparable.class, hbc); + HbaseObjectWritable.writeObject(out, comparator, + WritableByteArrayComparable.class, null); } } diff --git a/src/test/org/apache/hadoop/hbase/TestSerialization.java b/src/test/org/apache/hadoop/hbase/TestSerialization.java index d0670d2e25f..1c9f30e0d9c 100644 --- a/src/test/org/apache/hadoop/hbase/TestSerialization.java +++ b/src/test/org/apache/hadoop/hbase/TestSerialization.java @@ -34,8 +34,11 @@ import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.RowLock; import org.apache.hadoop.hbase.client.Scan; +import org.apache.hadoop.hbase.filter.BinaryComparator; import org.apache.hadoop.hbase.filter.Filter; import org.apache.hadoop.hbase.filter.PrefixFilter; +import org.apache.hadoop.hbase.filter.RowFilter; +import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp; import org.apache.hadoop.hbase.io.HbaseMapWritable; import org.apache.hadoop.hbase.io.TimeRange; import org.apache.hadoop.hbase.util.Bytes; @@ -57,6 +60,14 @@ public class TestSerialization extends HBaseTestCase { super.tearDown(); } + public void testCompareFilter() throws Exception { + Filter f = new RowFilter(CompareOp.EQUAL, + new BinaryComparator(Bytes.toBytes("testRowOne-2"))); + byte [] bytes = Writables.getBytes(f); + Filter ff = (Filter)Writables.getWritable(bytes, new RowFilter()); + assertNotNull(ff); + } + public void testKeyValue() throws Exception { byte [] row = Bytes.toBytes(getName()); byte [] family = Bytes.toBytes(getName());