firemail
标题:
java常见错误问题
[打印本页]
作者:
java
时间:
2017-11-17 09:31
标题:
java常见错误问题
1.对于获取对象后,要先进行判空操作,再进行对其内部的引用操作,防止出现异常
AdBudget orgAdBudget = adBudgetDao.getById(adModel.getAdBudget().getId());
if (orgAdBudget == null){
logger.error("getAd AdBudgetId: {} Business logic error, AdBudgetId shouldn't be empty!", adModel.getAdBudget().getId());
return null;
}
if (orgAdBudget.getBudget() != adModel.getAdBudget().getBudget())
............
欢迎光临 firemail (http://firemail.wang:8088/)
Powered by Discuz! X3