merge upstream

This commit is contained in:
bjiang
2016-06-15 13:54:49 -04:00
73 changed files with 2070 additions and 836 deletions

View File

@@ -189,6 +189,10 @@ public final class Settings {
* The properties key for whether the Jar Analyzer is enabled.
*/
public static final String ANALYZER_JAR_ENABLED = "analyzer.jar.enabled";
/**
* The properties key for whether experimental analyzers are loaded.
*/
public static final String ANALYZER_EXPERIMENTAL_ENABLED = "analyzer.experimental.enabled";
/**
* The properties key for whether the Archive analyzer is enabled.
*/
@@ -317,7 +321,7 @@ public final class Settings {
/**
* Thread local settings.
*/
private static ThreadLocal<Settings> localSettings = new ThreadLocal<Settings>();
private static final ThreadLocal<Settings> LOCAL_SETTINGS = new ThreadLocal<Settings>();
/**
* The properties.
*/
@@ -354,7 +358,7 @@ public final class Settings {
* also call Settings.cleanup() to properly release resources.
*/
public static void initialize() {
localSettings.set(new Settings(PROPERTIES_FILE));
LOCAL_SETTINGS.set(new Settings(PROPERTIES_FILE));
}
/**
@@ -364,7 +368,7 @@ public final class Settings {
* @param propertiesFilePath the path to the base properties file to load
*/
public static void initialize(String propertiesFilePath) {
localSettings.set(new Settings(propertiesFilePath));
LOCAL_SETTINGS.set(new Settings(propertiesFilePath));
}
/**
@@ -393,7 +397,7 @@ public final class Settings {
}
}
try {
localSettings.remove();
LOCAL_SETTINGS.remove();
} catch (Throwable ex) {
LOGGER.debug("Error cleaning up Settings", ex);
}
@@ -405,7 +409,7 @@ public final class Settings {
* @return the Settings object
*/
public static Settings getInstance() {
return localSettings.get();
return LOCAL_SETTINGS.get();
}
/**
@@ -414,7 +418,7 @@ public final class Settings {
* @param instance the instance of the settings object to use in this thread
*/
public static void setInstance(Settings instance) {
localSettings.set(instance);
LOCAL_SETTINGS.set(instance);
}
/**
@@ -460,7 +464,7 @@ public final class Settings {
* @param value the value for the property
*/
public static void setString(String key, String value) {
localSettings.get().props.setProperty(key, value);
LOCAL_SETTINGS.get().props.setProperty(key, value);
LOGGER.debug("Setting: {}='{}'", key, value);
}
@@ -517,7 +521,7 @@ public final class Settings {
* @param value the value for the property
*/
public static void setInt(String key, int value) {
localSettings.get().props.setProperty(key, String.valueOf(value));
LOCAL_SETTINGS.get().props.setProperty(key, String.valueOf(value));
LOGGER.debug("Setting: {}='{}'", key, value);
}
@@ -592,8 +596,8 @@ public final class Settings {
* @throws IOException is thrown when there is an exception loading/merging the properties
*/
public static void mergeProperties(InputStream stream) throws IOException {
localSettings.get().props.load(stream);
logProperties("Properties updated via merge", localSettings.get().props);
LOCAL_SETTINGS.get().props.load(stream);
logProperties("Properties updated via merge", LOCAL_SETTINGS.get().props);
}
/**
@@ -673,7 +677,7 @@ public final class Settings {
* @return the property from the properties file
*/
public static String getString(String key, String defaultValue) {
final String str = System.getProperty(key, localSettings.get().props.getProperty(key, defaultValue));
final String str = System.getProperty(key, LOCAL_SETTINGS.get().props.getProperty(key, defaultValue));
return str;
}
@@ -707,7 +711,7 @@ public final class Settings {
* @return the property from the properties file
*/
public static String getString(String key) {
return System.getProperty(key, localSettings.get().props.getProperty(key));
return System.getProperty(key, LOCAL_SETTINGS.get().props.getProperty(key));
}
/**
@@ -716,7 +720,7 @@ public final class Settings {
* @param key the property key to remove
*/
public static void removeProperty(String key) {
localSettings.get().props.remove(key);
LOCAL_SETTINGS.get().props.remove(key);
}
/**