CLOUDSTACK-2003: When accounts and domains are deleted, cleanup can fail,

leaving instances in eternal expunged state. This happens when a domain is
deleted while a deleted account is cleaning up. The cleanup looks for the domain
of the account and we hit a null pointer. Adding null pointer check.

Signed-off-by: Marcus Sorensen <marcus@betterservers.com> 1365695448 -0600
This commit is contained in:
Marcus Sorensen 2013-04-11 09:50:48 -06:00
parent d39a06c0e9
commit ca8ac08cf3
1 changed files with 7 additions and 4 deletions

View File

@ -262,11 +262,14 @@ public class DomainDaoImpl extends GenericDaoBase<DomainVO, Long> implements Dom
public Set<Long> getDomainParentIds(long domainId) {
Set<Long> parentDomains = new HashSet<Long>();
Domain domain = findById(domainId);
parentDomains.add(domain.getId());
while (domain.getParent() != null) {
domain = findById(domain.getParent());
if (domain != null) {
parentDomains.add(domain.getId());
while (domain.getParent() != null) {
domain = findById(domain.getParent());
parentDomains.add(domain.getId());
}
}
return parentDomains;