You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2015/06/19 23:24:57 UTC

hbase git commit: Use ProtobufMagic methods in ProtobufUtil

Repository: hbase
Updated Branches:
  refs/heads/master 8ae4b374e -> 6b37f2628


Use ProtobufMagic methods in ProtobufUtil

Signed-off-by: Andrew Purtell <ap...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/6b37f262
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/6b37f262
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/6b37f262

Branch: refs/heads/master
Commit: 6b37f26280ea7e2f475f9813301543411e71383b
Parents: 8ae4b37
Author: Gábor Lipták <gl...@gmail.com>
Authored: Tue Jun 16 21:13:58 2015 -0400
Committer: Andrew Purtell <ap...@apache.org>
Committed: Fri Jun 19 13:50:09 2015 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/protobuf/ProtobufUtil.java   | 11 ++++-------
 .../org/apache/hadoop/hbase/protobuf/ProtobufMagic.java  |  2 --
 2 files changed, 4 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/6b37f262/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 1bcf1e6..b72f0bb 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,8 +264,7 @@ 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) {
-    if (bytes == null) return false;
-    return isPBMagicPrefix(bytes, 0, bytes.length);
+    return ProtobufMagic.isPBMagicPrefix(bytes);
   }
 
   /**
@@ -275,9 +274,7 @@ 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) {
-    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;
+    return ProtobufMagic.isPBMagicPrefix(bytes, offset, len);
   }
 
   /**
@@ -292,10 +289,10 @@ public final class ProtobufUtil {
   }
 
   /**
-   * @return Length of {@link ProtobufMagic#PB_MAGIC}
+   * @return Length of {@link ProtobufMagic#lengthOfPBMagic()}
    */
   public static int lengthOfPBMagic() {
-    return ProtobufMagic.PB_MAGIC.length;
+    return ProtobufMagic.lengthOfPBMagic();
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/hbase/blob/6b37f262/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 bf94757..7bd1bf9 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,8 +22,6 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience;
 /**
  * Protobufs utility.
  */
-@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED",
-  justification="None. Address sometime.")
 @InterfaceAudience.Private
 public class ProtobufMagic {