Program: 116033
Project: 116033
Buggy source:
public MemberContext startContainer(MemberContext memberContext) throws CartridgeNotFoundException {
  Lock lock=null;
  try {
    lock=CloudControllerContext.getInstance().acquireMemberContextWriteLock();
    handleNullObject(memberContext,"String_Node_Str");
    if (log.isInfoEnabled()) {
      log.info(String.format("String_Node_Str",memberContext.getCartridgeType()));
    }
    String clusterId=memberContext.getClusterId();
    String memberId=memberContext.getMemberId();
    handleNullObject(clusterId,"String_Node_Str");
    ClusterContext clusterContext=CloudControllerContext.getInstance().getClusterContext(clusterId);
    handleNullObject(clusterContext,"String_Node_Str" + clusterId + "String_Node_Str"+ memberId);
    Partition partition=memberContext.getPartition();
    handleNullObject(partition,"String_Node_Str" + "String_Node_Str" + clusterId + "String_Node_Str"+ memberId);
    String cartridgeType=clusterContext.getCartridgeType();
    Cartridge cartridge=CloudControllerContext.getInstance().getCartridge(cartridgeType);
    if (cartridge == null) {
      String msg="String_Node_Str" + cartridgeType + "String_Node_Str"+ "String_Node_Str"+ clusterId+ "String_Node_Str"+ memberId;
      log.error(msg);
      throw new CartridgeNotFoundException(msg);
    }
    try {
      String kubernetesClusterId=readProperty(StratosConstants.KUBERNETES_CLUSTER_ID,partition.getProperties(),partition.toString());
      KubernetesGroup kubernetesGroup=CloudControllerContext.getInstance().getKubernetesGroup(kubernetesClusterId);
      handleNullObject(kubernetesGroup,"String_Node_Str" + "String_Node_Str" + kubernetesClusterId + "String_Node_Str"+ clusterId+ "String_Node_Str"+ memberId);
      String kubernetesMasterIp=kubernetesGroup.getKubernetesMaster().getHostIpAddress();
      PortRange kubernetesPortRange=kubernetesGroup.getPortRange();
      String kubernetesMasterPort=CloudControllerUtil.getProperty(kubernetesGroup.getKubernetesMaster().getProperties(),StratosConstants.KUBERNETES_MASTER_PORT,StratosConstants.KUBERNETES_MASTER_DEFAULT_PORT);
      KubernetesClusterContext kubClusterContext=getKubernetesClusterContext(kubernetesClusterId,kubernetesMasterIp,kubernetesMasterPort,kubernetesPortRange.getLower(),kubernetesPortRange.getUpper());
      KubernetesApiClient kubernetesApi=kubClusterContext.getKubApi();
      createReplicationController(memberContext,clusterId,kubernetesApi);
      List<Service> services=createProxyServices(clusterContext,kubClusterContext,kubernetesApi);
      Pod[] pods=waitForPodToBeCreated(memberContext,kubernetesApi);
      if (pods.length != 1) {
        if (log.isDebugEnabled()) {
          log.debug(String.format("String_Node_Str" + "String_Node_Str",((int)POD_CREATION_TIMEOUT / 1000),clusterId,memberId));
        }
        terminateContainers(clusterId);
        return null;
      }
      Pod pod=pods[0];
      if (log.isDebugEnabled()) {
        log.debug(String.format("String_Node_Str",clusterId,memberId,pod.getId()));
      }
      MemberContext newMemberContext=new MemberContext();
      newMemberContext.setCartridgeType(cartridgeType);
      newMemberContext.setClusterId(clusterId);
      newMemberContext.setMemberId(memberContext.getMemberId());
      newMemberContext.setClusterInstanceId(memberContext.getClusterInstanceId());
      newMemberContext.setInitTime(memberContext.getInitTime());
      newMemberContext.setNetworkPartitionId(memberContext.getNetworkPartitionId());
      newMemberContext.setPartition(memberContext.getPartition());
      newMemberContext.setInitTime(System.currentTimeMillis());
      newMemberContext.setInstanceId(pod.getId());
      newMemberContext.setPrivateIpAddress(pod.getCurrentState().getHostIP());
      newMemberContext.setPublicIpAddress(pod.getCurrentState().getHostIP());
      newMemberContext.setProperties(memberContext.getProperties());
      Property servicesProperty=new Property();
      servicesProperty.setName(StratosConstants.KUBERNETES_SERVICES);
      servicesProperty.setValue(services);
      newMemberContext.getProperties().addProperty(servicesProperty);
      CloudControllerContext.getInstance().addMemberContext(newMemberContext);
      ScheduledThreadExecutor exec=ScheduledThreadExecutor.getInstance();
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str");
      }
      CloudControllerContext.getInstance().addScheduledFutureJob(newMemberContext.getMemberId(),exec.schedule(new PodActivationWatcher(pod.getId(),newMemberContext,kubernetesApi),5000));
      CloudControllerContext.getInstance().persist();
      log.info("String_Node_Str" + clusterId + "String_Node_Str"+ memberContext.getMemberId());
      return newMemberContext;
    }
 catch (    Exception e) {
      String msg="String_Node_Str" + memberContext.toString() + "String_Node_Str"+ e.getMessage();
      log.error(msg,e);
      throw new IllegalStateException(msg,e);
    }
  }
  finally {
    if (lock != null) {
      CloudControllerContext.getInstance().releaseWriteLock(lock);
    }
  }
}

Fixed version (ground truth):
public MemberContext startContainer(MemberContext memberContext) throws CartridgeNotFoundException {
  Lock lock=null;
  try {
    lock=CloudControllerContext.getInstance().acquireMemberContextWriteLock();
    handleNullObject(memberContext,"String_Node_Str");
    if (log.isInfoEnabled()) {
      log.info(String.format("String_Node_Str",memberContext.getCartridgeType()));
    }
    String clusterId=memberContext.getClusterId();
    String memberId=memberContext.getMemberId();
    handleNullObject(clusterId,"String_Node_Str");
    ClusterContext clusterContext=CloudControllerContext.getInstance().getClusterContext(clusterId);
    handleNullObject(clusterContext,"String_Node_Str" + clusterId + "String_Node_Str"+ memberId);
    Partition partition=memberContext.getPartition();
    handleNullObject(partition,"String_Node_Str" + "String_Node_Str" + clusterId + "String_Node_Str"+ memberId);
    String cartridgeType=clusterContext.getCartridgeType();
    Cartridge cartridge=CloudControllerContext.getInstance().getCartridge(cartridgeType);
    if (cartridge == null) {
      String msg="String_Node_Str" + cartridgeType + "String_Node_Str"+ "String_Node_Str"+ clusterId+ "String_Node_Str"+ memberId;
      log.error(msg);
      throw new CartridgeNotFoundException(msg);
    }
    try {
      String kubernetesClusterId=readProperty(StratosConstants.KUBERNETES_CLUSTER_ID,partition.getProperties(),partition.toString());
      KubernetesGroup kubernetesGroup=CloudControllerContext.getInstance().getKubernetesGroup(kubernetesClusterId);
      handleNullObject(kubernetesGroup,"String_Node_Str" + "String_Node_Str" + kubernetesClusterId + "String_Node_Str"+ clusterId+ "String_Node_Str"+ memberId);
      String kubernetesMasterIp=kubernetesGroup.getKubernetesMaster().getHostIpAddress();
      PortRange kubernetesPortRange=kubernetesGroup.getPortRange();
      String kubernetesMasterPort=CloudControllerUtil.getProperty(kubernetesGroup.getKubernetesMaster().getProperties(),StratosConstants.KUBERNETES_MASTER_PORT,StratosConstants.KUBERNETES_MASTER_DEFAULT_PORT);
      KubernetesClusterContext kubClusterContext=getKubernetesClusterContext(kubernetesClusterId,kubernetesMasterIp,kubernetesMasterPort,kubernetesPortRange.getLower(),kubernetesPortRange.getUpper());
      KubernetesApiClient kubernetesApi=kubClusterContext.getKubApi();
      createReplicationController(memberContext,clusterId,kubernetesApi);
      List<Service> services=createProxyServices(clusterContext,kubClusterContext,kubernetesApi);
      Pod[] pods=waitForPodToBeCreated(memberContext,kubernetesApi);
      if (pods.length != 1) {
        if (log.isDebugEnabled()) {
          log.debug(String.format("String_Node_Str" + "String_Node_Str",((int)POD_CREATION_TIMEOUT / 1000),clusterId,memberId));
        }
        terminateContainers(clusterId);
        return null;
      }
      Pod pod=pods[0];
      if (log.isDebugEnabled()) {
        log.debug(String.format("String_Node_Str",clusterId,memberId,pod.getId()));
      }
      MemberContext newMemberContext=createNewMemberContext(memberContext,pod);
      Property servicesProperty=new Property();
      servicesProperty.setName(StratosConstants.KUBERNETES_SERVICES);
      servicesProperty.setValue(services);
      newMemberContext.getProperties().addProperty(servicesProperty);
      CloudControllerContext.getInstance().addMemberContext(newMemberContext);
      ScheduledThreadExecutor exec=ScheduledThreadExecutor.getInstance();
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str");
      }
      CloudControllerContext.getInstance().addScheduledFutureJob(newMemberContext.getMemberId(),exec.schedule(new PodActivationWatcher(pod.getId(),newMemberContext,kubernetesApi),5000));
      CloudControllerContext.getInstance().persist();
      log.info("String_Node_Str" + clusterId + "String_Node_Str"+ memberContext.getMemberId());
      return newMemberContext;
    }
 catch (    Exception e) {
      String msg="String_Node_Str" + memberContext.toString() + "String_Node_Str"+ e.getMessage();
      log.error(msg,e);
      throw new IllegalStateException(msg,e);
    }
  }
  finally {
    if (lock != null) {
      CloudControllerContext.getInstance().releaseWriteLock(lock);
    }
  }
}