/** * 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 a System property by its name. * * @param name the name of the wanted System property. * @return the System property value - null if it is not defined. */ private String getEnv(String name) { return System.getSecurityManager() == null ? System.getenv(name) : doPrivileged(new ReadEnvironmentPropertyAction(name)); } }
/** * Get a System property by its name. * * @param name the name of the wanted System property. * @return the System property value - null if it is not defined. */ private String getEnv(String name) { return System.getSecurityManager() == null ? System.getenv(name) : doPrivileged(new ReadEnvironmentPropertyAction(name)); } }
static String getEnv(final String key) { return getSecurityManager() == null ? getenv(key) : doPrivileged(new ReadEnvironmentPropertyAction(key)); }
static String getEnv(final String key) { return getSecurityManager() == null ? getenv(key) : doPrivileged(new ReadEnvironmentPropertyAction(key)); }
private File getJBossHome() { if (distribution != null) { return distribution; } String resolved = getSecurityManager() == null ? getenv(HOME) : doPrivileged(new ReadEnvironmentPropertyAction(HOME)); if (resolved == null) { resolved = getSecurityManager() == null ? getProperty(HOME_DIR) : doPrivileged(new ReadPropertyAction(HOME_DIR)); } if (resolved == null) { throw PatchLogger.ROOT_LOGGER.cliFailedToResolveDistribution(); } return new File(resolved); }
private File getJBossHome() { if (distribution != null) { return distribution; } String resolved = getSecurityManager() == null ? getenv(HOME) : doPrivileged(new ReadEnvironmentPropertyAction(HOME)); if (resolved == null) { resolved = getSecurityManager() == null ? getProperty(HOME_DIR) : doPrivileged(new ReadPropertyAction(HOME_DIR)); } if (resolved == null) { throw PatchLogger.ROOT_LOGGER.cliFailedToResolveDistribution(); } return new File(resolved); }
private String getJBossHome(final ParsedCommandLine args) { final String targetDistro = distribution.getValue(args); if(targetDistro != null) { return targetDistro; } String resolved = getSecurityManager() == null ? getenv(HOME) : doPrivileged(new ReadEnvironmentPropertyAction(HOME)); if (resolved == null) { resolved = getSecurityManager() == null ? getProperty(HOME_DIR) : doPrivileged(new ReadPropertyAction(HOME_DIR)); } if (resolved == null) { throw PatchLogger.ROOT_LOGGER.cliFailedToResolveDistribution(); } return resolved; }
private String getJBossHome(final ParsedCommandLine args) { final String targetDistro = distribution.getValue(args); if(targetDistro != null) { return targetDistro; } String resolved = getSecurityManager() == null ? getenv(HOME) : doPrivileged(new ReadEnvironmentPropertyAction(HOME)); if (resolved == null) { resolved = getSecurityManager() == null ? getProperty(HOME_DIR) : doPrivileged(new ReadPropertyAction(HOME_DIR)); } if (resolved == null) { throw PatchLogger.ROOT_LOGGER.cliFailedToResolveDistribution(); } return resolved; }
/** * 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)); } }