Program: 116589
Project: 116589
Buggy source:
public static void handleClusterCreated(Registrant registrant,boolean isLb){
  Topology topology=TopologyManager.getTopology();
  Service service;
  try {
    TopologyManager.acquireWriteLock();
    String cartridgeType=registrant.getCartridgeType();
    service=topology.getService(cartridgeType);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + service + "String_Node_Str");
    }
    Properties props=CloudControllerUtil.toJavaUtilProperties(registrant.getProperties());
    Cluster cluster;
    String clusterId=registrant.getClusterId();
    if (service.clusterExists(clusterId)) {
      cluster=service.getCluster(clusterId);
      cluster.addHostName(registrant.getHostName());
      if (service.getServiceType() == ServiceType.MultiTenant) {
        cluster.setTenantRange(registrant.getTenantRange());
      }
      if (service.getProperties().getProperty(Constants.IS_PRIMARY) != null) {
        props.setProperty(Constants.IS_PRIMARY,service.getProperties().getProperty(Constants.IS_PRIMARY));
      }
      cluster.setProperties(props);
      cluster.setLbCluster(isLb);
      cluster.setKubernetesCluster(getKubernetesCluster(service));
    }
 else {
      cluster=new Cluster(cartridgeType,clusterId,registrant.getDeploymentPolicyName(),registrant.getAutoScalerPolicyName());
      cluster.addHostName(registrant.getHostName());
      if (service.getServiceType() == ServiceType.MultiTenant) {
        cluster.setTenantRange(registrant.getTenantRange());
      }
      if (service.getProperties().getProperty(Constants.IS_PRIMARY) != null) {
        props.setProperty(Constants.IS_PRIMARY,service.getProperties().getProperty(Constants.IS_PRIMARY));
      }
      cluster.setProperties(props);
      cluster.setLbCluster(isLb);
      cluster.setKubernetesCluster(getKubernetesCluster(service));
      cluster.setStatus(ClusterStatus.Created);
      service.addCluster(cluster);
    }
    TopologyManager.updateTopology(topology);
    TopologyEventPublisher.sendClusterCreatedEvent(cartridgeType,clusterId,cluster);
  }
  finally {
    TopologyManager.releaseWriteLock();
  }
}

Fixed version (ground truth):
public static void handleClusterCreated(Registrant registrant,boolean isLb){
  Topology topology=TopologyManager.getTopology();
  Service service;
  try {
    TopologyManager.acquireWriteLock();
    String cartridgeType=registrant.getCartridgeType();
    service=topology.getService(cartridgeType);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + service + "String_Node_Str");
    }
    Properties props=CloudControllerUtil.toJavaUtilProperties(registrant.getProperties());
    Cluster cluster;
    String clusterId=registrant.getClusterId();
    if (service.clusterExists(clusterId)) {
      cluster=service.getCluster(clusterId);
      cluster.addHostName(registrant.getHostName());
      if (service.getServiceType() == ServiceType.MultiTenant) {
        cluster.setTenantRange(registrant.getTenantRange());
      }
      if (service.getProperties().getProperty(Constants.IS_PRIMARY) != null) {
        props.setProperty(Constants.IS_PRIMARY,service.getProperties().getProperty(Constants.IS_PRIMARY));
      }
      cluster.setProperties(props);
      cluster.setLbCluster(isLb);
      setKubernetesCluster(cluster);
    }
 else {
      cluster=new Cluster(cartridgeType,clusterId,registrant.getDeploymentPolicyName(),registrant.getAutoScalerPolicyName());
      cluster.addHostName(registrant.getHostName());
      if (service.getServiceType() == ServiceType.MultiTenant) {
        cluster.setTenantRange(registrant.getTenantRange());
      }
      if (service.getProperties().getProperty(Constants.IS_PRIMARY) != null) {
        props.setProperty(Constants.IS_PRIMARY,service.getProperties().getProperty(Constants.IS_PRIMARY));
      }
      cluster.setProperties(props);
      cluster.setLbCluster(isLb);
      setKubernetesCluster(cluster);
      cluster.setStatus(ClusterStatus.Created);
      service.addCluster(cluster);
    }
    TopologyManager.updateTopology(topology);
    TopologyEventPublisher.sendClusterCreatedEvent(cartridgeType,clusterId,cluster);
  }
  finally {
    TopologyManager.releaseWriteLock();
  }
}