commit | 7981a32f37d64225a5b641725ba172cdc32e2f0d | [log] [tgz] |
---|---|---|
author | Ray Milkey <ray@opennetworking.org> | Thu Aug 16 14:55:46 2018 -0700 |
committer | Ray Milkey <ray@opennetworking.org> | Thu Aug 16 23:52:44 2018 +0000 |
tree | 26e0f2c798e26e6cce69e995f943f665acc9b68f | |
parent | a8f4840e86b5ba5bb1e83ca1d2db0b293c067e84 [diff] |
Fix NPE when component can't be found Change-Id: I803240cde2d2b2c5efeee03617d0e3a275a2f570
diff --git a/core/net/src/main/java/org/onosproject/cfg/impl/ComponentConfigManager.java b/core/net/src/main/java/org/onosproject/cfg/impl/ComponentConfigManager.java index 011733c..21a54b3 100644 --- a/core/net/src/main/java/org/onosproject/cfg/impl/ComponentConfigManager.java +++ b/core/net/src/main/java/org/onosproject/cfg/impl/ComponentConfigManager.java
@@ -379,6 +379,11 @@ 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()));