potential NPE in ArthasBootstrap (#1991)

This commit is contained in:
XenoAmess 2021-12-03 11:48:49 +08:00 committed by GitHub
parent a8aab52c2c
commit e7c63d146c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -316,25 +316,25 @@ public class ArthasBootstrap {
if (!location.endsWith(".properties")) {
location = new File(location, configName + ".properties").getAbsolutePath();
}
}
if (new File(location).exists()) {
Properties properties = FileUtils.readProperties(location);
if (new File(location).exists()) {
Properties properties = FileUtils.readProperties(location);
boolean overrideAll = false;
if (arthasEnvironment.containsProperty(CONFIG_OVERRIDE_ALL)) {
overrideAll = arthasEnvironment.getRequiredProperty(CONFIG_OVERRIDE_ALL, boolean.class);
} else {
overrideAll = Boolean.parseBoolean(properties.getProperty(CONFIG_OVERRIDE_ALL, "false"));
}
boolean overrideAll = false;
if (arthasEnvironment.containsProperty(CONFIG_OVERRIDE_ALL)) {
overrideAll = arthasEnvironment.getRequiredProperty(CONFIG_OVERRIDE_ALL, boolean.class);
} else {
overrideAll = Boolean.parseBoolean(properties.getProperty(CONFIG_OVERRIDE_ALL, "false"));
}
PropertySource<?> propertySource = new PropertiesPropertySource(location, properties);
if (overrideAll) {
arthasEnvironment.addFirst(propertySource);
} else {
arthasEnvironment.addLast(propertySource);
PropertySource<?> propertySource = new PropertiesPropertySource(location, properties);
if (overrideAll) {
arthasEnvironment.addFirst(propertySource);
} else {
arthasEnvironment.addLast(propertySource);
}
}
}
}
/**