Repository: hbase Updated Branches: refs/heads/master b636c6b1c -> 6a537eb85
Revert "Use ProtobufMagic methods in ProtobufUtil" This reverts commit 6b37f26280ea7e2f475f9813301543411e71383b. Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/abc2e61e Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/abc2e61e Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/abc2e61e Branch: refs/heads/master Commit: abc2e61eb17f911f6beff2592b81b1165744e16f Parents: b636c6b Author: Sean Busbey <[email protected]> Authored: Tue Jun 23 00:30:25 2015 -0500 Committer: Sean Busbey <[email protected]> Committed: Tue Jun 23 00:30:25 2015 -0500 ---------------------------------------------------------------------- .../org/apache/hadoop/hbase/protobuf/ProtobufUtil.java | 11 +++++++---- .../org/apache/hadoop/hbase/protobuf/ProtobufMagic.java | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/abc2e61e/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java index b72f0bb..1bcf1e6 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java @@ -264,7 +264,8 @@ public final class ProtobufUtil { * @return True if passed <code>bytes</code> has {@link ProtobufMagic#PB_MAGIC} for a prefix. */ public static boolean isPBMagicPrefix(final byte [] bytes) { - return ProtobufMagic.isPBMagicPrefix(bytes); + if (bytes == null) return false; + return isPBMagicPrefix(bytes, 0, bytes.length); } /** @@ -274,7 +275,9 @@ public final class ProtobufUtil { * @return True if passed <code>bytes</code> has {@link ProtobufMagic#PB_MAGIC} for a prefix. */ public static boolean isPBMagicPrefix(final byte [] bytes, int offset, int len) { - return ProtobufMagic.isPBMagicPrefix(bytes, offset, len); + if (bytes == null || len < ProtobufMagic.PB_MAGIC.length) return false; + return Bytes.compareTo(ProtobufMagic.PB_MAGIC, 0, ProtobufMagic.PB_MAGIC.length, + bytes, offset, ProtobufMagic.PB_MAGIC.length) == 0; } /** @@ -289,10 +292,10 @@ public final class ProtobufUtil { } /** - * @return Length of {@link ProtobufMagic#lengthOfPBMagic()} + * @return Length of {@link ProtobufMagic#PB_MAGIC} */ public static int lengthOfPBMagic() { - return ProtobufMagic.lengthOfPBMagic(); + return ProtobufMagic.PB_MAGIC.length; } /** http://git-wip-us.apache.org/repos/asf/hbase/blob/abc2e61e/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufMagic.java ---------------------------------------------------------------------- diff --git a/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufMagic.java b/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufMagic.java index 7bd1bf9..bf94757 100644 --- a/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufMagic.java +++ b/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufMagic.java @@ -22,6 +22,8 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience; /** * Protobufs utility. */ [email protected](value="DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED", + justification="None. Address sometime.") @InterfaceAudience.Private public class ProtobufMagic {
