fix bug when parsing services in configs
@@ -4598,10 +4598,7 @@ public class CiscoControlPlaneExtractor extends CiscoParserBaseListener
SortedMap<String, Service> currentServices = _configuration.getCf().getServices();
while (i.hasNext()) {
String name = i.next();
- Service s = currentServices.get(name);
- if (s == null) {
- s = new Service();
- currentServices.put(name, s);
+ Service s = currentServices.computeIfAbsent(name, k -> new Service());
if (enabled) {
s.setEnabled(true);
} else if (!enabled && !i.hasNext()) {
@@ -4610,7 +4607,6 @@ public class CiscoControlPlaneExtractor extends CiscoParserBaseListener
currentServices = s.getSubservices();
}
}
- }
@Override
public void exitS_spanning_tree(S_spanning_treeContext ctx) {
