hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bus...@apache.org
Subject [2/2] hbase git commit: HBASE-13900 Use ProtobufMagic methods in ProtobufUtil
Date Tue, 23 Jun 2015 05:37:20 GMT
HBASE-13900 Use ProtobufMagic methods in ProtobufUtil

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


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

Branch: refs/heads/master
Commit: 6a537eb8545c7dd6c01c0d911ad12e789eeab3ae
Parents: abc2e61
Author: Gábor Lipták <gliptak@gmail.com>
Authored: Tue Jun 16 21:13:58 2015 -0400
Committer: Sean Busbey <busbey@apache.org>
Committed: Tue Jun 23 00:32:23 2015 -0500

----------------------------------------------------------------------
 .../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/6a537eb8/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/6a537eb8/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 {
 


Mime
View raw message