diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/src/org/aspectj/runtime/internal/CFlowCounter.java | 12 | ||||
-rw-r--r-- | runtime/src/org/aspectj/runtime/internal/CFlowStack.java | 12 |
2 files changed, 22 insertions, 2 deletions
diff --git a/runtime/src/org/aspectj/runtime/internal/CFlowCounter.java b/runtime/src/org/aspectj/runtime/internal/CFlowCounter.java index e48f67864..3e20cae28 100644 --- a/runtime/src/org/aspectj/runtime/internal/CFlowCounter.java +++ b/runtime/src/org/aspectj/runtime/internal/CFlowCounter.java @@ -50,7 +50,7 @@ public class CFlowCounter { private static ThreadStackFactory getThreadLocalStackFactoryFor11() { return new ThreadStackFactoryImpl11(); } private static void selectFactoryForVMVersion() { - String override = System.getProperty("aspectj.runtime.cflowstack.usethreadlocal","unspecified"); + String override = getSystemPropertyWithoutSecurityException("aspectj.runtime.cflowstack.usethreadlocal","unspecified"); boolean useThreadLocalImplementation = false; if (override.equals("unspecified")) { String v = System.getProperty("java.class.version","0.0"); @@ -67,6 +67,16 @@ public class CFlowCounter { } } + + private static String getSystemPropertyWithoutSecurityException (String aPropertyName, String aDefaultValue) { + try { + return System.getProperty(aPropertyName, aDefaultValue); + } + catch (SecurityException ex) { + return aDefaultValue; + } + } + // For debug ... public static String getThreadStackFactoryClassName() { return tsFactory.getClass().getName(); diff --git a/runtime/src/org/aspectj/runtime/internal/CFlowStack.java b/runtime/src/org/aspectj/runtime/internal/CFlowStack.java index 5e6eff590..e9d811124 100644 --- a/runtime/src/org/aspectj/runtime/internal/CFlowStack.java +++ b/runtime/src/org/aspectj/runtime/internal/CFlowStack.java @@ -121,7 +121,7 @@ public class CFlowStack { private static ThreadStackFactory getThreadLocalStackFactoryFor11() { return new ThreadStackFactoryImpl11(); } private static void selectFactoryForVMVersion() { - String override = System.getProperty("aspectj.runtime.cflowstack.usethreadlocal","unspecified"); + String override = getSystemPropertyWithoutSecurityException("aspectj.runtime.cflowstack.usethreadlocal","unspecified"); boolean useThreadLocalImplementation = false; if (override.equals("unspecified")) { String v = System.getProperty("java.class.version","0.0"); @@ -138,6 +138,16 @@ public class CFlowStack { } } + private static String getSystemPropertyWithoutSecurityException (String aPropertyName, String aDefaultValue) { + try { + return System.getProperty(aPropertyName, aDefaultValue); + } + catch (SecurityException ex) { + return aDefaultValue; + } + } + + // For debug ... public static String getThreadStackFactoryClassName() { return tsFactory.getClass().getName(); |