From 9460067fd85568f9eff7c57bb93aacfa01c9d6d0 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Fri, 15 Aug 2008 19:02:50 +0000 Subject: [PATCH] HBASE-833 Doing an insert with an unknown family throws a NPE in HRS git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@686322 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + .../hbase/regionserver/HRegionServer.java | 20 +++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 530728294d2..46268e9f697 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -25,6 +25,7 @@ Release 0.3.0 - Unreleased (Jean-Daniel Cryans via Stack) HBASE-831 committing BatchUpdate with no row should complain (Andrew Purtell via Jim Kellerman) + HBASE-833 Doing an insert with an unknown family throws a NPE in HRS IMPROVEMENTS HBASE-801 When a table haven't disable, shell could response in a "user diff --git a/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index f75acf6820e..9a6b29c8b26 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -53,6 +53,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseConfiguration; +import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HMsg; import org.apache.hadoop.hbase.HRegionInfo; @@ -1159,15 +1160,18 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable { batchUpdate.iterator(); iter.hasNext();) { BatchOperation operation = iter.next(); - int maxLength = - desc.getFamily(HStoreKey.getFamily(operation.getColumn())). - getMaxValueLength(); - if(operation.getValue() != null) - if(operation.getValue().length > maxLength) { - throw new IOException("Value in column " + - Bytes.toString(operation.getColumn()) + " is too long. " + - operation.getValue().length + " instead of " + maxLength); + if (operation.getValue() != null) { + HColumnDescriptor fam = + desc.getFamily(HStoreKey.getFamily(operation.getColumn())); + if (fam != null) { + int maxLength = fam.getMaxValueLength(); + if (operation.getValue().length > maxLength) { + throw new IOException("Value in column " + + Bytes.toString(operation.getColumn()) + " is too long. " + + operation.getValue().length + " instead of " + maxLength); + } } + } } }