Program: 115424
Project: 115424
Buggy source:
/** 
 * Starts a container via kubernetes for the given member context.
 * @param memberContext
 * @return
 * @throws CartridgeNotFoundException
 */
public MemberContext startContainer(MemberContext memberContext) throws CartridgeNotFoundException {
  Lock lock=null;
  try {
    lock=CloudControllerContext.getInstance().acquireMemberContextWriteLock();
    handleNullObject(memberContext,"String_Node_Str");
    log.info(String.format("String_Node_Str",memberContext.getApplicationId(),memberContext.getCartridgeType(),memberContext.getMemberId()));
    String clusterId=memberContext.getClusterId();
    String memberId=memberContext.getMemberId();
    handleNullObject(clusterId,"String_Node_Str");
    ClusterContext clusterContext=CloudControllerContext.getInstance().getClusterContext(clusterId);
    handleNullObject(clusterContext,String.format("String_Node_Str" + "String_Node_Str",memberContext.getApplicationId(),memberContext.getCartridgeType(),clusterId));
    Partition partition=memberContext.getPartition();
    handleNullObject(partition,String.format("String_Node_Str" + "String_Node_Str",memberContext.getApplicationId(),memberContext.getCartridgeType(),memberContext.getMemberId()));
    String cartridgeType=clusterContext.getCartridgeType();
    Cartridge cartridge=CloudControllerContext.getInstance().getCartridge(cartridgeType);
    if (cartridge == null) {
      String msg=String.format("String_Node_Str",memberContext.getApplicationId(),memberContext.getCartridgeType());
      log.error(msg);
      throw new CartridgeNotFoundException(msg);
    }
    String kubernetesClusterId=partition.getKubernetesClusterId();
    KubernetesCluster kubernetesCluster=CloudControllerContext.getInstance().getKubernetesCluster(kubernetesClusterId);
    handleNullObject(kubernetesCluster,"String_Node_Str" + "String_Node_Str" + kubernetesClusterId + "String_Node_Str"+ clusterId+ "String_Node_Str"+ memberId);
    String kubernetesMasterIp=kubernetesCluster.getKubernetesMaster().getPrivateIPAddress();
    PortRange kubernetesPortRange=kubernetesCluster.getPortRange();
    String kubernetesMasterPort=CloudControllerUtil.getProperty(kubernetesCluster.getKubernetesMaster().getProperties(),StratosConstants.KUBERNETES_MASTER_PORT,StratosConstants.KUBERNETES_MASTER_DEFAULT_PORT);
    if ((kubernetesCluster.getProperties() != null) && (kubernetesCluster.getProperties().getProperties() != null)) {
      for (      Property property : kubernetesCluster.getProperties().getProperties()) {
        if (property != null) {
          if (property.getName().startsWith(PAYLOAD_PARAMETER_PREFIX)) {
            String name=property.getName().replace(PAYLOAD_PARAMETER_PREFIX,"String_Node_Str");
            payload.add(new NameValuePair(name,property.getValue()));
          }
        }
      }
    }
    KubernetesClusterContext kubernetesClusterContext=getKubernetesClusterContext(kubernetesClusterId,kubernetesMasterIp,kubernetesMasterPort,kubernetesPortRange.getUpper(),kubernetesPortRange.getLower());
    generateKubernetesServicePorts(clusterContext.getApplicationId(),clusterContext.getClusterId(),kubernetesClusterContext,cartridge);
    KubernetesApiClient kubernetesApi=kubernetesClusterContext.getKubApi();
    createKubernetesServices(kubernetesApi,clusterContext,kubernetesCluster,kubernetesClusterContext,memberContext);
    createPod(clusterContext,memberContext,kubernetesApi,kubernetesClusterContext);
    Pod pod=waitForPodToBeActivated(memberContext,kubernetesApi);
    updateMemberContext(memberContext,pod,kubernetesCluster);
    log.info(String.format("String_Node_Str" + "String_Node_Str",memberContext.getApplicationId(),memberContext.getCartridgeType(),memberContext.getMemberId(),memberContext.getKubernetesPodId(),memberContext.getInstanceMetadata().getCpu(),memberContext.getInstanceMetadata().getRam()));
    return memberContext;
  }
 catch (  Exception e) {
    String msg=String.format("String_Node_Str",memberContext.getApplicationId(),memberContext.getCartridgeType(),memberContext.getMemberId());
    log.error(msg,e);
    throw new RuntimeException(msg,e);
  }
 finally {
    if (lock != null) {
      CloudControllerContext.getInstance().releaseWriteLock(lock);
    }
  }
}

Fixed version (ground truth):
/** 
 * Starts a container via kubernetes for the given member context.
 * @param memberContext
 * @return
 * @throws CartridgeNotFoundException
 */
public MemberContext startContainer(MemberContext memberContext) throws CartridgeNotFoundException {
  Lock lock=null;
  try {
    lock=CloudControllerContext.getInstance().acquireMemberContextWriteLock();
    handleNullObject(memberContext,"String_Node_Str");
    log.info(String.format("String_Node_Str",memberContext.getApplicationId(),memberContext.getCartridgeType(),memberContext.getMemberId()));
    String clusterId=memberContext.getClusterId();
    String memberId=memberContext.getMemberId();
    handleNullObject(clusterId,"String_Node_Str");
    ClusterContext clusterContext=CloudControllerContext.getInstance().getClusterContext(clusterId);
    handleNullObject(clusterContext,String.format("String_Node_Str" + "String_Node_Str",memberContext.getApplicationId(),memberContext.getCartridgeType(),clusterId));
    Partition partition=memberContext.getPartition();
    handleNullObject(partition,String.format("String_Node_Str" + "String_Node_Str",memberContext.getApplicationId(),memberContext.getCartridgeType(),memberContext.getMemberId()));
    String cartridgeType=clusterContext.getCartridgeType();
    Cartridge cartridge=CloudControllerContext.getInstance().getCartridge(cartridgeType);
    if (cartridge == null) {
      String msg=String.format("String_Node_Str",memberContext.getApplicationId(),memberContext.getCartridgeType());
      log.error(msg);
      throw new CartridgeNotFoundException(msg);
    }
    String kubernetesClusterId=partition.getKubernetesClusterId();
    KubernetesCluster kubernetesCluster=CloudControllerContext.getInstance().getKubernetesCluster(kubernetesClusterId);
    handleNullObject(kubernetesCluster,"String_Node_Str" + "String_Node_Str" + kubernetesClusterId + "String_Node_Str"+ clusterId+ "String_Node_Str"+ memberId);
    String kubernetesMasterIp=kubernetesCluster.getKubernetesMaster().getPrivateIPAddress();
    PortRange kubernetesPortRange=kubernetesCluster.getPortRange();
    String kubernetesMasterPort=CloudControllerUtil.getProperty(kubernetesCluster.getKubernetesMaster().getProperties(),StratosConstants.KUBERNETES_MASTER_PORT);
    if ((kubernetesCluster.getProperties() != null) && (kubernetesCluster.getProperties().getProperties() != null)) {
      for (      Property property : kubernetesCluster.getProperties().getProperties()) {
        if (property != null) {
          if (property.getName().startsWith(PAYLOAD_PARAMETER_PREFIX)) {
            String name=property.getName().replace(PAYLOAD_PARAMETER_PREFIX,"String_Node_Str");
            payload.add(new NameValuePair(name,property.getValue()));
          }
        }
      }
    }
    KubernetesClusterContext kubernetesClusterContext=getKubernetesClusterContext(kubernetesClusterId,kubernetesMasterIp,kubernetesMasterPort,kubernetesPortRange.getUpper(),kubernetesPortRange.getLower());
    generateKubernetesServicePorts(clusterContext.getApplicationId(),clusterContext.getClusterId(),kubernetesClusterContext,cartridge);
    KubernetesApiClient kubernetesApi=kubernetesClusterContext.getKubApi();
    createKubernetesServices(kubernetesApi,clusterContext,kubernetesCluster,kubernetesClusterContext,memberContext);
    createPod(clusterContext,memberContext,kubernetesApi,kubernetesClusterContext);
    Pod pod=waitForPodToBeActivated(memberContext,kubernetesApi);
    updateMemberContext(memberContext,pod,kubernetesCluster);
    log.info(String.format("String_Node_Str" + "String_Node_Str",memberContext.getApplicationId(),memberContext.getCartridgeType(),memberContext.getMemberId(),memberContext.getKubernetesPodId(),memberContext.getInstanceMetadata().getCpu(),memberContext.getInstanceMetadata().getRam()));
    return memberContext;
  }
 catch (  Exception e) {
    String msg=String.format("String_Node_Str",memberContext.getApplicationId(),memberContext.getCartridgeType(),memberContext.getMemberId());
    log.error(msg,e);
    throw new RuntimeException(msg,e);
  }
 finally {
    if (lock != null) {
      CloudControllerContext.getInstance().releaseWriteLock(lock);
    }
  }
}