Use LoaderUtil.loadClass instead of Class.forName

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/f735cf92
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/f735cf92
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/f735cf92

Branch: refs/heads/master
Commit: f735cf929aa692eb04da610d3e2fd8bfd1341486
Parents: 3e037e2
Author: Matt Sicker <[email protected]>
Authored: Tue Feb 23 23:50:55 2016 -0600
Committer: Matt Sicker <[email protected]>
Committed: Tue Feb 23 23:50:55 2016 -0600

----------------------------------------------------------------------
 .../java/org/apache/logging/log4j/core/async/DisruptorUtil.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f735cf92/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DisruptorUtil.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DisruptorUtil.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DisruptorUtil.java
index 00311a0..8d368fe 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DisruptorUtil.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DisruptorUtil.java
@@ -27,6 +27,7 @@ import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.util.Constants;
 import org.apache.logging.log4j.core.util.Integers;
 import org.apache.logging.log4j.status.StatusLogger;
+import org.apache.logging.log4j.util.LoaderUtil;
 import org.apache.logging.log4j.util.PropertiesUtil;
 
 /**
@@ -95,8 +96,8 @@ final class DisruptorUtil {
         }
         try {
             @SuppressWarnings("unchecked")
-            final Class<? extends ExceptionHandler<T>> klass = (Class<? 
extends ExceptionHandler<T>>) Class
-                    .forName(cls);
+            final Class<? extends ExceptionHandler<T>> klass =
+                (Class<? extends ExceptionHandler<T>>) 
LoaderUtil.loadClass(cls);
             return klass.newInstance();
         } catch (final Exception ignored) {
             LOGGER.debug("Invalid {} value: error creating {}: ", 
propertyName, cls, ignored);

Reply via email to