Fixed NPE in listNetworks (handle the case when Zone service provider is NULL)

This commit is contained in:
alena 2010-12-30 14:25:40 -08:00
parent 4208d6ccd1
commit 6576dd1273
1 changed files with 13 additions and 10 deletions

View File

@ -1852,19 +1852,22 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
Iterator<Service> it = providers.keySet().iterator();
while (it.hasNext()) {
Service service = it.next();
if (providers.get(service).equalsIgnoreCase(element.getProvider().getName())) {
if (elementCapabilities.containsKey(service)) {
Map<Capability, String> capabilities = elementCapabilities.get(service);
//Verify if Service support capability
if (capabilities != null) {
for (Capability capability : capabilities.keySet()) {
assert(service.containsCapability(capability)) : "Capability " + capability.getName() + " is not supported by the service " + service.getName();
String zoneProvider = providers.get(service);
if (zoneProvider != null) {
if (zoneProvider.equalsIgnoreCase(element.getProvider().getName())) {
if (elementCapabilities.containsKey(service)) {
Map<Capability, String> capabilities = elementCapabilities.get(service);
//Verify if Service support capability
if (capabilities != null) {
for (Capability capability : capabilities.keySet()) {
assert(service.containsCapability(capability)) : "Capability " + capability.getName() + " is not supported by the service " + service.getName();
}
}
networkCapabilities.put(service, capabilities);
it.remove();
}
networkCapabilities.put(service, capabilities);
it.remove();
}
}
}
}
}
}