stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject stratos git commit: Fixing null pointer exception in rest api, cartridge deployment method
Date Thu, 11 Dec 2014 06:16:22 GMT
Repository: stratos
Updated Branches:
  refs/heads/4.1.0-test d67695e2a -> eb8224c46


Fixing null pointer exception in rest api, cartridge deployment method


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

Branch: refs/heads/4.1.0-test
Commit: eb8224c465306cd2ce997deb8ee6cf2e970f555d
Parents: d67695e
Author: Imesh Gunaratne <imesh@apache.org>
Authored: Thu Dec 11 11:46:12 2014 +0530
Committer: Imesh Gunaratne <imesh@apache.org>
Committed: Thu Dec 11 11:46:12 2014 +0530

----------------------------------------------------------------------
 .../stratos/rest/endpoint/api/StratosApiV41Utils.java    | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/eb8224c4/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 c9b95e7..52a69eb 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
@@ -85,25 +85,24 @@ public class StratosApiV41Utils {
     private static ServiceDeploymentManager serviceDeploymentManager = new ServiceDeploymentManager();
 
     // Util methods for cartridges
-    
     public static void createCartridgeDefinition(CartridgeDefinitionBean cartridgeDefinitionBean,
ConfigurationContext ctxt,
                                        String userName, String tenantDomain) throws RestAPIException
{
 
-        log.info("Starting to deploy a Cartridge [type] " + cartridgeDefinitionBean.type);
+        log.info("Starting to deploy a cartridge [type] " + cartridgeDefinitionBean.type);
 
         CartridgeConfig cartridgeConfig = PojoConverter.populateCartridgeConfigPojo(cartridgeDefinitionBean);
         if (cartridgeConfig == null) {
-            throw new RestAPIException("Populated CartridgeConfig instance is null, cartridge
deployment aborted");
+            throw new RestAPIException("Could not read cartridge definition, cartridge deployment
failed");
         }
-	    if (cartridgeConfig.getCategory().equals("")|| cartridgeConfig.getCategory().isEmpty())
{
-		    throw new RestAPIException("Category is not specified, cartridge deployment aborted");
+	    if (StringUtils.isEmpty(cartridgeConfig.getCategory())) {
+		    throw new RestAPIException("Category is not specified, cartridge deployment failed");
 	    }
         try {
             CartridgeDeploymentManager.getDeploymentManager(cartridgeDefinitionBean.deployerType).deploy(cartridgeConfig);
         } catch (ADCException e) {
             throw new RestAPIException(e);
         }
-        log.info("Successfully deployed Cartridge [type] " + cartridgeDefinitionBean.type);
+        log.info("Successfully deployed cartridge [type] " + cartridgeDefinitionBean.type);
     }
     
     public static void deleteCartridgeDefinition(String cartridgeType) throws RestAPIException
{


Mime
View raw message