Better to print an error message than to die with a npe.

This commit is contained in:
Hugo Trippaers 2012-10-02 07:35:10 -07:00
parent 9ebe83286e
commit 3343362328

View File

@ -52,7 +52,12 @@ public class CloudStackConfigurationDaoImpl extends GenericDaoBase<CloudStackCon
txn.start();
SearchCriteria<CloudStackConfigurationVO> sc = NameSearch.create();
sc.setParameters("name", name);
return findOneBy(sc).getValue();
CloudStackConfigurationVO configItem = findOneBy(sc);
if (configItem == null) {
s_logger.warn("No configuration item found with name " + name);
return null;
}
return configItem.getValue();
}finally {
}