Repository: stratos
Updated Branches:
  refs/heads/master 8062428e2 -> 85520ef30


REST API response messages minor improvements


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/85520ef3
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/85520ef3
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/85520ef3

Branch: refs/heads/master
Commit: 85520ef30b1b47865cf14b519961f32d4361a7f4
Parents: 8062428
Author: Chamila de Alwis <[email protected]>
Authored: Mon Mar 30 15:06:45 2015 +0530
Committer: Chamila de Alwis <[email protected]>
Committed: Mon Mar 30 18:54:08 2015 +0530

----------------------------------------------------------------------
 .../org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java | 2 +-
 .../autoscaler/services/impl/AutoscalerServiceImpl.java        | 2 +-
 .../controller/services/impl/CloudControllerServiceImpl.java   | 6 ++----
 .../apache/stratos/rest/endpoint/api/StratosApiV41Utils.java   | 6 +++---
 4 files changed, 7 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/85520ef3/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java
 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java
index c4d643b..304387f 100644
--- 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java
+++ 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java
@@ -145,7 +145,7 @@ public class RuleTasksDelegator {
             partitionAlgorithm = 
StratosConstants.PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID;
         }
         if (log.isDebugEnabled()) {
-            log.debug(String.format("Retrieving partition algorithm [Partition 
algorithm]: ", partitionAlgorithm));
+            log.debug(String.format("Retrieving partition algorithm [Partition 
algorithm]: %s", partitionAlgorithm));
         }
         if 
(StratosConstants.PARTITION_ROUND_ROBIN_ALGORITHM_ID.equals(partitionAlgorithm))
 {
             autoscaleAlgorithm = new RoundRobin();

http://git-wip-us.apache.org/repos/asf/stratos/blob/85520ef3/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
index 458cc10..780c835 100644
--- 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
+++ 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
@@ -87,7 +87,7 @@ public class AutoscalerServiceImpl implements 
AutoscalerService {
                        return 
PolicyManager.getInstance().removeAutoscalePolicy(autoscalePolicyId);
                }
                else{
-                       throw new InvalidPolicyException("This auto-scalar 
policy cannot remove, since it is used in applications.");
+                       throw new InvalidPolicyException("This autoscaler 
policy cannot be removed, since it is used in applications.");
                }
        }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/85520ef3/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
 
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
index f8fb88b..a6d7f1d 100644
--- 
a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
+++ 
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
@@ -1054,8 +1054,6 @@ public class CloudControllerServiceImpl implements 
CloudControllerService {
                 }
                 
CloudControllerContext.getInstance().addClusterContext(clusterContext);
 
-                   Cartridge cartridge = 
CloudControllerContext.getInstance().getCartridge(clusterContext.getCartridgeType());
-
                 // Create cluster object
                 Cluster cluster = new 
Cluster(appClusterCtxt.getCartridgeType(), appClusterCtxt.getClusterId(),
                         appClusterCtxt.getDeploymentPolicyName(), 
appClusterCtxt.getAutoscalePolicyName(), appId);
@@ -1367,12 +1365,12 @@ public class CloudControllerServiceImpl implements 
CloudControllerService {
                        log.info("Updating deployment policy: 
[deployment-policy-id] " + deploymentPolicy.getDeploymentPolicyID());
                }
                if (log.isDebugEnabled()) {
-                       log.debug("Updating Deployment policy definition: " + 
deploymentPolicy.toString());
+                       log.debug("Updating deployment policy definition: " + 
deploymentPolicy.toString());
                }
 
                String deploymentPolicyID = 
deploymentPolicy.getDeploymentPolicyID();
                if 
(cloudControllerContext.getDeploymentPolicy(deploymentPolicyID) == null) {
-                       String message = "Deployment policy not exists: 
[deployment-policy-id] " + deploymentPolicyID;
+                       String message = "Deployment policy does not exist: 
[deployment-policy-id] " + deploymentPolicyID;
                        log.error(message);
                        throw new DeploymentPolicyNotExistsException(message);
                }

http://git-wip-us.apache.org/repos/asf/stratos/blob/85520ef3/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 2f99f12..eea42d2 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
@@ -183,7 +183,7 @@ public class StratosApiV41Utils {
         } catch (Exception e) {
             String msg = "Could not remove cartridge";
             log.error(msg, e);
-            throw new RestAPIException(msg);
+            throw new RestAPIException(e.getMessage(), e);
         }
     }
 
@@ -1193,13 +1193,13 @@ public class StratosApiV41Utils {
                 log.error(message);
                 throw new RestAPIException(message);
             }
-            if ((application != null) && 
(application.getStatus().equals(APPLICATION_STATUS_DEPLOYED))) {
+            if (application.getStatus().equals(APPLICATION_STATUS_DEPLOYED)) {
                 String message = String.format("Application is already 
deployed: [application-id] %s", applicationId);
                 log.error(message);
                 throw new RestAPIException(message);
             }
             if(applicationPolicyId == null) {
-                String message = String.format("Application policy id is not 
found: [application-policy-id] %s", applicationPolicyId);
+                String message = "Application policy id is null: 
[application-policy-id]";
                 log.error(message);
                 throw new RestAPIException(message);
             }

Reply via email to