Program: 115991
Project: 115991
Buggy source:
/** 
 * Create new replication controller for the cluster and generate environment variables using member context.
 * @param memberContext
 * @param kubernetesApi
 * @throws KubernetesClientException
 */
private void createReplicationController(ClusterContext clusterContext,MemberContext memberContext,KubernetesApiClient kubernetesApi) throws KubernetesClientException {
  if (log.isInfoEnabled()) {
    log.info(String.format("String_Node_Str",memberContext.getCartridgeType(),memberContext.getClusterId()));
  }
  Partition partition=memberContext.getPartition();
  if (partition == null) {
    String message="String_Node_Str" + memberContext.getMemberId();
    log.error(message);
    throw new RuntimeException(message);
  }
  Cartridge cartridge=CloudControllerContext.getInstance().getCartridge(memberContext.getCartridgeType());
  if (cartridge == null) {
    String message="String_Node_Str" + memberContext.getCartridgeType();
    log.error(message);
    throw new RuntimeException(message);
  }
  IaasProvider iaasProvider=cartridge.getIaasProviderOfPartition(partition.getId());
  if (iaasProvider == null) {
    String message="String_Node_Str" + partition.getId();
    log.error(message);
    throw new RuntimeException(message);
  }
  memberContext.setDynamicPayload(payload);
  String replicationControllerId=CloudControllerUtil.replaceDotsWithDash(memberContext.getMemberId());
  String replicationControllerName=replicationControllerId;
  String dockerImage=iaasProvider.getImage();
  List<Integer> containerPorts=KubernetesIaasUtil.prepareCartridgePorts(cartridge);
  EnvironmentVariable[] environmentVariables=KubernetesIaasUtil.prepareEnvironmentVariables(clusterContext,memberContext);
  int replicas=1;
  kubernetesApi.createReplicationController(replicationControllerId,replicationControllerName,dockerImage,containerPorts,environmentVariables,replicas);
  if (log.isInfoEnabled()) {
    log.info(String.format("String_Node_Str",memberContext.getCartridgeType(),memberContext.getClusterId()));
  }
}

Fixed version (ground truth):
/** 
 * Create new replication controller for the cluster and generate environment variables using member context.
 * @param memberContext
 * @param kubernetesApi
 * @throws KubernetesClientException
 */
private void createReplicationController(ClusterContext clusterContext,MemberContext memberContext,KubernetesApiClient kubernetesApi) throws KubernetesClientException {
  if (log.isInfoEnabled()) {
    log.info(String.format("String_Node_Str",memberContext.getCartridgeType(),memberContext.getClusterId()));
  }
  Partition partition=memberContext.getPartition();
  if (partition == null) {
    String message="String_Node_Str" + memberContext.getMemberId();
    log.error(message);
    throw new RuntimeException(message);
  }
  Cartridge cartridge=CloudControllerContext.getInstance().getCartridge(memberContext.getCartridgeType());
  if (cartridge == null) {
    String message="String_Node_Str" + memberContext.getCartridgeType();
    log.error(message);
    throw new RuntimeException(message);
  }
  IaasProvider iaasProvider=cartridge.getIaasProviderOfPartition(partition.getId());
  if (iaasProvider == null) {
    String message="String_Node_Str" + partition.getId();
    log.error(message);
    throw new RuntimeException(message);
  }
  memberContext.setDynamicPayload(payload);
  String replicationControllerId=CloudControllerUtil.replaceDotsWithDash(memberContext.getMemberId());
  String replicationControllerName=memberContext.getClusterId();
  String dockerImage=iaasProvider.getImage();
  EnvironmentVariable[] environmentVariables=KubernetesIaasUtil.prepareEnvironmentVariables(clusterContext,memberContext);
  int replicas=1;
  kubernetesApi.createReplicationController(replicationControllerId,replicationControllerName,dockerImage,KubernetesIaasUtil.convertPortMappings(cartridge.getPortMappings()),environmentVariables,replicas);
  if (log.isInfoEnabled()) {
    log.info(String.format("String_Node_Str",memberContext.getCartridgeType(),memberContext.getClusterId()));
  }
}