HBASE-9649 HFilePrettyPrinter should not throw a NPE if FirstKey or LastKey is null (Jean-Marc Spaggiari)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1526113 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
91508fd564
commit
f6d44db9c6
|
@ -1130,9 +1130,12 @@ public class KeyValue implements Cell, HeapSize, Cloneable {
|
|||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue