From b50cc053670a3f053f1c82c1c4ac23de81bedec6 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Mon, 27 Jan 2014 16:26:41 +0000 Subject: [PATCH] HBASE-10422 ZeroCopyLiteralByteString.zeroCopyGetBytes has an unusable prototype and conflicts with AsyncHBase git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1561725 13f79535-47bb-0310-9956-ffa450edef68 --- .../com/google/protobuf/ZeroCopyLiteralByteString.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hbase-protocol/src/main/java/com/google/protobuf/ZeroCopyLiteralByteString.java b/hbase-protocol/src/main/java/com/google/protobuf/ZeroCopyLiteralByteString.java index c57f1a7b007..8a70c9c0c65 100644 --- a/hbase-protocol/src/main/java/com/google/protobuf/ZeroCopyLiteralByteString.java +++ b/hbase-protocol/src/main/java/com/google/protobuf/ZeroCopyLiteralByteString.java @@ -57,7 +57,12 @@ public final class ZeroCopyLiteralByteString extends LiteralByteString { * @param buf A buffer from which to extract the array. This buffer must be * actually an instance of a {@code LiteralByteString}. */ - public static byte[] zeroCopyGetBytes(final LiteralByteString buf) { - return buf.bytes; + public static byte[] zeroCopyGetBytes(final ByteString buf) { + if (buf instanceof LiteralByteString) { + return ((LiteralByteString) buf).bytes; + } + throw new UnsupportedOperationException("Need a LiteralByteString, got a " + + buf.getClass().getName()); } + }