Fixed NPE in createVlanIpRange

This commit is contained in:
alena 2011-03-01 10:17:55 -08:00
parent c347827193
commit 0e032c5301
1 changed files with 7 additions and 5 deletions

View File

@ -1619,13 +1619,15 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
//if vlan is specified, throw an error if it's not equal to network's vlanId
URI uri = network.getBroadcastUri();
if (uri != null) {
String[] vlan = uri.toString().split("vlan:\\/\\/");
networkVlanId = vlan[1];
if (network != null) {
URI uri = network.getBroadcastUri();
if (uri != null) {
String[] vlan = uri.toString().split("vlan:\\/\\/");
networkVlanId = vlan[1];
}
}
if (vlanId != null && !networkVlanId.equalsIgnoreCase(vlanId)) {
if (vlanId != null && networkVlanId != null && !networkVlanId.equalsIgnoreCase(vlanId)) {
throw new InvalidParameterValueException("Vlan doesn't match vlan of the network");
}