Fix NPE when component can't be found

Change-Id: I803240cde2d2b2c5efeee03617d0e3a275a2f570
This commit is contained in:
Ray Milkey 2018-08-16 14:55:46 -07:00
parent a8f4840e86
commit 7981a32f37

View File

@ -379,6 +379,11 @@ public class ComponentConfigManager implements ComponentConfigService {
try {
Configuration cfg = cfgAdmin.getConfiguration(componentName, null);
Map<String, ConfigProperty> map = properties.get(componentName);
if (map == null) {
// Prevent NPE if the component isn't there
log.warn("Component not found for " + componentName);
return;
}
Dictionary<String, Object> props = new Hashtable<>();
map.values().stream().filter(p -> p.value() != null)
.forEach(p -> props.put(p.name(), p.value()));