Updated Branches: refs/heads/4.1 00d3bc59d -> 3bf8ca769
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 <[email protected]> 1365695448 -0600 Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3bf8ca76 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3bf8ca76 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3bf8ca76 Branch: refs/heads/4.1 Commit: 3bf8ca769740194dc054e8cb13f9ce4c9d8a6dcc Parents: 00d3bc5 Author: Marcus Sorensen <[email protected]> Authored: Thu Apr 11 09:50:48 2013 -0600 Committer: Chip Childers <[email protected]> Committed: Thu Apr 11 18:29:59 2013 +0100 ---------------------------------------------------------------------- server/src/com/cloud/domain/dao/DomainDaoImpl.java | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3bf8ca76/server/src/com/cloud/domain/dao/DomainDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/domain/dao/DomainDaoImpl.java b/server/src/com/cloud/domain/dao/DomainDaoImpl.java index 79ef17e..c30ca5e 100644 --- a/server/src/com/cloud/domain/dao/DomainDaoImpl.java +++ b/server/src/com/cloud/domain/dao/DomainDaoImpl.java @@ -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;
