Program: 116481
Project: 116481
Buggy source:
@Override public MemberContext[] startContainers(ContainerClusterContext containerClusterContext) throws UnregisteredCartridgeException {
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  if (containerClusterContext == null) {
    String msg="String_Node_Str";
    log.error(msg);
    throw new IllegalArgumentException(msg);
  }
  String clusterId=containerClusterContext.getClusterId();
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + containerClusterContext.toString());
  }
  ClusterContext ctxt=dataHolder.getClusterContext(clusterId);
  if (ctxt == null) {
    String msg="String_Node_Str" + containerClusterContext.toString();
    log.error(msg);
    throw new IllegalArgumentException(msg);
  }
  String cartridgeType=ctxt.getCartridgeType();
  Cartridge cartridge=dataHolder.getCartridge(cartridgeType);
  if (cartridge == null) {
    String msg="String_Node_Str" + cartridgeType + "String_Node_Str"+ containerClusterContext.toString();
    log.error(msg);
    throw new UnregisteredCartridgeException(msg);
  }
  try {
    String minReplicas=validateProperty(StratosConstants.KUBERNETES_MIN_REPLICAS,ctxt);
    String kubernetesClusterId=validateProperty(StratosConstants.KUBERNETES_CLUSTER_ID,ctxt);
    String kubernetesMasterIp=validateProperty(StratosConstants.KUBERNETES_MASTER_IP,containerClusterContext);
    String kubernetesPortRange=validateProperty(StratosConstants.KUBERNETES_PORT_RANGE,containerClusterContext);
    KubernetesClusterContext kubClusterContext=getKubernetesClusterContext(kubernetesClusterId,kubernetesMasterIp,kubernetesPortRange);
    KubernetesApiClient kubApi=kubClusterContext.getKubApi();
    ContainerClusterContextToReplicationController controllerFunction=new ContainerClusterContextToReplicationController();
    ReplicationController controller=controllerFunction.apply(containerClusterContext);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + controller + "String_Node_Str"+ containerClusterContext+ "String_Node_Str");
    }
    kubApi.createReplicationController(controller);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + controller + "String_Node_Str");
    }
    ContainerClusterContextToKubernetesService serviceFunction=new ContainerClusterContextToKubernetesService();
    Service service=serviceFunction.apply(containerClusterContext);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + service + "String_Node_Str"+ containerClusterContext+ "String_Node_Str");
    }
    kubApi.createService(service);
    ctxt.addProperty(StratosConstants.ALLOCATED_SERVICE_HOST_PORT,service.getPort());
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + controller + "String_Node_Str");
    }
    Label l=new Label();
    l.setName(clusterId);
    Pod[] newlyCreatedPods=new Pod[0];
    int expectedCount=Integer.parseInt(minReplicas);
    for (int i=0; i < expectedCount; i++) {
      newlyCreatedPods=kubApi.getSelectedPods(new Label[]{l});
      log.info("String_Node_Str" + newlyCreatedPods.length);
      if (newlyCreatedPods.length == expectedCount) {
        break;
      }
      Thread.sleep(5000);
    }
    if (log.isDebugEnabled()) {
      log.debug(String.format("String_Node_Str",newlyCreatedPods.length,clusterId));
    }
    List<MemberContext> memberContexts=new ArrayList<MemberContext>();
    PodToMemberContext podToMemberContextFunc=new PodToMemberContext();
    for (    Pod pod : newlyCreatedPods) {
      MemberContext context=podToMemberContextFunc.apply(pod);
      context.setCartridgeType(cartridgeType);
      context.setClusterId(clusterId);
      context.setProperties(CloudControllerUtil.addProperty(context.getProperties(),StratosConstants.ALLOCATED_SERVICE_HOST_PORT,String.valueOf(service.getPort())));
      dataHolder.addMemberContext(context);
      TopologyBuilder.handleMemberSpawned(cartridgeType,clusterId,null,kubernetesMasterIp,kubernetesMasterIp,context);
      memberContexts.add(context);
    }
    persist();
    log.info("String_Node_Str" + memberContexts);
    return memberContexts.toArray(new MemberContext[0]);
  }
 catch (  Exception e) {
    String msg="String_Node_Str" + containerClusterContext.toString() + "String_Node_Str"+ e.getMessage();
    log.error(msg,e);
    throw new IllegalStateException(msg,e);
  }
}

Fixed version (ground truth):
@Override public MemberContext[] startContainers(ContainerClusterContext containerClusterContext) throws UnregisteredCartridgeException {
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  if (containerClusterContext == null) {
    String msg="String_Node_Str";
    log.error(msg);
    throw new IllegalArgumentException(msg);
  }
  String clusterId=containerClusterContext.getClusterId();
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + containerClusterContext.toString());
  }
  ClusterContext ctxt=dataHolder.getClusterContext(clusterId);
  if (ctxt == null) {
    String msg="String_Node_Str" + containerClusterContext.toString();
    log.error(msg);
    throw new IllegalArgumentException(msg);
  }
  String cartridgeType=ctxt.getCartridgeType();
  Cartridge cartridge=dataHolder.getCartridge(cartridgeType);
  if (cartridge == null) {
    String msg="String_Node_Str" + cartridgeType + "String_Node_Str"+ containerClusterContext.toString();
    log.error(msg);
    throw new UnregisteredCartridgeException(msg);
  }
  try {
    String minReplicas=validateProperty(StratosConstants.KUBERNETES_MIN_REPLICAS,ctxt);
    String kubernetesClusterId=validateProperty(StratosConstants.KUBERNETES_CLUSTER_ID,ctxt);
    String kubernetesMasterIp=validateProperty(StratosConstants.KUBERNETES_MASTER_IP,containerClusterContext);
    String kubernetesPortRange=validateProperty(StratosConstants.KUBERNETES_PORT_RANGE,containerClusterContext);
    KubernetesClusterContext kubClusterContext=getKubernetesClusterContext(kubernetesClusterId,kubernetesMasterIp,kubernetesPortRange);
    KubernetesApiClient kubApi=kubClusterContext.getKubApi();
    ContainerClusterContextToReplicationController controllerFunction=new ContainerClusterContextToReplicationController();
    ReplicationController controller=controllerFunction.apply(containerClusterContext);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + controller + "String_Node_Str"+ containerClusterContext+ "String_Node_Str");
    }
    kubApi.createReplicationController(controller);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + controller + "String_Node_Str");
    }
    ContainerClusterContextToKubernetesService serviceFunction=new ContainerClusterContextToKubernetesService();
    Service service=serviceFunction.apply(containerClusterContext);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + service + "String_Node_Str"+ containerClusterContext+ "String_Node_Str");
    }
    kubApi.createService(service);
    ctxt.addProperty(StratosConstants.ALLOCATED_SERVICE_HOST_PORT,service.getPort());
    dataHolder.addClusterContext(ctxt);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + controller + "String_Node_Str");
    }
    Label l=new Label();
    l.setName(clusterId);
    Pod[] newlyCreatedPods=new Pod[0];
    int expectedCount=Integer.parseInt(minReplicas);
    for (int i=0; i < expectedCount; i++) {
      newlyCreatedPods=kubApi.getSelectedPods(new Label[]{l});
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + newlyCreatedPods.length + "String_Node_Str"+ clusterId);
      }
      if (newlyCreatedPods.length == expectedCount) {
        break;
      }
      Thread.sleep(5000);
    }
    if (log.isDebugEnabled()) {
      log.debug(String.format("String_Node_Str",newlyCreatedPods.length,clusterId));
    }
    List<MemberContext> memberContexts=new ArrayList<MemberContext>();
    PodToMemberContext podToMemberContextFunc=new PodToMemberContext();
    for (    Pod pod : newlyCreatedPods) {
      MemberContext context=podToMemberContextFunc.apply(pod);
      context.setCartridgeType(cartridgeType);
      context.setClusterId(clusterId);
      context.setProperties(CloudControllerUtil.addProperty(context.getProperties(),StratosConstants.ALLOCATED_SERVICE_HOST_PORT,String.valueOf(service.getPort())));
      dataHolder.addMemberContext(context);
      TopologyBuilder.handleMemberSpawned(cartridgeType,clusterId,null,pod.getCurrentState().getPodIP(),pod.getCurrentState().getHostIP(),context);
      memberContexts.add(context);
    }
    persist();
    log.info("String_Node_Str" + memberContexts);
    return memberContexts.toArray(new MemberContext[0]);
  }
 catch (  Exception e) {
    String msg="String_Node_Str" + containerClusterContext.toString() + "String_Node_Str"+ e.getMessage();
    log.error(msg,e);
    throw new IllegalStateException(msg,e);
  }
}