/** * Get an environmental property, doing a faster permission check that skips having to execute a privileged action frame. * * @param name the property name * @param def the default value if the property is not found * @return the property value, or the default value */ public static String getEnvPropertyPrivileged(String name, String def) { final SecurityManager sm = getSecurityManager(); if (sm == null) { return getenv(name); } if (sm instanceof WildFlySecurityManager) { final Context ctx = CTX.get(); if (! ctx.checking) { return def(getenv(name), def); } ctx.checking = false; try { checkEnvPropertyReadPermission(getCallerClass(2), name); return def(getenv(name), def); } finally { ctx.checking = true; } } else { checkEnvPropertyReadPermission(getCallerClass(2), name); return doPrivileged(new ReadEnvironmentPropertyAction(name, def)); } }
/** * Get an environmental property, doing a faster permission check that skips having to execute a privileged action frame. * * @param name the property name * @param def the default value if the property is not found * @return the property value, or the default value */ public static String getEnvPropertyPrivileged(String name, String def) { final SecurityManager sm = getSecurityManager(); if (sm == null) { return getenv(name); } if (sm instanceof WildFlySecurityManager) { final Context ctx = CTX.get(); if (! ctx.checking) { return def(getenv(name), def); } ctx.checking = false; try { checkEnvPropertyReadPermission(getCallerClass(2), name); return def(getenv(name), def); } finally { ctx.checking = true; } } else { checkEnvPropertyReadPermission(getCallerClass(2), name); return doPrivileged(new ReadEnvironmentPropertyAction(name, def)); } }
/** * Get an environmental property, doing a faster permission check that skips having to execute a privileged action frame. * * @param name the property name * @param def the default value if the property is not found * @return the property value, or the default value */ public static String getEnvPropertyPrivileged(String name, String def) { final SecurityManager sm = getSecurityManager(); if (sm == null) { return getenv(name); } if (sm instanceof WildFlySecurityManager) { final Context ctx = CTX.get(); if (! ctx.checking) { return def(getenv(name), def); } ctx.checking = false; try { checkEnvPropertyReadPermission(getCallerClass(2), name); return def(getenv(name), def); } finally { ctx.checking = true; } } else { checkEnvPropertyReadPermission(getCallerClass(2), name); return doPrivileged(new ReadEnvironmentPropertyAction(name, def)); } }
/** * Get an environmental property, doing a faster permission check that skips having to execute a privileged action frame. * * @param name the property name * @param def the default value if the property is not found * @return the property value, or the default value */ public static String getEnvPropertyPrivileged(String name, String def) { final SecurityManager sm = getSecurityManager(); if (sm == null) { return getenv(name); } if (sm instanceof WildFlySecurityManager) { final Context ctx = CTX.get(); if (! ctx.checking) { return def(getenv(name), def); } ctx.checking = false; try { checkEnvPropertyReadPermission(getCallerClass(2), name); return def(getenv(name), def); } finally { ctx.checking = true; } } else { checkEnvPropertyReadPermission(getCallerClass(2), name); return doPrivileged(new ReadEnvironmentPropertyAction(name, def)); } }
/** * Get an environmental property, doing a faster permission check that skips having to execute a privileged action frame. * * @param name the property name * @param def the default value if the property is not found * @return the property value, or the default value */ public static String getEnvPropertyPrivileged(String name, String def) { final SecurityManager sm = getSecurityManager(); if (sm == null) { return getenv(name); } if (sm instanceof WildFlySecurityManager) { final Context ctx = CTX.get(); if (! ctx.checking) { return def(getenv(name), def); } ctx.checking = false; try { checkEnvPropertyReadPermission(getCallerClass(2), name); return def(getenv(name), def); } finally { ctx.checking = true; } } else { checkEnvPropertyReadPermission(getCallerClass(2), name); return doPrivileged(new ReadEnvironmentPropertyAction(name, def)); } }