You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2019/02/08 18:05:11 UTC

[commons-pool] branch master updated: [POOL-352] CallStackUtils mishandles security manager check (partial fix.)

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

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-pool.git


The following commit(s) were added to refs/heads/master by this push:
     new a3f8c61  [POOL-352] CallStackUtils mishandles security manager check (partial fix.)
a3f8c61 is described below

commit a3f8c61d2d5b21631eb242ee5525ff42dac75c79
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Feb 8 13:05:08 2019 -0500

    [POOL-352] CallStackUtils mishandles security manager check (partial
    fix.)
---
 src/changes/changes.xml                                         | 3 +++
 src/main/java/org/apache/commons/pool2/impl/CallStackUtils.java | 8 +-------
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 7026378..afa3e4b 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -71,6 +71,9 @@ The <action> type attribute can be add,update,fix,remove.
     <action dev="ggregory" issue="POOL-326" type="fix" due-to="Chris Allison, Phil Steitz">
       Threading issue, NullPointerException and IllegalStateException in GenericKeyedObjectPool.
     </action>
+    <action dev="ggregory" issue="POOL-352" type="fix" due-to="Volker Kleinschmidt, Gary Gregory">
+      CallStackUtils mishandles security manager check (partial fix.)
+    </action>
   </release>  
   <release version="2.6.0" date="2018-07-06" description="This is a maintenance release.">
     <action dev="ggregory" issue="POOL-336" type="update" due-to="Wolfgang Glas">
diff --git a/src/main/java/org/apache/commons/pool2/impl/CallStackUtils.java b/src/main/java/org/apache/commons/pool2/impl/CallStackUtils.java
index 0e79d55..42916ac 100644
--- a/src/main/java/org/apache/commons/pool2/impl/CallStackUtils.java
+++ b/src/main/java/org/apache/commons/pool2/impl/CallStackUtils.java
@@ -25,12 +25,6 @@ import java.security.AccessControlException;
  */
 public final class CallStackUtils {
 
-    private static final boolean CAN_CREATE_SECURITY_MANAGER;
-
-    static {
-        CAN_CREATE_SECURITY_MANAGER = canCreateSecurityManager();
-    }
-
     /**
      * @return {@code true} if it is able to create a security manager in the current environment, {@code false}
      *         otherwise.
@@ -76,7 +70,7 @@ public final class CallStackUtils {
     public static CallStack newCallStack(final String messageFormat,
                                          final boolean useTimestamp,
                                          final boolean requireFullStackTrace) {
-        return CAN_CREATE_SECURITY_MANAGER && !requireFullStackTrace
+        return canCreateSecurityManager() && !requireFullStackTrace
             ? new SecurityManagerCallStack(messageFormat, useTimestamp)
             : new ThrowableCallStack(messageFormat, useTimestamp);
     }