Updated Branches: refs/heads/master 1a6102be1 -> 66e14e262
Applied patch https://reviews.apache.org/r/5522/diff/ Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/66e14e26 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/66e14e26 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/66e14e26 Branch: refs/heads/master Commit: 66e14e2627007da95deff396fc358018d9952276 Parents: 1a6102b Author: Alena Prokharchyk <[email protected]> Authored: Mon Jun 25 21:14:57 2012 -0700 Committer: Alena Prokharchyk <[email protected]> Committed: Mon Jun 25 21:19:48 2012 -0700 ---------------------------------------------------------------------- server/src/com/cloud/user/DomainManagerImpl.java | 21 ++++++++++------ 1 files changed, 13 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/66e14e26/server/src/com/cloud/user/DomainManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/user/DomainManagerImpl.java b/server/src/com/cloud/user/DomainManagerImpl.java index 3223d8c..b0398bd 100644 --- a/server/src/com/cloud/user/DomainManagerImpl.java +++ b/server/src/com/cloud/user/DomainManagerImpl.java @@ -228,22 +228,24 @@ public class DomainManagerImpl implements DomainManager, DomainService, Manager long ownerId = domain.getAccountId(); if ((cleanup != null) && cleanup.booleanValue()) { if (!cleanupDomain(domain.getId(), ownerId)) { - s_logger.error("Failed to clean up domain resources and sub domains, delete failed on domain " + domain.getName() + " (id: " + domain.getId() + ")."); - return false; + CloudRuntimeException e = new CloudRuntimeException("Failed to clean up domain resources and sub domains, delete failed on domain " + domain.getName() + " (id: " + domain.getId() + ")."); + e.addProxyObject(domain, domain.getId(), "domainId"); + throw e; } } else { List<AccountVO> accountsForCleanup = _accountDao.findCleanupsForRemovedAccounts(domain.getId()); if (accountsForCleanup.isEmpty()) { if (!_domainDao.remove(domain.getId())) { - s_logger.error("Delete failed on domain " + domain.getName() + " (id: " + domain.getId() - + "); please make sure all users and sub domains have been removed from the domain before deleting"); rollBackState = true; - return false; + CloudRuntimeException e = new CloudRuntimeException("Delete failed on domain " + domain.getName() + " (id: " + domain.getId() + "); Please make sure all users and sub domains have been removed from the domain before deleting"); + e.addProxyObject(domain, domain.getId(), "domainId"); + throw e; } } else { - s_logger.warn("Can't delete the domain yet because it has " + accountsForCleanup.size() + "accounts that need a cleanup"); rollBackState = true; - return false; + CloudRuntimeException e = new CloudRuntimeException("Can't delete the domain yet because it has " + accountsForCleanup.size() + "accounts that need a cleanup"); + e.addProxyObject(domain, domain.getId(), "domainId"); + throw e; } } @@ -251,7 +253,10 @@ public class DomainManagerImpl implements DomainManager, DomainService, Manager return true; } catch (Exception ex) { s_logger.error("Exception deleting domain with id " + domain.getId(), ex); - return false; + if (ex instanceof CloudRuntimeException) + throw (CloudRuntimeException)ex; + else + return false; } finally { //when success is false if (rollBackState) {
