This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch 3.3.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 2a9379a737768c43db299bf1daf97a9c35360771
Author: Andy McCright <[email protected]>
AuthorDate: Mon Dec 16 10:40:38 2019 -0600

    Handle Java 2 security issue in ForkJoinPool
    
    Signed-off-by: Andy McCright <[email protected]>
    (cherry picked from commit 471bc4144f8e86a09daf80c7657d4a37ebef2b15)
---
 .../org/apache/cxf/microprofile/client/MPRestClientCallback.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git 
a/rt/rs/microprofile-client/src/main/java/org/apache/cxf/microprofile/client/MPRestClientCallback.java
 
b/rt/rs/microprofile-client/src/main/java/org/apache/cxf/microprofile/client/MPRestClientCallback.java
index af61061..a99365f 100644
--- 
a/rt/rs/microprofile-client/src/main/java/org/apache/cxf/microprofile/client/MPRestClientCallback.java
+++ 
b/rt/rs/microprofile-client/src/main/java/org/apache/cxf/microprofile/client/MPRestClientCallback.java
@@ -20,6 +20,8 @@
 package org.apache.cxf.microprofile.client;
 
 import java.lang.reflect.Type;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.concurrent.CancellationException;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.CompletionException;
@@ -42,7 +44,12 @@ public class MPRestClientCallback<T> extends 
JaxrsClientCallback<T> {
                                 Type outGenericType) {
         super(handler, responseClass, outGenericType);
         ExecutorService es = outMessage.get(ExecutorService.class);
-        executor = es != null ? es : ForkJoinPool.commonPool();
+        if (es == null) {
+            es = 
AccessController.doPrivileged((PrivilegedAction<ExecutorService>)() -> {
+                return ForkJoinPool.commonPool();
+            });
+        }
+        executor = es;
     }
 
     @SuppressWarnings("unchecked")

Reply via email to