ConfigurationManagerImpl: Fix NPE when trying to access method on null object

Before checking obj.length, the fix is to check that the obj is not null

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2014-08-21 11:34:44 +02:00
parent 4a6560a9ee
commit e3b3a18aef

View File

@ -407,7 +407,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
String mgtCidr = _configDao.getValue(Config.ManagementNetwork.key());
if (mgtCidr == null || mgtCidr.trim().isEmpty()) {
String[] localCidrs = NetUtils.getLocalCidrs();
if (localCidrs.length > 0) {
if (localCidrs != null && (localCidrs.length > 0)) {
s_logger.warn("Management network CIDR is not configured originally. Set it default to " + localCidrs[0]);
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_MANAGMENT_NODE, 0, new Long(0), "Management network CIDR is not configured originally. Set it default to "