/** * Get a global string property. This method will first try to get the value from an * environment variable and if that does not exist it will look up a system property. * @param key Name of the variable * @param defaultValue Returned if neither env var nor system property are defined * @return String the value of the Environment or System Property if defined, the given * default value otherwise */ public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of global property {} due to SecurityManager. Using default value.", key, e); return defaultValue; } }
/** * Get a global string property. This method will first try to get the value from an * environment variable and if that does not exist it will look up a system property. * @param key Name of the variable * @param defaultValue Returned if neither env var nor system property are defined * @return String the value of the Environment or System Property if defined, the given * default value otherwise */ public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of global property {} due to SecurityManager. Using default value.", key, e); return defaultValue; } }