Repository: stratos
Updated Branches:
  refs/heads/master 75124bbdb -> c6eafd261


Fixing Sonar issues.


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

Branch: refs/heads/master
Commit: c6eafd2610006efd28bc163698e826a86446ca31
Parents: 75124bb
Author: Nirmal Fernando <[email protected]>
Authored: Fri Oct 24 20:30:21 2014 +0200
Committer: Nirmal Fernando <[email protected]>
Committed: Fri Oct 24 20:30:21 2014 +0200

----------------------------------------------------------------------
 .../cloud/controller/impl/CloudControllerServiceImpl.java    | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/c6eafd26/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
 
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
index 7345a52..426679d 100644
--- 
a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
+++ 
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
@@ -709,6 +709,12 @@ public class CloudControllerServiceImpl implements 
CloudControllerService {
                                                }
                         }       
                        
+                       if (ip == null) {
+                           String msg = "No IP address found. IP allocation 
failed for "+memberContext;
+                           LOG.error(msg);
+                            throw new CloudControllerException(msg);
+                       }
+                       
                        // build the node with the new ip
                        node = NodeMetadataBuilder.fromNodeMetadata(node)
                                                
.publicAddresses(ImmutableSet.of(ip)).build();
@@ -1041,6 +1047,7 @@ public class CloudControllerServiceImpl implements 
CloudControllerService {
                         if(ctxt == null) {
                             String msg = "Service unregistration failed. 
Cluster not found: " + clusterId_;
                             LOG.error(msg);
+                            return;
                         }
                         Collection<Member> members = 
TopologyManager.getTopology().
                                 
getService(ctxt.getCartridgeType()).getCluster(clusterId_).getMembers();
@@ -1079,6 +1086,7 @@ public class CloudControllerServiceImpl implements 
CloudControllerService {
                         if(ctxt == null) {
                             String msg = "Service unregistration failed. 
Cluster not found: " + clusterId_;
                             LOG.error(msg);
+                            return;
                         }
                         Collection<Member> members = 
TopologyManager.getTopology().
                                 
getService(ctxt.getCartridgeType()).getCluster(clusterId_).getMembers();

Reply via email to