fixed NPE

This commit is contained in:
anthony 2011-04-13 16:02:11 -07:00
parent 98be7ea0f7
commit 8d36af0033
1 changed files with 11 additions and 11 deletions

View File

@ -1298,22 +1298,22 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
}
@DB
private boolean deletePoolStats(Long poolId) {
CapacityVO capacity1 = _capacityDao.findByHostIdType(poolId, CapacityVO.CAPACITY_TYPE_STORAGE);
CapacityVO capacity2 = _capacityDao.findByHostIdType(poolId, CapacityVO.CAPACITY_TYPE_STORAGE_ALLOCATED);
CapacityVO capacity1 = _capacityDao.findByHostIdType(poolId, CapacityVO.CAPACITY_TYPE_STORAGE);
CapacityVO capacity2 = _capacityDao.findByHostIdType(poolId, CapacityVO.CAPACITY_TYPE_STORAGE_ALLOCATED);
Transaction txn = Transaction.currentTxn();
txn.start();
if ( capacity1 != null ) {
_capacityDao.remove(capacity1.getId());
try {
if ( capacity1 != null ) {
_capacityDao.remove(capacity1.getId());
}
if ( capacity2 != null ) {
_capacityDao.remove(capacity2.getId());
}
} finally {
txn.commit();
}
if ( capacity2 != null ) {
_capacityDao.remove(capacity2.getId());
}
txn.commit();
return true;
}
@Override