From 9daac09f6e606f7a26f68189bf90c47f28578a0e Mon Sep 17 00:00:00 2001 From: Chia-Ping Tsai Date: Thu, 13 Jul 2017 19:33:06 +0800 Subject: [PATCH] HBASE-18365 Eliminate the findbugs warnings for hbase-common --- .../org/apache/hadoop/hbase/util/DynamicClassLoader.java | 5 +++-- .../main/java/org/apache/hadoop/hbase/util/OrderedBytes.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/DynamicClassLoader.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/DynamicClassLoader.java index 1a730696c45..a805fbfad2e 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/DynamicClassLoader.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/DynamicClassLoader.java @@ -179,8 +179,9 @@ public class DynamicClassLoader extends ClassLoaderBase { private synchronized void loadNewJars() { // Refresh local jar file lists - if (localDir != null) { - for (File file : localDir.listFiles()) { + File[] files = localDir == null ? null : localDir.listFiles(); + if (files != null) { + for (File file : files) { String fileName = file.getName(); if (jarModifiedTime.containsKey(fileName)) { continue; diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/OrderedBytes.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/OrderedBytes.java index 3e4bc6ca589..7ba17f99e89 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/OrderedBytes.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/OrderedBytes.java @@ -461,7 +461,7 @@ public class OrderedBytes { static int lengthVaruint64(PositionedByteRange src, boolean comp) { int a0 = (comp ? DESCENDING : ASCENDING).apply(src.peek()) & 0xff; if (a0 <= 240) return 1; - if (a0 >= 241 && a0 <= 248) return 2; + if (a0 <= 248) return 2; if (a0 == 249) return 3; if (a0 == 250) return 4; if (a0 == 251) return 5;