diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/BundleFactory.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/BundleFactory.java index 85b1436930..0690a74497 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/BundleFactory.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/BundleFactory.java @@ -17,6 +17,8 @@ package org.apache.activemq.artemis.logs; import java.lang.reflect.Constructor; +import java.security.AccessController; +import java.security.PrivilegedAction; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -29,6 +31,14 @@ public class BundleFactory { } public static T newBundle(final Class type, String category) { + if (System.getSecurityManager() == null) { + return doNewBundle(type, category); + } else { + return AccessController.doPrivileged((PrivilegedAction) () -> doNewBundle(type, category)); + } + } + + private static T doNewBundle(final Class type, String category) { final String implClassName = type.getName() + "_impl"; final Class implClass;