bug 6782: incremental checkin for deleting an account. Since there was a change to findById to not find removed objects, these NPEs pop up from time to time where we expected to find the object previously and now it's not found. Since the account is getting deleted, do a findByIdIncludingRemoved to make sure the actual account object is retrieved.

This commit is contained in:
Kris McQueen 2010-10-27 17:16:28 -07:00
parent f26f40c049
commit 901f52eb99
2 changed files with 2 additions and 2 deletions

View File

@ -821,7 +821,7 @@ public class ManagementServerImpl implements ManagementServer {
s_logger.debug("Remove account " + accountId);
}
AccountVO account = _accountDao.findById(accountId);
AccountVO account = _accountDao.findByIdIncludingRemoved(accountId);
deleteAccount(account);
EventUtils.saveEvent(Long.valueOf(1), Long.valueOf(1), EventVO.LEVEL_INFO, EventTypes.EVENT_USER_DELETE, "User " + username + " (id: " + userId
+ ") for accountId = " + accountId + " and domainId = " + userAccount.getDomainId() + " was deleted.");

View File

@ -125,7 +125,7 @@ public class AccountManagerImpl implements AccountManager {
// on a per-domain basis, decrement the count
// FIXME: can this decrement be done on the database side in a custom update statement?
Account account = _accountDao.findById(accountId);
Account account = _accountDao.findByIdIncludingRemoved(accountId); // find all accounts, even removed accounts if this happens to be for an account that's being deleted
Long domainId = account.getDomainId();
while (domainId != null) {
_resourceCountDao.updateDomainCount(domainId, type, false, numToDecrement);