Updated Branches: refs/heads/master d39a06c0e -> ca8ac08cf
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/ca8ac08c Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ca8ac08c Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ca8ac08c Branch: refs/heads/master Commit: ca8ac08cf37cd9ea8a50d323ac596da16319e7ab Parents: d39a06c Author: Marcus Sorensen <[email protected]> Authored: Thu Apr 11 09:50:48 2013 -0600 Committer: Marcus Sorensen <[email protected]> Committed: Thu Apr 11 09:50:48 2013 -0600 ---------------------------------------------------------------------- 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/ca8ac08c/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;
