You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by la...@apache.org on 2015/05/13 17:16:00 UTC
[08/10] stratos git commit: Resolving the wrong response message
while activating a non-existing tenant
Resolving the wrong response message while activating a non-existing tenant
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/22a1e87f
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/22a1e87f
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/22a1e87f
Branch: refs/heads/master
Commit: 22a1e87f1f1473ac78a3ee76bdf3ea1ccde85105
Parents: 82c2715
Author: Dinithi <di...@wso2.com>
Authored: Wed May 13 18:25:39 2015 +0530
Committer: Dinithi <di...@wso2.com>
Committed: Wed May 13 18:25:39 2015 +0530
----------------------------------------------------------------------
.../rest/endpoint/api/StratosApiV41Utils.java | 39 +++++++++++---------
1 file changed, 21 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/22a1e87f/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
index ff2c08c..c139815 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
@@ -3065,30 +3065,33 @@ public class StratosApiV41Utils {
int tenantId;
try {
tenantId = tenantManager.getTenantId(tenantDomain);
+ if(tenantId != -1) {
+ try {
+ TenantMgtUtil.activateTenant(tenantDomain, tenantManager, tenantId);
+ } catch (Exception e) {
+ String msg = "Error in activating Tenant :" + tenantDomain;
+ log.error(msg, e);
+ throw new RestAPIException(msg, e);
+ }
+
+ //Notify tenant activation all listeners
+ try {
+ TenantMgtUtil.triggerTenantActivation(tenantId);
+ } catch (StratosException e) {
+ String msg = "Error in notifying tenant activate.";
+ log.error(msg, e);
+ throw new RestAPIException(msg, e);
+ }
+ } else {
+ String msg = "The tenant with domain name: " + tenantDomain + " does not exist.";
+ throw new RestAPIException(msg);
+ }
} catch (UserStoreException e) {
String msg = "Error in retrieving the tenant id for the tenant domain: " + tenantDomain + ".";
log.error(msg, e);
throw new RestAPIException(msg, e);
}
-
- try {
- TenantMgtUtil.activateTenant(tenantDomain, tenantManager, tenantId);
-
- } catch (Exception e) {
- String msg="Error in activating Tenant :"+tenantDomain;
- log.error(msg,e);
- throw new RestAPIException(msg,e);
- }
-
- //Notify tenant activation all listeners
- try {
- TenantMgtUtil.triggerTenantActivation(tenantId);
- } catch (StratosException e) {
- String msg = "Error in notifying tenant activate.";
- log.error(msg, e);
- throw new RestAPIException(msg, e);
- }
}
/**