Updated Branches: refs/heads/4.0 1ff26dfa0 -> f12b328b3
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 <mar...@betterservers.com> 1365695448 -0600 Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f12b328b Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f12b328b Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f12b328b Branch: refs/heads/4.0 Commit: f12b328b337b4ad54fbe55ce029260002b0d7b49 Parents: 1ff26df Author: Marcus Sorensen <mar...@betterservers.com> Authored: Thu Apr 11 09:50:48 2013 -0600 Committer: Joe Brockmeier <j...@zonker.net> Committed: Thu Apr 11 11:09:27 2013 -0500 ---------------------------------------------------------------------- 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/f12b328b/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 442b5e5..eb6dbce 100644 --- a/server/src/com/cloud/domain/dao/DomainDaoImpl.java +++ b/server/src/com/cloud/domain/dao/DomainDaoImpl.java @@ -261,11 +261,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;