Apache9 commented on code in PR #4647:
URL: https://github.com/apache/hbase/pull/4647#discussion_r930533780


##########
hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java:
##########
@@ -495,6 +494,21 @@ public static String toString(final byte[] b) {
     return toString(b, 0, b.length);
   }
 
+  /**
+   * Returns String made from <code>b</code>
+   */
+  public static String toString(ByteBuffer buf) {
+    if (buf == null) {
+      return null;
+    }
+    if (!buf.hasArray()) {
+      buf = ByteBuffer.wrap(buf.array(), buf.arrayOffset(), buf.remaining());

Review Comment:
   This is the code in hbase-common. I mean here we should copy the content out 
to a byte array and then call the toString method which accepts byte array.
   
   If `buf.hasArray()` returns false, then how could we call `buf.array()` to 
get its non-existent backing array?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to