1
0
Prechádzať zdrojové kódy

HADOOP-2380 REST servlet throws NPE when any value node has an empty string

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@602267 13f79535-47bb-0310-9956-ffa450edef68
Michael Stack 17 rokov pred
rodič
commit
cffc480a6c

+ 3 - 1
src/contrib/hbase/CHANGES.txt

@@ -11,7 +11,7 @@ Trunk (unreleased changes)
     HADOOP-2084 Add a LocalHBaseCluster
     HADOOP-2068 RESTful interface (Bryan Duxbury via Stack)
     HADOOP-2316 Run REST servlet outside of master
-                (Bryan Duxbury via Stack)
+                (Bryan Duxbury & Stack)
 
   OPTIMIZATIONS
 
@@ -61,6 +61,8 @@ Trunk (unreleased changes)
    HADOOP-2365 Result of HashFunction.hash() contains all identical values
    HADOOP-2362 Leaking hdfs file handle on region split
    HADOOP-2338 Fix NullPointerException in master server.
+   HADOOP-2380 REST servlet throws NPE when any value node has an empty string
+               (Bryan Duxbury via Stack)
 
   IMPROVEMENTS
    HADOOP-2401 Add convenience put method that takes writable

+ 10 - 2
src/contrib/hbase/src/java/org/apache/hadoop/hbase/rest/TableHandler.java

@@ -308,8 +308,16 @@ public class TableHandler extends GenericHandler {
 
         Node value_node = column.getElementsByTagName("value").item(0);
 
-        // decode the base64'd value
-        byte[] value = org.apache.hadoop.hbase.util.Base64.decode(value_node.getFirstChild().getNodeValue());
+        byte[] value = new byte[0];
+        
+        // for some reason there's no value here. probably indicates that
+        // the consumer passed a null as the cell value.
+        if(value_node.getFirstChild() != null && 
+          value_node.getFirstChild().getNodeValue() != null){
+          // decode the base64'd value
+          value = org.apache.hadoop.hbase.util.Base64.decode(
+            value_node.getFirstChild().getNodeValue());
+        }
 
         // put the value
         table.put(lock_id, name, value);