nus-yam/ex-repair huggingface dataset:
Program: 115418
Project: 115418
Buggy source:
public IndexerJobStatus call(){
  indexerJobStatus.setJobStatus(IndexerJobStatusEnum.Started);
  while (!shutdownRequested) {
    try {
      if (Thread.currentThread().isInterrupted()) {
        Thread.currentThread().interrupt();
        throw new InterruptedException("String_Node_Str" + currentPartition + "String_Node_Str");
      }
      logger.info("String_Node_Str",currentPartition);
      indexerJobStatus.setJobStatus(IndexerJobStatusEnum.InProgress);
      processBatch();
      Thread.sleep(consumerConfig.consumerSleepBetweenFetchsMs * 1000);
      logger.debug("String_Node_Str",currentPartition);
    }
 catch (    IndexerESException e) {
      indexerJobStatus.setJobStatus(IndexerJobStatusEnum.Failed);
      stopClients();
      break;
    }
catch (    InterruptedException e) {
      indexerJobStatus.setJobStatus(IndexerJobStatusEnum.Stopped);
      stopClients();
      break;
    }
catch (    Exception e) {
      logger.error("String_Node_Str",currentPartition,e);
      try {
        this.reInitKafka();
      }
 catch (      Exception e2) {
        logger.error("String_Node_Str" + e2.getMessage(),currentPartition);
        indexerJobStatus.setJobStatus(IndexerJobStatusEnum.Failed);
        stopClients();
        break;
      }
    }
  }
  logger.warn("String_Node_Str",indexerJobStatus);
  return indexerJobStatus;
}

Fixed version (ground truth):
public IndexerJobStatus call(){
  indexerJobStatus.setJobStatus(IndexerJobStatusEnum.Started);
  while (!shutdownRequested) {
    try {
      if (Thread.currentThread().isInterrupted()) {
        Thread.currentThread().interrupt();
        throw new InterruptedException("String_Node_Str" + currentPartition + "String_Node_Str");
      }
      logger.debug("String_Node_Str",currentPartition);
      indexerJobStatus.setJobStatus(IndexerJobStatusEnum.InProgress);
      processBatch();
      Thread.sleep(consumerConfig.consumerSleepBetweenFetchsMs * 1000);
      logger.debug("String_Node_Str",currentPartition);
    }
 catch (    IndexerESException e) {
      indexerJobStatus.setJobStatus(IndexerJobStatusEnum.Failed);
      stopClients();
      break;
    }
catch (    InterruptedException e) {
      indexerJobStatus.setJobStatus(IndexerJobStatusEnum.Stopped);
      stopClients();
      break;
    }
catch (    Exception e) {
      logger.error("String_Node_Str",currentPartition,e);
      try {
        this.reInitKafka();
      }
 catch (      Exception e2) {
        logger.error("String_Node_Str" + e2.getMessage(),currentPartition);
        indexerJobStatus.setJobStatus(IndexerJobStatusEnum.Failed);
        stopClients();
        break;
      }
    }
  }
  logger.warn("String_Node_Str",indexerJobStatus);
  return indexerJobStatus;
}
Program: 115422
Project: 115422
Buggy source:
public static void logFailedToPostToESEvent(String errorMsg,String event){
  logger.error("String_Node_Str",errorMsg,event);
}

Fixed version (ground truth):
public static void logFailedToPostToESEvent(String restResponse,String errorMsg){
  logger.error("String_Node_Str",restResponse,errorMsg);
}
Program: 115423
Project: 115423
Buggy source:
private String getEndpoint(String ip,String port){
  return "String_Node_Str" + ip + "String_Node_Str"+ port+ "String_Node_Str";
}

Fixed version (ground truth):
private String getEndpoint(String ip,String port){
  StringBuffer endPoint=new StringBuffer().append("String_Node_Str").append(ip);
  if (port != null) {
    endPoint.append("String_Node_Str").append(port);
  }
  return endPoint.toString();
}
Program: 115425
Project: 115425
Buggy source:
@Override public boolean addKubernetesCluster(KubernetesCluster kubernetesCluster) throws InvalidKubernetesClusterException, KubernetesClusterAlreadyExistsException {
  if (kubernetesCluster == null) {
    throw new InvalidKubernetesClusterException("String_Node_Str");
  }
  try {
    if (CloudControllerContext.getInstance().getKubernetesCluster(kubernetesCluster.getClusterId()) != null) {
      throw new KubernetesClusterAlreadyExistsException("String_Node_Str");
    }
  }
 catch (  NonExistingKubernetesClusterException ignore) {
  }
  Lock lock=null;
  try {
    lock=CloudControllerContext.getInstance().acquireKubernetesClusterWriteLock();
    if (log.isInfoEnabled()) {
      log.info(String.format("String_Node_Str",kubernetesCluster.getClusterId()));
    }
    CloudControllerUtil.validateKubernetesCluster(kubernetesCluster);
    CloudControllerContext.getInstance().addKubernetesCluster(kubernetesCluster);
    CloudControllerContext.getInstance().persist();
    if (log.isInfoEnabled()) {
      log.info(String.format("String_Node_Str",kubernetesCluster.getClusterId()));
    }
    return true;
  }
 catch (  Exception e) {
    throw new InvalidKubernetesClusterException(e.getMessage(),e);
  }
 finally {
    if (lock != null) {
      CloudControllerContext.getInstance().releaseWriteLock(lock);
    }
  }
}

Fixed version (ground truth):
@Override public boolean addKubernetesCluster(KubernetesCluster kubernetesCluster) throws InvalidKubernetesClusterException, KubernetesClusterAlreadyExistsException {
  if (kubernetesCluster == null) {
    throw new InvalidKubernetesClusterException("String_Node_Str");
  }
  try {
    if (CloudControllerContext.getInstance().getKubernetesCluster(kubernetesCluster.getClusterId()) != null) {
      throw new KubernetesClusterAlreadyExistsException("String_Node_Str");
    }
  }
 catch (  NonExistingKubernetesClusterException ignore) {
  }
  Lock lock=null;
  try {
    lock=CloudControllerContext.getInstance().acquireKubernetesClusterWriteLock();
    if (log.isInfoEnabled()) {
      log.info(String.format("String_Node_Str",kubernetesCluster.getClusterId()));
    }
    CloudControllerUtil.validateKubernetesCluster(kubernetesCluster);
    CloudControllerContext.getInstance().addKubernetesCluster(kubernetesCluster);
    CloudControllerContext.getInstance().persist();
    if (log.isInfoEnabled()) {
      log.info(String.format("String_Node_Str",kubernetesCluster.getClusterId()));
    }
    return true;
  }
 catch (  Exception e) {
    log.error("String_Node_Str" + e.getMessage(),e);
    throw new InvalidKubernetesClusterException(e.getMessage(),e);
  }
 finally {
    if (lock != null) {
      CloudControllerContext.getInstance().releaseWriteLock(lock);
    }
  }
}
Program: 115426
Project: 115426
Buggy source:
@Override public boolean updateKubernetesCluster(KubernetesCluster kubernetesCluster) throws InvalidKubernetesClusterException {
  if (kubernetesCluster == null) {
    throw new InvalidKubernetesClusterException("String_Node_Str");
  }
  Lock lock=null;
  try {
    lock=CloudControllerContext.getInstance().acquireKubernetesClusterWriteLock();
    if (log.isInfoEnabled()) {
      log.info(String.format("String_Node_Str",kubernetesCluster.getClusterId()));
    }
    CloudControllerUtil.validateKubernetesCluster(kubernetesCluster);
    CloudControllerContext.getInstance().updateKubernetesCluster(kubernetesCluster);
    CloudControllerContext.getInstance().persist();
    if (log.isInfoEnabled()) {
      log.info(String.format("String_Node_Str",kubernetesCluster.getClusterId()));
    }
    return true;
  }
 catch (  Exception e) {
    throw new InvalidKubernetesClusterException(e.getMessage(),e);
  }
 finally {
    if (lock != null) {
      CloudControllerContext.getInstance().releaseWriteLock(lock);
    }
  }
}

Fixed version (ground truth):
@Override public boolean updateKubernetesCluster(KubernetesCluster kubernetesCluster) throws InvalidKubernetesClusterException {
  if (kubernetesCluster == null) {
    throw new InvalidKubernetesClusterException("String_Node_Str");
  }
  Lock lock=null;
  try {
    lock=CloudControllerContext.getInstance().acquireKubernetesClusterWriteLock();
    if (log.isInfoEnabled()) {
      log.info(String.format("String_Node_Str",kubernetesCluster.getClusterId()));
    }
    CloudControllerUtil.validateKubernetesCluster(kubernetesCluster);
    CloudControllerContext.getInstance().updateKubernetesCluster(kubernetesCluster);
    KubernetesClusterContext kubClusterContext=CloudControllerContext.getInstance().getKubernetesClusterContext(kubernetesCluster.getClusterId());
    kubClusterContext.updateKubClusterContextParams(kubernetesCluster);
    CloudControllerContext.getInstance().updateKubernetesClusterContext(kubClusterContext);
    CloudControllerContext.getInstance().persist();
    if (log.isInfoEnabled()) {
      log.info(String.format("String_Node_Str",kubernetesCluster.getClusterId()));
    }
    return true;
  }
 catch (  Exception e) {
    throw new InvalidKubernetesClusterException(e.getMessage(),e);
  }
 finally {
    if (lock != null) {
      CloudControllerContext.getInstance().releaseWriteLock(lock);
    }
  }
}
Program: 115427
Project: 115427
Buggy source:
public static void validateKubernetesHost(KubernetesHost kubernetesHost) throws InvalidKubernetesHostException {
  if (kubernetesHost == null) {
    throw new InvalidKubernetesHostException("String_Node_Str");
  }
  if (StringUtils.isBlank(kubernetesHost.getHostId())) {
    throw new InvalidKubernetesHostException("String_Node_Str");
  }
  if (StringUtils.isBlank(kubernetesHost.getPrivateIPAddress())) {
    throw new InvalidKubernetesHostException("String_Node_Str" + "String_Node_Str" + kubernetesHost.getHostId());
  }
  if (!InetAddresses.isInetAddress(kubernetesHost.getPrivateIPAddress())) {
    throw new InvalidKubernetesHostException("String_Node_Str" + kubernetesHost.getPrivateIPAddress());
  }
  if (StringUtils.isNotBlank(kubernetesHost.getPublicIPAddress())) {
    if (!InetAddresses.isInetAddress(kubernetesHost.getPublicIPAddress())) {
      throw new InvalidKubernetesHostException("String_Node_Str" + kubernetesHost.getPrivateIPAddress());
    }
  }
}

Fixed version (ground truth):
public static void validateKubernetesHost(KubernetesHost kubernetesHost) throws InvalidKubernetesHostException {
  if (kubernetesHost == null) {
    throw new InvalidKubernetesHostException("String_Node_Str");
  }
  if (StringUtils.isBlank(kubernetesHost.getHostId())) {
    throw new InvalidKubernetesHostException("String_Node_Str");
  }
  if (StringUtils.isBlank(kubernetesHost.getPrivateIPAddress())) {
    throw new InvalidKubernetesHostException("String_Node_Str" + "String_Node_Str" + kubernetesHost.getHostId());
  }
}
Program: 115428
Project: 115428
Buggy source:
@Override public boolean addApplication(ApplicationContext applicationContext) throws ApplicationDefinitionException, CartridgeGroupNotFoundException, CartridgeNotFoundException {
  if (log.isInfoEnabled()) {
    log.info(String.format("String_Node_Str",applicationContext.getApplicationId()));
  }
  ApplicationParser applicationParser=new DefaultApplicationParser();
  Application application=applicationParser.parse(applicationContext);
  ApplicationHolder.persistApplication(application);
  List<ApplicationClusterContext> applicationClusterContexts=applicationParser.getApplicationClusterContexts();
  ApplicationClusterContext[] applicationClusterContextsArray=applicationClusterContexts.toArray(new ApplicationClusterContext[applicationClusterContexts.size()]);
  applicationContext.getComponents().setApplicationClusterContexts(applicationClusterContextsArray);
  applicationContext.setStatus(ApplicationContext.STATUS_CREATED);
  AutoscalerContext.getInstance().addApplicationContext(applicationContext);
  RegistryManager.getInstance().persistApplicationContext(applicationContext);
  if (log.isInfoEnabled()) {
    log.info(String.format("String_Node_Str",applicationContext.getApplicationId()));
  }
  ApplicationsEventPublisher.sendApplicationCreatedEvent(application);
  return true;
}

Fixed version (ground truth):
@Override public boolean addApplication(ApplicationContext applicationContext) throws ApplicationDefinitionException, CartridgeGroupNotFoundException, CartridgeNotFoundException {
  if (log.isInfoEnabled()) {
    log.info(String.format("String_Node_Str",applicationContext.getApplicationId()));
  }
  Application application=parseApplication(applicationContext);
  applicationContext.setStatus(ApplicationContext.STATUS_CREATED);
  AutoscalerContext.getInstance().addApplicationContext(applicationContext);
  RegistryManager.getInstance().persistApplicationContext(applicationContext);
  if (log.isInfoEnabled()) {
    log.info(String.format("String_Node_Str",applicationContext.getApplicationId()));
  }
  ApplicationsEventPublisher.sendApplicationCreatedEvent(application);
  return true;
}
Program: 115430
Project: 115430
Buggy source:
/** 
 * Convert Persistence To PersistenceBean
 * @param baseDir     base directory
 * @param directories directories
 * @return DeploymentBean
 */
private static DeploymentBean convertDeploymentToDeploymentBean(String[] directories,String baseDir){
  if (baseDir == null || directories == null || directories[0] == null) {
    return null;
  }
  DeploymentBean deploymentBean=new DeploymentBean();
  deploymentBean.setBaseDir(baseDir);
  deploymentBean.setDir(Arrays.asList(baseDir));
  return deploymentBean;
}

Fixed version (ground truth):
/** 
 * Convert Persistence To PersistenceBean
 * @param baseDir     base directory
 * @param directories directories
 * @return DeploymentBean
 */
private static DeploymentBean convertDeploymentToDeploymentBean(String[] directories,String baseDir){
  if (baseDir == null && (directories == null || directories[0] == null)) {
    return null;
  }
  DeploymentBean deploymentBean=new DeploymentBean();
  deploymentBean.setBaseDir(baseDir);
  if (ArrayUtils.isNotEmpty(directories) && (directories[0] != null)) {
    deploymentBean.setDir(Arrays.asList(directories));
  }
  return deploymentBean;
}
Program: 115431
Project: 115431
Buggy source:
private AutoscalerCloudControllerClient(){
  try {
    XMLConfiguration conf=ConfUtil.getInstance(null).getConfiguration();
    int port=conf.getInt("String_Node_Str",AutoscalerConstants.CLOUD_CONTROLLER_DEFAULT_PORT);
    String hostname=conf.getString("String_Node_Str","String_Node_Str");
    String epr="String_Node_Str" + hostname + "String_Node_Str"+ port+ "String_Node_Str"+ AutoscalerConstants.CLOUD_CONTROLLER_SERVICE_SFX;
    int cloudControllerClientTimeout=conf.getInt("String_Node_Str",180000);
    stub=new CloudControllerServiceStub(epr);
    stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT,cloudControllerClientTimeout);
    stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT,cloudControllerClientTimeout);
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private AutoscalerCloudControllerClient(){
  MultiThreadedHttpConnectionManager multiThreadedHttpConnectionManager=new MultiThreadedHttpConnectionManager();
  HttpConnectionManagerParams params=new HttpConnectionManagerParams();
  params.setDefaultMaxConnectionsPerHost(AS_CC_CLIENT_MAX_CONNECTIONS_PER_HOST);
  params.setMaxTotalConnections(AS_CC_CLIENT_MAX_TOTAL_CONNECTIONS);
  multiThreadedHttpConnectionManager.setParams(params);
  HttpClient httpClient=new HttpClient(multiThreadedHttpConnectionManager);
  try {
    ConfigurationContext ctx=ConfigurationContextFactory.createConfigurationContextFromFileSystem(null,null);
    ctx.setProperty(HTTPConstants.CACHED_HTTP_CLIENT,httpClient);
    XMLConfiguration conf=ConfUtil.getInstance(null).getConfiguration();
    int port=conf.getInt("String_Node_Str",AutoscalerConstants.CLOUD_CONTROLLER_DEFAULT_PORT);
    String hostname=conf.getString("String_Node_Str","String_Node_Str");
    String epr="String_Node_Str" + hostname + "String_Node_Str"+ port+ "String_Node_Str"+ AutoscalerConstants.CLOUD_CONTROLLER_SERVICE_SFX;
    int cloudControllerClientTimeout=conf.getInt("String_Node_Str",180000);
    stub=new CloudControllerServiceStub(ctx,epr);
    stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT,cloudControllerClientTimeout);
    stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT,cloudControllerClientTimeout);
    stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED,Constants.VALUE_FALSE);
    stub._getServiceClient().getOptions().setProperty(Constants.Configuration.DISABLE_SOAP_ACTION,Boolean.TRUE);
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
  }
}
Program: 115432
Project: 115432
Buggy source:
private AutoscalerServiceClient(String epr) throws AxisFault {
  String autosclaerSocketTimeout=System.getProperty(StratosConstants.AUTOSCALER_CLIENT_SOCKET_TIMEOUT) == null ? StratosConstants.DEFAULT_CLIENT_SOCKET_TIMEOUT : System.getProperty(StratosConstants.AUTOSCALER_CLIENT_SOCKET_TIMEOUT);
  String autosclaerConnectionTimeout=System.getProperty(StratosConstants.AUTOSCALER_CLIENT_CONNECTION_TIMEOUT) == null ? StratosConstants.DEFAULT_CLIENT_CONNECTION_TIMEOUT : System.getProperty(StratosConstants.AUTOSCALER_CLIENT_CONNECTION_TIMEOUT);
  try {
    stub=new AutoscalerServiceStub(epr);
    stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT,Integer.valueOf(autosclaerSocketTimeout));
    stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT,Integer.valueOf(autosclaerConnectionTimeout));
  }
 catch (  AxisFault axisFault) {
    String msg="String_Node_Str";
    log.error(msg,axisFault);
    throw new AxisFault(msg,axisFault);
  }
}

Fixed version (ground truth):
private AutoscalerServiceClient(String epr) throws AxisFault {
  MultiThreadedHttpConnectionManager multiThreadedHttpConnectionManager=new MultiThreadedHttpConnectionManager();
  HttpConnectionManagerParams params=new HttpConnectionManagerParams();
  params.setDefaultMaxConnectionsPerHost(StratosConstants.AUTOSCALER_CLIENT_MAX_CONNECTIONS_PER_HOST);
  params.setMaxTotalConnections(StratosConstants.AUTOSCALER_CLIENT_MAX_TOTAL_CONNECTIONS);
  multiThreadedHttpConnectionManager.setParams(params);
  HttpClient httpClient=new HttpClient(multiThreadedHttpConnectionManager);
  ConfigurationContext ctx=ConfigurationContextFactory.createConfigurationContextFromFileSystem(null,null);
  ctx.setProperty(HTTPConstants.CACHED_HTTP_CLIENT,httpClient);
  String autosclaerSocketTimeout=System.getProperty(StratosConstants.AUTOSCALER_CLIENT_SOCKET_TIMEOUT) == null ? StratosConstants.DEFAULT_CLIENT_SOCKET_TIMEOUT : System.getProperty(StratosConstants.AUTOSCALER_CLIENT_SOCKET_TIMEOUT);
  String autosclaerConnectionTimeout=System.getProperty(StratosConstants.AUTOSCALER_CLIENT_CONNECTION_TIMEOUT) == null ? StratosConstants.DEFAULT_CLIENT_CONNECTION_TIMEOUT : System.getProperty(StratosConstants.AUTOSCALER_CLIENT_CONNECTION_TIMEOUT);
  try {
    stub=new AutoscalerServiceStub(ctx,epr);
    stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT,Integer.valueOf(autosclaerSocketTimeout));
    stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT,Integer.valueOf(autosclaerConnectionTimeout));
    stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED,Constants.VALUE_FALSE);
    stub._getServiceClient().getOptions().setProperty(Constants.Configuration.DISABLE_SOAP_ACTION,Boolean.TRUE);
  }
 catch (  AxisFault axisFault) {
    String msg="String_Node_Str";
    log.error(msg,axisFault);
    throw new AxisFault(msg,axisFault);
  }
}
Program: 115433
Project: 115433
Buggy source:
private CloudControllerServiceClient(String epr) throws AxisFault {
  String ccSocketTimeout=System.getProperty(StratosConstants.CLOUD_CONTROLLER_CLIENT_SOCKET_TIMEOUT) == null ? StratosConstants.DEFAULT_CLIENT_SOCKET_TIMEOUT : System.getProperty(StratosConstants.CLOUD_CONTROLLER_CLIENT_SOCKET_TIMEOUT);
  String ccConnectionTimeout=System.getProperty(StratosConstants.CLOUD_CONTROLLER_CLIENT_CONNECTION_TIMEOUT) == null ? StratosConstants.DEFAULT_CLIENT_CONNECTION_TIMEOUT : System.getProperty(StratosConstants.CLOUD_CONTROLLER_CLIENT_CONNECTION_TIMEOUT);
  try {
    stub=new CloudControllerServiceStub(epr);
    stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT,Integer.valueOf(ccSocketTimeout));
    stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT,new Integer(ccConnectionTimeout));
  }
 catch (  AxisFault axisFault) {
    String msg="String_Node_Str";
    log.error(msg,axisFault);
    throw new AxisFault(msg,axisFault);
  }
}

Fixed version (ground truth):
private CloudControllerServiceClient(String epr) throws AxisFault {
  MultiThreadedHttpConnectionManager multiThreadedHttpConnectionManager=new MultiThreadedHttpConnectionManager();
  HttpConnectionManagerParams params=new HttpConnectionManagerParams();
  params.setDefaultMaxConnectionsPerHost(StratosConstants.CLOUD_CONTROLLER_CLIENT_MAX_CONNECTIONS_PER_HOST);
  params.setMaxTotalConnections(StratosConstants.CLOUD_CONTROLLER_CLIENT_MAX_TOTAL_CONNECTIONS);
  multiThreadedHttpConnectionManager.setParams(params);
  HttpClient httpClient=new HttpClient(multiThreadedHttpConnectionManager);
  ConfigurationContext ctx=ConfigurationContextFactory.createConfigurationContextFromFileSystem(null,null);
  ctx.setProperty(HTTPConstants.CACHED_HTTP_CLIENT,httpClient);
  String ccSocketTimeout=System.getProperty(StratosConstants.CLOUD_CONTROLLER_CLIENT_SOCKET_TIMEOUT) == null ? StratosConstants.DEFAULT_CLIENT_SOCKET_TIMEOUT : System.getProperty(StratosConstants.CLOUD_CONTROLLER_CLIENT_SOCKET_TIMEOUT);
  String ccConnectionTimeout=System.getProperty(StratosConstants.CLOUD_CONTROLLER_CLIENT_CONNECTION_TIMEOUT) == null ? StratosConstants.DEFAULT_CLIENT_CONNECTION_TIMEOUT : System.getProperty(StratosConstants.CLOUD_CONTROLLER_CLIENT_CONNECTION_TIMEOUT);
  try {
    stub=new CloudControllerServiceStub(ctx,epr);
    stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT,Integer.valueOf(ccSocketTimeout));
    stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT,new Integer(ccConnectionTimeout));
    stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED,Constants.VALUE_FALSE);
    stub._getServiceClient().getOptions().setProperty(Constants.Configuration.DISABLE_SOAP_ACTION,Boolean.TRUE);
  }
 catch (  AxisFault axisFault) {
    String msg="String_Node_Str";
    log.error(msg,axisFault);
    throw new AxisFault(msg,axisFault);
  }
}
Program: 115435
Project: 115435
Buggy source:
public Application(String id){
  super();
  this.id=id;
  this.key=RandomStringUtils.randomAlphanumeric(16);
  this.setInstanceIdToInstanceContextMap(new HashMap<String,ApplicationInstance>());
}

Fixed version (ground truth):
public Application(String id,String key){
  super();
  this.id=id;
  this.key=key;
  this.setInstanceIdToInstanceContextMap(new HashMap<String,ApplicationInstance>());
}
Program: 115436
Project: 115436
Buggy source:
private boolean nodePortAvailable(List<Service> services,int nodePort) throws KubernetesClientException {
  for (  Service service : services) {
    for (    ServicePort servicePort : service.getSpec().getPorts()) {
      if (servicePort.getNodePort() == nodePort) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean nodePortAvailable(List<Service> services,int nodePort) throws KubernetesClientException {
  for (  Service service : services) {
    for (    ServicePort servicePort : service.getSpec().getPorts()) {
      if ((servicePort.getNodePort() != null) && (servicePort.getNodePort() == nodePort)) {
        return false;
      }
    }
  }
  return true;
}
Program: 115437
Project: 115437
Buggy source:
private ArrayList<ReceiverGroup> getReceiverGroups(){
  ArrayList<ReceiverGroup> receiverGroups=new ArrayList<ReceiverGroup>();
  for (  ThriftClientInfo thriftClientInfo : thriftClientInfoList) {
    ArrayList<DataPublisherHolder> dataPublisherHolders=new ArrayList<DataPublisherHolder>();
    DataPublisherHolder aNode=new DataPublisherHolder(null,buildUrl(thriftClientInfo),thriftClientInfo.getUsername(),thriftClientInfo.getPassword());
    dataPublisherHolders.add(aNode);
    ReceiverGroup group=new ReceiverGroup(dataPublisherHolders);
    receiverGroups.add(group);
  }
  return receiverGroups;
}

Fixed version (ground truth):
private ArrayList<ReceiverGroup> getReceiverGroups(){
  ArrayList<ReceiverGroup> receiverGroups=new ArrayList<ReceiverGroup>();
  for (  ThriftClientInfo thriftClientInfo : thriftClientInfoList) {
    if (thriftClientInfo.isStatsPublisherEnabled()) {
      ArrayList<DataPublisherHolder> dataPublisherHolders=new ArrayList<DataPublisherHolder>();
      DataPublisherHolder aNode=new DataPublisherHolder(null,buildUrl(thriftClientInfo),thriftClientInfo.getUsername(),thriftClientInfo.getPassword());
      dataPublisherHolders.add(aNode);
      ReceiverGroup group=new ReceiverGroup(dataPublisherHolders);
      receiverGroups.add(group);
    }
  }
  return receiverGroups;
}
Program: 115453
Project: 115453
Buggy source:
/** 
 * Remove a Kubernetes host.
 * @param groupId
 * @throws NonExistingKubernetesClusterException
 */
public boolean removeKubernetesCluster(String groupId) throws NonExistingKubernetesClusterException ;

Fixed version (ground truth):
/** 
 * Remove a Kubernetes host.
 * @param groupId
 * @throws NonExistingKubernetesClusterException
 */
public boolean removeKubernetesCluster(String groupId) throws NonExistingKubernetesClusterException, KubernetesClusterAlreadyUsedException ;
Program: 115455
Project: 115455
Buggy source:
public void undeployKubernetesCluster(String kubernetesClusterId) throws RemoteException, CloudControllerServiceNonExistingKubernetesClusterExceptionException {
  stub.removeKubernetesCluster(kubernetesClusterId);
}

Fixed version (ground truth):
public void undeployKubernetesCluster(String kubernetesClusterId) throws RemoteException, CloudControllerServiceNonExistingKubernetesClusterExceptionException, CloudControllerServiceKubernetesClusterAlreadyUsedExceptionException {
  stub.removeKubernetesCluster(kubernetesClusterId);
}
Program: 115456
Project: 115456
Buggy source:
@Override protected void restoreState(Object[] data){
  window.restoreState(data);
  window.reSchedule();
}

Fixed version (ground truth):
@Override protected void restoreState(Object[] data){
  window.restoreState((Object[])data[0]);
  window.reSchedule();
}
Program: 115457
Project: 115457
Buggy source:
@Override protected void restoreState(Object[] data){
  window.restoreState(data);
  oldEventList=((ArrayList<RemoveEvent>)data[1]);
  newEventList=((ArrayList<InEvent>)data[2]);
  window.reSchedule();
}

Fixed version (ground truth):
@Override protected void restoreState(Object[] data){
  window.restoreState((Object[])data[0]);
  oldEventList=((ArrayList<RemoveEvent>)data[1]);
  newEventList=((ArrayList<InEvent>)data[2]);
  window.reSchedule();
}
Program: 115458
Project: 115458
Buggy source:
@Override protected void restoreState(Object[] data){
  window.restoreState(data);
  oldEventList=((ArrayList<RemoveEvent>)data[1]);
  newEventList=((ArrayList<InEvent>)data[2]);
  window.reSchedule();
}

Fixed version (ground truth):
@Override protected void restoreState(Object[] data){
  window.restoreState((Object[])data[0]);
  oldEventList=((ArrayList<RemoveEvent>)data[1]);
  newEventList=((ArrayList<InEvent>)data[2]);
  window.reSchedule();
}
Program: 115459
Project: 115459
Buggy source:
/** 
 * Set executor service and invoke execute() method to start the load balancer extension.
 */
public void execute(){
  try {
    if (log.isInfoEnabled()) {
      log.info("String_Node_Str");
    }
    startTopologyEventReceiver(executorService,topologyProvider);
    startApplicationSignUpEventReceiver(executorService,topologyProvider);
    startDomainMappingEventReceiver(executorService,topologyProvider);
    if (statsReader != null) {
      statisticsNotifier=new LoadBalancerStatisticsNotifier(statsReader,topologyProvider);
      Thread statsNotifierThread=new Thread(statisticsNotifier);
      statsNotifierThread.start();
    }
 else {
      if (log.isWarnEnabled()) {
        log.warn("String_Node_Str");
      }
    }
    log.info("String_Node_Str");
  }
 catch (  Exception e) {
    if (log.isErrorEnabled()) {
      log.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Set executor service and invoke execute() method to start the load balancer extension.
 */
public void execute(){
  try {
    if (log.isInfoEnabled()) {
      log.info("String_Node_Str");
    }
    startTopologyEventReceiver(executorService,topologyProvider);
    startApplicationEventReceiver(executorService);
    startApplicationSignUpEventReceiver(executorService,topologyProvider);
    startDomainMappingEventReceiver(executorService,topologyProvider);
    if (statsReader != null) {
      statisticsNotifier=new LoadBalancerStatisticsNotifier(statsReader,topologyProvider);
      Thread statsNotifierThread=new Thread(statisticsNotifier);
      statsNotifierThread.start();
    }
 else {
      if (log.isWarnEnabled()) {
        log.warn("String_Node_Str");
      }
    }
    log.info("String_Node_Str");
  }
 catch (  Exception e) {
    if (log.isErrorEnabled()) {
      log.error("String_Node_Str",e);
    }
  }
}
Program: 115466
Project: 115466
Buggy source:
@Override public void terminateInstance(MemberContext memberContext) throws InvalidCartridgeTypeException, InvalidMemberException, MemberTerminationFailedException {
  terminateContainer(memberContext.getMemberId());
}

Fixed version (ground truth):
@Override public void terminateInstance(MemberContext memberContext) throws InvalidCartridgeTypeException, InvalidMemberException, MemberTerminationFailedException {
  terminateContainer(memberContext);
}
Program: 115470
Project: 115470
Buggy source:
@Override public void initialize(){
  GroupStatusActiveProcessor groupStatusActiveProcessor=new GroupStatusActiveProcessor();
  add(groupStatusActiveProcessor);
  GroupStatusTerminatedProcessor groupStatusTerminatedProcessor=new GroupStatusTerminatedProcessor();
  add(groupStatusTerminatedProcessor);
  GroupStatusTerminatingProcessor groupStatusTerminatingProcessor=new GroupStatusTerminatingProcessor();
  add(groupStatusTerminatingProcessor);
  GroupStatusInactiveProcessor groupStatusInactiveProcessor=new GroupStatusInactiveProcessor();
  add(groupStatusInactiveProcessor);
}

Fixed version (ground truth):
@Override public void initialize(){
  GroupStatusActiveProcessor groupStatusActiveProcessor=new GroupStatusActiveProcessor();
  add(groupStatusActiveProcessor);
  GroupStatusTerminatedProcessor groupStatusTerminatedProcessor=new GroupStatusTerminatedProcessor();
  add(groupStatusTerminatedProcessor);
  GroupStatusInactiveProcessor groupStatusInactiveProcessor=new GroupStatusInactiveProcessor();
  add(groupStatusInactiveProcessor);
}
Program: 115472
Project: 115472
Buggy source:
public boolean write(Topology topology){
  StringBuilder globalParameters=new StringBuilder();
  globalParameters.append("String_Node_Str");
  globalParameters.append(statsSocketFilePath);
  StringBuilder frontendCollection=new StringBuilder();
  StringBuilder backendCollection=new StringBuilder();
  for (  Service service : topology.getServices()) {
    for (    Cluster cluster : service.getClusters()) {
      createConfig(service,cluster,frontendCollection,backendCollection);
    }
  }
  VelocityEngine ve=new VelocityEngine();
  ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH,templatePath);
  ve.init();
  Template t=ve.getTemplate(templateName);
  VelocityContext context=new VelocityContext();
  context.put("String_Node_Str",globalParameters.toString());
  context.put("String_Node_Str",frontendCollection.toString());
  context.put("String_Node_Str",backendCollection.toString());
  StringWriter stringWriter=new StringWriter();
  t.merge(context,stringWriter);
  String configuration=stringWriter.toString();
  try {
    BufferedWriter writer=new BufferedWriter(new FileWriter(confFilePath));
    writer.write(configuration);
    writer.close();
    if (log.isInfoEnabled()) {
      log.info(String.format("String_Node_Str",confFilePath));
    }
    return true;
  }
 catch (  IOException e) {
    if (log.isErrorEnabled()) {
      log.error(String.format("String_Node_Str",confFilePath));
    }
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public boolean write(Topology topology){
  StringBuilder globalParameters=new StringBuilder();
  globalParameters.append("String_Node_Str");
  globalParameters.append(statsSocketFilePath);
  StringBuilder frontendCollection=new StringBuilder();
  StringBuilder backendCollection=new StringBuilder();
  for (  Service service : topology.getServices()) {
    for (    Cluster cluster : service.getClusters()) {
      createConfig(cluster,frontendCollection,backendCollection);
    }
  }
  VelocityEngine ve=new VelocityEngine();
  ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH,templatePath);
  ve.init();
  Template t=ve.getTemplate(templateName);
  VelocityContext context=new VelocityContext();
  context.put("String_Node_Str",globalParameters.toString());
  context.put("String_Node_Str",frontendCollection.toString());
  context.put("String_Node_Str",backendCollection.toString());
  StringWriter stringWriter=new StringWriter();
  t.merge(context,stringWriter);
  String configuration=stringWriter.toString();
  try {
    BufferedWriter writer=new BufferedWriter(new FileWriter(confFilePath));
    writer.write(configuration);
    writer.close();
    if (log.isInfoEnabled()) {
      log.info(String.format("String_Node_Str",confFilePath));
    }
    return true;
  }
 catch (  IOException e) {
    if (log.isErrorEnabled()) {
      log.error(String.format("String_Node_Str",confFilePath));
    }
    throw new RuntimeException(e);
  }
}
Program: 115473
Project: 115473
Buggy source:
public void terminateInstance(String instanceId){
  try {
    if (log.isDebugEnabled()) {
      log.debug(String.format("String_Node_Str",instanceId));
    }
    URI uri=new URIBuilder(endpoint + INSTANCES_CONTEXT + instanceId).build();
    HttpResponse response=restClient.doDelete(uri);
    if (response != null) {
      if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
        return;
      }
 else {
        GsonBuilder gsonBuilder=new GsonBuilder();
        Gson gson=gsonBuilder.create();
        ErrorResponse errorResponse=gson.fromJson(response.getContent(),ErrorResponse.class);
        if (errorResponse != null) {
          throw new RuntimeException(errorResponse.getErrorMessage());
        }
      }
    }
    throw new RuntimeException("String_Node_Str");
  }
 catch (  Exception e) {
    String message="String_Node_Str";
    throw new RuntimeException(message,e);
  }
}

Fixed version (ground truth):
public boolean terminateInstance(String instanceId){
  try {
    if (log.isDebugEnabled()) {
      log.debug(String.format("String_Node_Str",instanceId));
    }
    URI uri=new URIBuilder(endpoint + INSTANCES_CONTEXT + instanceId).build();
    HttpResponse response=restClient.doDelete(uri);
    if (response != null) {
      if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
        return false;
      }
 else {
        GsonBuilder gsonBuilder=new GsonBuilder();
        Gson gson=gsonBuilder.create();
        ErrorResponse errorResponse=gson.fromJson(response.getContent(),ErrorResponse.class);
        if (errorResponse != null) {
          throw new RuntimeException(errorResponse.getErrorMessage());
        }
      }
    }
    throw new RuntimeException("String_Node_Str");
  }
 catch (  Exception e) {
    String message="String_Node_Str";
    throw new RuntimeException(message,e);
  }
}
Program: 115476
Project: 115476
Buggy source:
public boolean write(Topology topology){
  StringBuilder configurationBuilder=new StringBuilder();
  for (  Service service : topology.getServices()) {
    for (    Cluster cluster : service.getClusters()) {
      if ((service.getPorts() == null) || (service.getPorts().size() == 0)) {
        throw new RuntimeException(String.format("String_Node_Str",service.getServiceName()));
      }
      generateConfigurationForCluster(cluster,service.getPorts(),configurationBuilder);
    }
  }
  VelocityEngine ve=new VelocityEngine();
  ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH,templatePath);
  ve.init();
  Template t=ve.getTemplate(templateName);
  VelocityContext context=new VelocityContext();
  context.put("String_Node_Str",configurationBuilder.toString());
  StringWriter stringWriter=new StringWriter();
  t.merge(context,stringWriter);
  String configuration=stringWriter.toString();
  try {
    BufferedWriter writer=new BufferedWriter(new FileWriter(confFilePath));
    writer.write(configuration);
    writer.close();
    if (log.isInfoEnabled()) {
      log.info(String.format("String_Node_Str",confFilePath));
    }
    return true;
  }
 catch (  IOException e) {
    if (log.isErrorEnabled()) {
      log.error(String.format("String_Node_Str",confFilePath));
    }
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public boolean write(Topology topology){
  StringBuilder configurationBuilder=new StringBuilder();
  for (  Service service : topology.getServices()) {
    for (    Cluster cluster : service.getClusters()) {
      generateConfigurationForCluster(cluster,configurationBuilder);
    }
  }
  VelocityEngine ve=new VelocityEngine();
  ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH,templatePath);
  ve.init();
  Template t=ve.getTemplate(templateName);
  VelocityContext context=new VelocityContext();
  context.put("String_Node_Str",configurationBuilder.toString());
  StringWriter stringWriter=new StringWriter();
  t.merge(context,stringWriter);
  String configuration=stringWriter.toString();
  try {
    BufferedWriter writer=new BufferedWriter(new FileWriter(confFilePath));
    writer.write(configuration);
    writer.close();
    if (log.isInfoEnabled()) {
      log.info(String.format("String_Node_Str",confFilePath));
    }
    return true;
  }
 catch (  IOException e) {
    if (log.isErrorEnabled()) {
      log.error(String.format("String_Node_Str",confFilePath));
    }
    throw new RuntimeException(e);
  }
}
Program: 115478
Project: 115478
Buggy source:
public boolean write(Topology topology){
  StringBuilder configurationBuilder=new StringBuilder();
  StringBuilder virtualIPBuilder=new StringBuilder();
  String state;
  for (  Service service : topology.getServices()) {
    for (    Cluster cluster : service.getClusters()) {
      if ((service.getPorts() == null) || (service.getPorts().size() == 0)) {
        throw new RuntimeException(String.format("String_Node_Str",service.getServiceName()));
      }
      generateConfigurationForCluster(cluster,service.getPorts(),configurationBuilder,virtualIPBuilder,virtualIPsForServices,scheduleAlgo,isKeepAlived);
    }
  }
  VelocityEngine ve=new VelocityEngine();
  ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH,templatePath);
  ve.init();
  Template t=ve.getTemplate(templateName);
  VelocityContext context=new VelocityContext();
  context.put("String_Node_Str",configurationBuilder.toString());
  context.put("String_Node_Str",virtualIPBuilder.toString());
  context.put("String_Node_Str",serverState);
  StringWriter stringWriter=new StringWriter();
  t.merge(context,stringWriter);
  String configuration=stringWriter.toString();
  try {
    BufferedWriter writer=new BufferedWriter(new FileWriter(confFilePath));
    writer.write(configuration);
    writer.close();
    if (log.isInfoEnabled()) {
      log.info(String.format("String_Node_Str",confFilePath));
    }
    return true;
  }
 catch (  IOException e) {
    if (log.isErrorEnabled()) {
      log.error(String.format("String_Node_Str",confFilePath));
    }
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public boolean write(Topology topology){
  StringBuilder configurationBuilder=new StringBuilder();
  StringBuilder virtualIPBuilder=new StringBuilder();
  String state;
  for (  Service service : topology.getServices()) {
    for (    Cluster cluster : service.getClusters()) {
      generateConfigurationForCluster(cluster,configurationBuilder,virtualIPBuilder,virtualIPsForServices,scheduleAlgo,isKeepAlived);
    }
  }
  VelocityEngine ve=new VelocityEngine();
  ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH,templatePath);
  ve.init();
  Template t=ve.getTemplate(templateName);
  VelocityContext context=new VelocityContext();
  context.put("String_Node_Str",configurationBuilder.toString());
  context.put("String_Node_Str",virtualIPBuilder.toString());
  context.put("String_Node_Str",serverState);
  StringWriter stringWriter=new StringWriter();
  t.merge(context,stringWriter);
  String configuration=stringWriter.toString();
  try {
    BufferedWriter writer=new BufferedWriter(new FileWriter(confFilePath));
    writer.write(configuration);
    writer.close();
    if (log.isInfoEnabled()) {
      log.info(String.format("String_Node_Str",confFilePath));
    }
    return true;
  }
 catch (  IOException e) {
    if (log.isErrorEnabled()) {
      log.error(String.format("String_Node_Str",confFilePath));
    }
    throw new RuntimeException(e);
  }
}
Program: 115481
Project: 115481
Buggy source:
@Override public PartitionContext getNextScaleDownPartitionContext(PartitionContext[] partitionContexts){
  if (partitionContexts == null) {
    return null;
  }
  int selectedIndex=0;
  int highestInstanceCount=partitionContexts[0].getNonTerminatedMemberCount();
  for (int partitionIndex=partitionContexts.length - 1; partitionIndex >= 0; partitionIndex--) {
    if (partitionContexts[partitionIndex].getNonTerminatedMemberCount() > highestInstanceCount && !partitionContexts[partitionIndex].isObsoletePartition()) {
      highestInstanceCount=partitionContexts[partitionIndex].getNonTerminatedMemberCount();
      selectedIndex=partitionIndex;
    }
  }
  if (partitionContexts[selectedIndex].getNonTerminatedMemberCount() < partitionContexts[selectedIndex].getMax()) {
    if (log.isDebugEnabled()) {
      log.debug(String.format("String_Node_Str" + "String_Node_Str",partitionContexts[selectedIndex].getPartitionId(),partitionContexts[selectedIndex].getNonTerminatedMemberCount()));
    }
    return partitionContexts[selectedIndex];
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public PartitionContext getNextScaleDownPartitionContext(PartitionContext[] partitionContexts){
  if (partitionContexts == null) {
    return null;
  }
  int selectedIndex=0;
  int highestInstanceCount=partitionContexts[0].getNonTerminatedMemberCount();
  for (int partitionIndex=partitionContexts.length - 1; partitionIndex >= 0; partitionIndex--) {
    if (partitionContexts[partitionIndex].getNonTerminatedMemberCount() > highestInstanceCount && !partitionContexts[partitionIndex].isObsoletePartition()) {
      highestInstanceCount=partitionContexts[partitionIndex].getNonTerminatedMemberCount();
      selectedIndex=partitionIndex;
    }
  }
  if (partitionContexts[selectedIndex].getNonTerminatedMemberCount() <= partitionContexts[selectedIndex].getMax()) {
    if (log.isDebugEnabled()) {
      log.debug(String.format("String_Node_Str" + "String_Node_Str",partitionContexts[selectedIndex].getPartitionId(),partitionContexts[selectedIndex].getNonTerminatedMemberCount()));
    }
    return partitionContexts[selectedIndex];
  }
 else {
    return null;
  }
}
Program: 115482
Project: 115482
Buggy source:
private void assertCreationOfNodes(String firstNodeId,String secondNodeId){
  Map<String,Long> activeMembers=TopologyHandler.getInstance().getActivateddMembers();
  Map<String,Long> createdMembers=TopologyHandler.getInstance().getCreatedMembers();
  assertTrue(activeMembers.containsKey(firstNodeId));
  assertTrue(createdMembers.containsKey(secondNodeId));
  assertTrue(createdMembers.get(secondNodeId) > activeMembers.get(firstNodeId));
}

Fixed version (ground truth):
private void assertCreationOfNodes(String firstNodeId,String secondNodeId){
  long startTime=System.currentTimeMillis();
  Map<String,Long> activeMembers=TopologyHandler.getInstance().getActivateddMembers();
  Map<String,Long> createdMembers=TopologyHandler.getInstance().getCreatedMembers();
  while (!activeMembers.containsKey(firstNodeId)) {
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
    }
    activeMembers=TopologyHandler.getInstance().getActivateddMembers();
    if ((System.currentTimeMillis() - startTime) > GROUP_ACTIVE_TIMEOUT) {
      break;
    }
  }
  assertTrue(activeMembers.containsKey(firstNodeId));
  while (!createdMembers.containsKey(secondNodeId)) {
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
    }
    createdMembers=TopologyHandler.getInstance().getCreatedMembers();
    if ((System.currentTimeMillis() - startTime) > GROUP_ACTIVE_TIMEOUT) {
      break;
    }
  }
  assertTrue(createdMembers.containsKey(secondNodeId));
  assertTrue(createdMembers.get(secondNodeId) > activeMembers.get(firstNodeId));
}
Program: 115484
Project: 115484
Buggy source:
/** 
 * Find Cartridges In ServiceGroup
 * @param serviceGroup serviceGroup
 * @param cartridgeNames   List of cartridges
 */
private static void findCartridgesInServiceGroup(ServiceGroup serviceGroup,List<String> cartridgeNames) throws RemoteException, CloudControllerServiceCartridgeNotFoundExceptionException {
  if (serviceGroup == null || cartridgeNames == null) {
    return;
  }
  String cartridgeUuid;
  PrivilegedCarbonContext carbonContext=PrivilegedCarbonContext.getThreadLocalCarbonContext();
  if (serviceGroup.getCartridges() != null) {
    for (    String cartridgeName : serviceGroup.getCartridges()) {
      cartridgeUuid=CloudControllerServiceClient.getInstance().getCartridgeByTenant(cartridgeName,carbonContext.getTenantId()).getUuid();
      if (cartridgeName != null && (!cartridgeNames.contains(cartridgeName))) {
        cartridgeNames.add(cartridgeUuid);
      }
    }
  }
  if (serviceGroup.getGroups() != null) {
    for (    ServiceGroup seGroup : serviceGroup.getGroups()) {
      findCartridgesInServiceGroup(seGroup,cartridgeNames);
    }
  }
}

Fixed version (ground truth):
/** 
 * Find Cartridges In ServiceGroup
 * @param serviceGroup serviceGroup
 * @param cartridgeNames   List of cartridges
 */
private static void findCartridgesInServiceGroup(ServiceGroup serviceGroup,List<String> cartridgeNames) throws RemoteException, CloudControllerServiceCartridgeNotFoundExceptionException {
  if (serviceGroup == null || cartridgeNames == null) {
    return;
  }
  String cartridgeUuid;
  PrivilegedCarbonContext carbonContext=PrivilegedCarbonContext.getThreadLocalCarbonContext();
  if (serviceGroup.getCartridges().length > 0) {
    for (    String cartridgeName : serviceGroup.getCartridges()) {
      if (cartridgeName != null && (!cartridgeNames.contains(cartridgeName))) {
        cartridgeUuid=CloudControllerServiceClient.getInstance().getCartridgeByTenant(cartridgeName,carbonContext.getTenantId()).getUuid();
        cartridgeNames.add(cartridgeUuid);
      }
    }
  }
  if (serviceGroup.getGroups() != null) {
    for (    ServiceGroup seGroup : serviceGroup.getGroups()) {
      findCartridgesInServiceGroup(seGroup,cartridgeNames);
    }
  }
}
Program: 115485
Project: 115485
Buggy source:
@Override public Cartridge getCartridgeByTenant(String cartridgeType,int tenantId) throws CartridgeNotFoundException {
  Collection<Cartridge> cartridges=CloudControllerContext.getInstance().getCartridges();
  if (cartridges == null || cartridges.size() == 0) {
    log.info("String_Node_Str");
    return null;
  }
  for (  Cartridge cartridge : cartridges) {
    if (log.isDebugEnabled()) {
      log.debug(cartridge);
    }
    if (cartridge.getType().equals(cartridgeType) && (cartridge.getTenantId() == tenantId)) {
      return cartridge;
    }
  }
  String msg="String_Node_Str" + cartridgeType + tenantId;
  throw new CartridgeNotFoundException(msg);
}

Fixed version (ground truth):
@Override public Cartridge getCartridgeByTenant(String cartridgeType,int tenantId) throws CartridgeNotFoundException {
  Collection<Cartridge> cartridges=CloudControllerContext.getInstance().getCartridges();
  if (cartridges == null || cartridges.size() == 0) {
    log.info("String_Node_Str");
    return null;
  }
  for (  Cartridge cartridge : cartridges) {
    if (log.isDebugEnabled()) {
      log.debug(cartridge);
    }
    if (cartridge.getType().equals(cartridgeType) && (cartridge.getTenantId() == tenantId)) {
      return cartridge;
    }
  }
  String msg="String_Node_Str" + cartridgeType;
  throw new CartridgeNotFoundException(msg);
}