You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2012/12/19 02:44:46 UTC

[5/5] git commit: api: Fix NullPointerException in ApiResponseHelper for DomainResponse

api: Fix NullPointerException in ApiResponseHelper for DomainResponse

Signed-off-by: Rohit Yadav <bh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/43425808
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/43425808
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/43425808

Branch: refs/heads/api_refactoring
Commit: 434258080f2dad95bbdbdd67f9517af2eac1cf85
Parents: 22ee420
Author: Rohit Yadav <bh...@apache.org>
Authored: Tue Dec 18 17:15:00 2012 -0800
Committer: Rohit Yadav <bh...@apache.org>
Committed: Tue Dec 18 17:44:17 2012 -0800

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiResponseHelper.java |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/43425808/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index 27fb647..8fa8bad 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -440,7 +440,10 @@ public class ApiResponseHelper implements ResponseGenerator {
         domainResponse.setId(domain.getUuid());
         domainResponse.setLevel(domain.getLevel());
         domainResponse.setNetworkDomain(domain.getNetworkDomain());
-        domainResponse.setParentDomainId(ApiDBUtils.findDomainById(domain.getParent()).getUuid());
+        Domain parentDomain = ApiDBUtils.findDomainById(domain.getParent());
+        if (parentDomain != null) {
+            domainResponse.setParentDomainId(parentDomain.getUuid());
+        }
         StringBuilder domainPath = new StringBuilder("ROOT");
         (domainPath.append(domain.getPath())).deleteCharAt(domainPath.length() - 1);
         domainResponse.setPath(domainPath.toString());