hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmhs...@apache.org
Subject svn commit: r1526113 - in /hbase/trunk: hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFilePrettyPrinter.java
Date Wed, 25 Sep 2013 05:45:16 GMT
Author: jmhsieh
Date: Wed Sep 25 05:45:15 2013
New Revision: 1526113

URL: http://svn.apache.org/r1526113
Log:
HBASE-9649 HFilePrettyPrinter should not throw a NPE if FirstKey or LastKey is null (Jean-Marc
Spaggiari)

Modified:
    hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFilePrettyPrinter.java

Modified: hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java?rev=1526113&r1=1526112&r2=1526113&view=diff
==============================================================================
--- hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java (original)
+++ hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java Wed Sep 25
05:45:15 2013
@@ -1130,9 +1130,12 @@ public class KeyValue implements Cell, H
 
   /**
    * @param k Key portion of a KeyValue.
-   * @return Key as a String.
+   * @return Key as a String, empty string if k is null. 
    */
   public static String keyToString(final byte [] k) {
+    if (k == null) { 
+      return "";
+    }
     return keyToString(k, 0, k.length);
   }
 

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFilePrettyPrinter.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFilePrettyPrinter.java?rev=1526113&r1=1526112&r2=1526113&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFilePrettyPrinter.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFilePrettyPrinter.java
Wed Sep 25 05:45:15 2013
@@ -350,7 +350,11 @@ public class HFilePrettyPrinter {
       }
     }
 
-    System.out.println("Mid-key: " + Bytes.toStringBinary(reader.midkey()));
+    try {
+      System.out.println("Mid-key: " + Bytes.toStringBinary(reader.midkey()));
+    } catch (Exception e) {
+      System.out.println ("Unable to retrieve the midkey");
+    }
 
     // Printing general bloom information
     DataInput bloomMeta = reader.getGeneralBloomFilterMetadata();



Mime
View raw message