Program: 115962
Project: 115962
Buggy source:
/** 
 * Create new pod and pass environment variables.
 * @param memberContext
 * @param kubernetesApi
 * @throws KubernetesClientException
 */
private void createPod(ClusterContext clusterContext,MemberContext memberContext,KubernetesApiClient kubernetesApi) throws KubernetesClientException {
  String applicationId=memberContext.getApplicationId();
  String cartridgeType=memberContext.getCartridgeType();
  String memberId=memberContext.getMemberId();
  if (log.isInfoEnabled()) {
    log.info(String.format("String_Node_Str",applicationId,cartridgeType,memberId));
  }
  Partition partition=memberContext.getPartition();
  if (partition == null) {
    String message=String.format("String_Node_Str" + "String_Node_Str",applicationId,cartridgeType,memberId);
    log.error(message);
    throw new RuntimeException(message);
  }
  Cartridge cartridge=CloudControllerContext.getInstance().getCartridge(cartridgeType);
  if (cartridge == null) {
    String message="String_Node_Str" + cartridgeType;
    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 podId=KubernetesIaasUtil.fixSpecialCharacters(memberId);
  String podName=podId;
  String dockerImage=iaasProvider.getImage();
  EnvironmentVariable[] environmentVariables=KubernetesIaasUtil.prepareEnvironmentVariables(clusterContext,memberContext);
  kubernetesApi.createPod(podId,podName,dockerImage,KubernetesIaasUtil.convertPortMappings(cartridge.getPortMappings()),environmentVariables);
  memberContext.setKubernetesPodId(podId);
  memberContext.setKubernetesPodName(podName);
  CloudControllerContext.getInstance().persist();
  if (log.isInfoEnabled()) {
    log.info(String.format("String_Node_Str" + "String_Node_Str",applicationId,cartridgeType,memberId,memberContext.getKubernetesPodId()));
  }
}

Fixed version (ground truth):
/** 
 * Create new pod and pass environment variables.
 * @param memberContext
 * @param kubernetesApi
 * @throws KubernetesClientException
 */
private void createPod(ClusterContext clusterContext,MemberContext memberContext,KubernetesApiClient kubernetesApi) throws KubernetesClientException {
  String applicationId=memberContext.getApplicationId();
  String cartridgeType=memberContext.getCartridgeType();
  String memberId=memberContext.getMemberId();
  if (log.isInfoEnabled()) {
    log.info(String.format("String_Node_Str",applicationId,cartridgeType,memberId));
  }
  Partition partition=memberContext.getPartition();
  if (partition == null) {
    String message=String.format("String_Node_Str" + "String_Node_Str",applicationId,cartridgeType,memberId);
    log.error(message);
    throw new RuntimeException(message);
  }
  Cartridge cartridge=CloudControllerContext.getInstance().getCartridge(cartridgeType);
  if (cartridge == null) {
    String message="String_Node_Str" + cartridgeType;
    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.toArray(new NameValuePair[payload.size()]));
  String podId=KubernetesIaasUtil.fixSpecialCharacters(memberId);
  String podName=podId;
  String dockerImage=iaasProvider.getImage();
  EnvironmentVariable[] environmentVariables=KubernetesIaasUtil.prepareEnvironmentVariables(clusterContext,memberContext);
  kubernetesApi.createPod(podId,podName,dockerImage,KubernetesIaasUtil.convertPortMappings(cartridge.getPortMappings()),environmentVariables);
  memberContext.setKubernetesPodId(podId);
  memberContext.setKubernetesPodName(podName);
  CloudControllerContext.getInstance().persist();
  if (log.isInfoEnabled()) {
    log.info(String.format("String_Node_Str" + "String_Node_Str",applicationId,cartridgeType,memberId,memberContext.getKubernetesPodId()));
  }
}