hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecl...@apache.org
Subject hbase git commit: HBASE-14658 Addendum; Allow loading a MonkeyFactory by class name
Date Thu, 22 Oct 2015 19:10:36 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 619a240eb -> 35660b4f5


HBASE-14658 Addendum; Allow loading a MonkeyFactory by class name


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

Branch: refs/heads/master
Commit: 35660b4f5c4081996f18943ad5359be1454630b4
Parents: 619a240
Author: Elliott Clark <eclark@apache.org>
Authored: Thu Oct 22 11:22:53 2015 -0700
Committer: Elliott Clark <eclark@apache.org>
Committed: Thu Oct 22 12:09:58 2015 -0700

----------------------------------------------------------------------
 .../apache/hadoop/hbase/chaos/factories/MonkeyFactory.java  | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/35660b4f/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/factories/MonkeyFactory.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/factories/MonkeyFactory.java
b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/factories/MonkeyFactory.java
index e479975..2a69c8c 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/factories/MonkeyFactory.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/factories/MonkeyFactory.java
@@ -93,13 +93,16 @@ public abstract class MonkeyFactory {
 
   public static MonkeyFactory getFactory(String factoryName) {
     MonkeyFactory fact = FACTORIES.get(factoryName);
-    if (fact == null) {
+    if (fact == null && factoryName != null && !factoryName.isEmpty()) {
       Class klass = null;
       try {
         klass = Class.forName(factoryName);
-        fact = (MonkeyFactory) ReflectionUtils.newInstance(klass);
-      } catch (ClassNotFoundException e) {
+        if (klass != null) {
+          fact = (MonkeyFactory) ReflectionUtils.newInstance(klass);
+        }
+      } catch (Exception e) {
         LOG.error("Error trying to create " + factoryName + " could not load it by class
name");
+        return null;
       }
     }
     return fact;


Mime
View raw message