You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2015/12/28 08:10:01 UTC

groovy git commit: GROOVY-7626: Allow security managers to prevent system property access for Indy (closes #119)

Repository: groovy
Updated Branches:
  refs/heads/master 65f2bc133 -> 9514ecda5


GROOVY-7626: Allow security managers to prevent system property access for Indy (closes #119)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/9514ecda
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/9514ecda
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/9514ecda

Branch: refs/heads/master
Commit: 9514ecda5cc2bd2a362e1848c96f41806d5c86df
Parents: 65f2bc1
Author: Chris Earle <ch...@elasticsearch.com>
Authored: Thu Sep 17 16:00:26 2015 -0400
Committer: pascalschumacher <pa...@gmx.net>
Committed: Mon Dec 28 08:09:37 2015 +0100

----------------------------------------------------------------------
 .../codehaus/groovy/vmplugin/v7/IndyInterface.java | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/9514ecda/src/main/org/codehaus/groovy/vmplugin/v7/IndyInterface.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/vmplugin/v7/IndyInterface.java b/src/main/org/codehaus/groovy/vmplugin/v7/IndyInterface.java
index f456470..e7a04de 100644
--- a/src/main/org/codehaus/groovy/vmplugin/v7/IndyInterface.java
+++ b/src/main/org/codehaus/groovy/vmplugin/v7/IndyInterface.java
@@ -72,13 +72,20 @@ public class IndyInterface {
         /** boolean to indicate if logging for indy is enabled */
         protected static final boolean LOG_ENABLED;
         static {
+            boolean enableLogger = false;
+
             LOG = Logger.getLogger(IndyInterface.class.getName());
-            if (System.getProperty("groovy.indy.logging")!=null) {
-                LOG.setLevel(Level.ALL);
-                LOG_ENABLED = true;
-            } else {
-                LOG_ENABLED = false;
+
+            try {
+                if (System.getProperty("groovy.indy.logging")!=null) {
+                    LOG.setLevel(Level.ALL);
+                    enableLogger = true;
+                }
+            } catch (SecurityException e) {
+                // Allow security managers to prevent system property access
             }
+
+            LOG_ENABLED = enableLogger;
         }
         /** LOOKUP constant used for for example unreflect calls */
         public static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup();