Updated Branches:
  refs/heads/master 365cac294 -> 0e111bbf5

fixing STRATOS-374


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

Branch: refs/heads/master
Commit: 0e111bbf55bb6630e70d209be71138fad831b59b
Parents: 365cac2
Author: rekathiru <[email protected]>
Authored: Fri Jan 24 11:17:32 2014 +0530
Committer: rekathiru <[email protected]>
Committed: Fri Jan 24 11:17:32 2014 +0530

----------------------------------------------------------------------
 .../rest/endpoint/services/ServiceUtils.java    | 27 +++++++++++++++-----
 1 file changed, 21 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/0e111bbf/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
 
b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
index 1c9add9..e4a8d3c 100644
--- 
a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
+++ 
b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
@@ -664,7 +664,7 @@ public class ServiceUtils {
             }
         } else {
 
-            CartridgeInfo lbCartridgeInfo;
+            CartridgeInfo lbCartridgeInfo = null;
             String lbCartridgeType = lbConfig.getType();
             try {
                 // retrieve lb Cartridge info
@@ -744,13 +744,21 @@ public class ServiceUtils {
 
                                             // if lb cluster doesn't exist
                                             String lbAlias = "lb" + new 
Random().nextInt();
-                                            
lbCartridgeInfo.addProperties(property);
+                                            if(lbCartridgeInfo != null) {
+                                               
lbCartridgeInfo.addProperties(property);
                                             subscribeToLb(lbCartridgeType, 
cartridgeType,
                                                           lbAlias,
                                                           
lbCartridgeInfo.getDefaultAutoscalingPolicy(),
                                                           deploymentPolicy, 
configurationContext,
                                                           userName, 
tenantDomain,
                                                           
lbCartridgeInfo.getProperties());
+                                            } else {
+                                                String msg = "Please specify a 
LB cartridge type for the cartridge: "
+                                                                + 
cartridgeType + " as category: " +
+                                                                
Constants.DEFAULT_LOAD_BALANCER;
+                                                log.error(msg);
+                                                throw new ADCException(msg);
+                                            }
                                         }
                                     }
                                 }
@@ -798,17 +806,24 @@ public class ServiceUtils {
                                                     "lb" + cartridgeType +
                                                             new 
Random().nextInt();
 
+                                            if(lbCartridgeInfo != null) {
+                                                
lbCartridgeInfo.addProperties(property);
+                                                
lbCartridgeInfo.addProperties(loadBalancedServiceTypeProperty);
 
-                                            
lbCartridgeInfo.addProperties(property);
-                                            
lbCartridgeInfo.addProperties(loadBalancedServiceTypeProperty);
-
-                                            subscribeToLb(lbCartridgeType, 
cartridgeType,
+                                                subscribeToLb(lbCartridgeType, 
cartridgeType,
                                                     lbAlias,
                                                     
lbCartridgeInfo.getDefaultAutoscalingPolicy(),
                                                     deploymentPolicy,
                                                     configurationContext, 
userName,
                                                     tenantDomain,
                                                     
lbCartridgeInfo.getProperties());
+                                            } else {
+                                                String msg = "Please specify a 
LB cartridge type for the cartridge: "
+                                                                + 
cartridgeType + " as category: " +
+                                                                
Constants.SERVICE_AWARE_LOAD_BALANCER;
+                                                log.error(msg);
+                                                throw new ADCException(msg);
+                                            }
                                         }
                                     }
                                 }

Reply via email to