Skip to content

Commit

Permalink
GROOVY-7626: Allow security managers to prevent system property acces…
Browse files Browse the repository at this point in the history
…s for Indy (closes #119)
  • Loading branch information
pickypg authored and PascalSchumacher committed Dec 28, 2015
1 parent 65f2bc1 commit 9514ecd
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/main/org/codehaus/groovy/vmplugin/v7/IndyInterface.java
Expand Up @@ -72,13 +72,20 @@ private CALL_TYPES(String callSiteName) {
/** 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();
Expand Down

0 comments on commit 9514ecd

Please sign in to comment.