From 3cc69c61335ff7faa2c71276b8401d8961fa9b31 Mon Sep 17 00:00:00 2001 From: Reid Chan Date: Sun, 13 Aug 2017 00:12:19 +0800 Subject: [PATCH] HBASE-18554 Append#add doesn't check the row of passed cell --- .../src/main/java/org/apache/hadoop/hbase/client/Append.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java index 2bd08608f3..b54a4ff28e 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java @@ -17,6 +17,7 @@ */ package org.apache.hadoop.hbase.client; +import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -129,10 +130,16 @@ public class Append extends Mutation { * Add column and value to this Append operation. * @param cell * @return This instance + * @deprecated Will throw IOException in HBase 3.0.0. */ - @SuppressWarnings("unchecked") + @Deprecated public Append add(final Cell cell) { // Presume it is KeyValue for now. + if (!CellUtil.matchingRow(cell, this.row)) { + // TODO: Throw WrongRowIOException in HBase 3.0.0. + throw new IllegalArgumentException("The row in " + cell.toString() + + " doesn't match the original one " + Bytes.toStringBinary(this.row)); + } byte [] family = CellUtil.cloneFamily(cell); List list = this.familyMap.get(family); if (list == null) { -- 2.11.0 (Apple Git-81)