hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chia7...@apache.org
Subject hbase git commit: HBASE-18365 Eliminate the findbugs warnings for hbase-common
Date Thu, 13 Jul 2017 11:37:48 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.2 2857b75c2 -> 4bd5f03d2


HBASE-18365 Eliminate the findbugs warnings for hbase-common


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

Branch: refs/heads/branch-1.2
Commit: 4bd5f03d22be5f8ce09c1c67cfe5d1dcc603446a
Parents: 2857b75
Author: Chia-Ping Tsai <chia7712@gmail.com>
Authored: Thu Jul 13 19:37:15 2017 +0800
Committer: Chia-Ping Tsai <chia7712@gmail.com>
Committed: Thu Jul 13 19:37:15 2017 +0800

----------------------------------------------------------------------
 .../hadoop/hbase/util/DynamicClassLoader.java   | 29 +++++++++++---------
 .../apache/hadoop/hbase/util/OrderedBytes.java  |  2 +-
 2 files changed, 17 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/4bd5f03d/hbase-common/src/main/java/org/apache/hadoop/hbase/util/DynamicClassLoader.java
----------------------------------------------------------------------
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 bc86358..115945b 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,19 +179,22 @@ public class DynamicClassLoader extends ClassLoaderBase {
 
   private synchronized void loadNewJars() {
     // Refresh local jar file lists
-    for (File file: localDir.listFiles()) {
-      String fileName = file.getName();
-      if (jarModifiedTime.containsKey(fileName)) {
-        continue;
-      }
-      if (file.isFile() && fileName.endsWith(".jar")) {
-        jarModifiedTime.put(fileName, Long.valueOf(file.lastModified()));
-        try {
-          URL url = file.toURI().toURL();
-          addURL(url);
-        } catch (MalformedURLException mue) {
-          // This should not happen, just log it
-          LOG.warn("Failed to load new jar " + fileName, mue);
+    File[] files = localDir == null ? null : localDir.listFiles();
+    if (files != null) {
+      for (File file: files) {
+        String fileName = file.getName();
+        if (jarModifiedTime.containsKey(fileName)) {
+          continue;
+        }
+        if (file.isFile() && fileName.endsWith(".jar")) {
+          jarModifiedTime.put(fileName, Long.valueOf(file.lastModified()));
+          try {
+            URL url = file.toURI().toURL();
+            addURL(url);
+          } catch (MalformedURLException mue) {
+            // This should not happen, just log it
+            LOG.warn("Failed to load new jar " + fileName, mue);
+          }
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/4bd5f03d/hbase-common/src/main/java/org/apache/hadoop/hbase/util/OrderedBytes.java
----------------------------------------------------------------------
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 a0c7390..9a40aee 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
@@ -463,7 +463,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;


Mime
View raw message