Fixes #2069 to catch env var security exception
This commit is contained in:
parent
babf0bfa16
commit
aaa4250328
|
@ -270,7 +270,7 @@ public class ParserATNSimulator extends ATNSimulator {
|
|||
public static final boolean retry_debug = false;
|
||||
|
||||
/** Just in case this optimization is bad, add an ENV variable to turn it off */
|
||||
public static final boolean TURN_OFF_LR_LOOP_ENTRY_BRANCH_OPT = Boolean.parseBoolean(System.getenv("TURN_OFF_LR_LOOP_ENTRY_BRANCH_OPT"));
|
||||
public static final boolean TURN_OFF_LR_LOOP_ENTRY_BRANCH_OPT = Boolean.parseBoolean(getSafeEnv("TURN_OFF_LR_LOOP_ENTRY_BRANCH_OPT"));
|
||||
|
||||
protected final Parser parser;
|
||||
|
||||
|
@ -2181,4 +2181,14 @@ public class ParserATNSimulator extends ATNSimulator {
|
|||
public Parser getParser() {
|
||||
return parser;
|
||||
}
|
||||
|
||||
public static String getSafeEnv(String envName) {
|
||||
try {
|
||||
return System.getenv(envName);
|
||||
}
|
||||
catch(SecurityException e) {
|
||||
// use the default value
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue