hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [1/2] hbase git commit: HBASE-14658 Addendum; Allow loading a MonkeyFactory by class name
Date Fri, 23 Oct 2015 19:25:53 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 ba02635a4 -> 5950b81fb


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/5950b81f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/5950b81f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/5950b81f

Branch: refs/heads/0.98
Commit: 5950b81fb9a39556ddbdfb9d607e498fd2f7321d
Parents: b5a5548
Author: Elliott Clark <eclark@apache.org>
Authored: Thu Oct 22 11:22:53 2015 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Fri Oct 23 12:23:45 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/5950b81f/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 9ea34fd..bf00eab 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
@@ -88,13 +88,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