This is an automated email from the ASF dual-hosted git repository.
robbie pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/main by this push:
new 950040b62b ARTEMIS-4322 BundleFactory should use PrivilegedAction
950040b62b is described below
commit 950040b62bd4a0093c3500fa76cdf957c537139e
Author: Justin Bertram <[email protected]>
AuthorDate: Wed Jun 21 10:36:14 2023 -0500
ARTEMIS-4322 BundleFactory should use PrivilegedAction
---
.../java/org/apache/activemq/artemis/logs/BundleFactory.java | 10 ++++++++++
1 file changed, 10 insertions(+)
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> T newBundle(final Class<T> type, String category) {
+ if (System.getSecurityManager() == null) {
+ return doNewBundle(type, category);
+ } else {
+ return AccessController.doPrivileged((PrivilegedAction<T>) () ->
doNewBundle(type, category));
+ }
+ }
+
+ private static <T> T doNewBundle(final Class<T> type, String category) {
final String implClassName = type.getName() + "_impl";
final Class<? extends T> implClass;