You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2021/06/04 17:18:31 UTC
[cxf] 02/05: Use ReflectionUtil to grab a field to make sure
security manager is used
This is an automated email from the ASF dual-hosted git repository.
dkulp pushed a commit to branch 3.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit bd859e38476c492ecd2419407e22b4674ddc3b29
Author: Daniel Kulp <dk...@apache.org>
AuthorDate: Wed May 5 09:25:24 2021 -0400
Use ReflectionUtil to grab a field to make sure security manager is used
(cherry picked from commit 011debd91b16215245e039309e620699042a9f4b)
---
.../java/org/apache/cxf/workqueue/AutomaticWorkQueueImpl.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/core/src/main/java/org/apache/cxf/workqueue/AutomaticWorkQueueImpl.java b/core/src/main/java/org/apache/cxf/workqueue/AutomaticWorkQueueImpl.java
index 5f8a0ce..a23dabe 100644
--- a/core/src/main/java/org/apache/cxf/workqueue/AutomaticWorkQueueImpl.java
+++ b/core/src/main/java/org/apache/cxf/workqueue/AutomaticWorkQueueImpl.java
@@ -21,7 +21,6 @@ package org.apache.cxf.workqueue;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -202,9 +201,11 @@ public class AutomaticWorkQueueImpl implements AutomaticWorkQueue {
ReentrantLock l = null;
try {
- Field f = ThreadPoolExecutor.class.getDeclaredField("mainLock");
- ReflectionUtil.setAccessible(f);
- l = (ReentrantLock)f.get(executor);
+ l = ReflectionUtil.accessDeclaredField("mainLock", ThreadPoolExecutor.class,
+ executor, ReentrantLock.class);
+ if (l == null) {
+ l = new ReentrantLock();
+ }
} catch (Throwable t) {
l = new ReentrantLock();
}