nus-yam/ex-repair huggingface dataset:
Program: 48511
Project: 48511
Buggy source:
@Override public boolean poll(){
  Long requestId=apiBootstrap.getRequestId();
  logger.info("String_Node_Str" + requestId + "String_Node_Str");
  ApiBootstrapStatus apiBootstrapStatus=apiManager.getBootstrapStatus(requestId);
  int registeredHostsCount=0;
  ApiHostList apiHostList=apiManager.getRegisteredHosts();
  for (  ApiBootstrapHostStatus apiBootstrapHostStatus : apiBootstrapStatus.getApiBootstrapHostStatus()) {
    for (    ApiHost apiHost : apiHostList.getApiHosts()) {
      if (apiHost.getApiHostInfo().getHostName().equals(apiBootstrapHostStatus.getHostName())) {
        registeredHostsCount++;
      }
    }
  }
  int bootstrapedHostCount=apiBootstrapStatus.getApiBootstrapHostStatus().size();
  BootstrapStatus bootstrapStatus=BootstrapStatus.valueOf(apiBootstrapStatus.getStatus());
  if (bootstrapStatus.isCompletedState() && bootstrapedHostCount == registeredHostsCount) {
    currentReport.setProgress(endProgress);
    reportQueue.addClusterReport(currentReport.clone());
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean poll(){
  Long requestId=apiBootstrap.getRequestId();
  logger.info("String_Node_Str" + requestId + "String_Node_Str");
  ApiBootstrapStatus apiBootstrapStatus=apiManager.getBootstrapStatus(requestId);
  if (apiBootstrapStatus.getApiBootstrapHostStatus() == null) {
    return false;
  }
  int registeredHostsCount=0;
  ApiHostList apiHostList=apiManager.getRegisteredHosts();
  for (  ApiBootstrapHostStatus apiBootstrapHostStatus : apiBootstrapStatus.getApiBootstrapHostStatus()) {
    for (    ApiHost apiHost : apiHostList.getApiHosts()) {
      if (apiHost.getApiHostInfo().getHostName().equals(apiBootstrapHostStatus.getHostName())) {
        registeredHostsCount++;
      }
    }
  }
  int bootstrapedHostCount=apiBootstrapStatus.getApiBootstrapHostStatus().size();
  BootstrapStatus bootstrapStatus=BootstrapStatus.valueOf(apiBootstrapStatus.getStatus());
  if (bootstrapStatus.isFailedState() || (bootstrapStatus.isSucceedState() && bootstrapedHostCount == registeredHostsCount)) {
    if (bootstrapStatus.isFailedState()) {
      Map<String,NodeReport> nodeReports=currentReport.getNodeReports();
      for (      String nodeReportKey : nodeReports.keySet()) {
        for (        ApiBootstrapHostStatus apiBootstrapHostStatus : apiBootstrapStatus.getApiBootstrapHostStatus()) {
          if (Constants.HOST_BOOTSTRAP_FAILED.equals(apiBootstrapHostStatus.getStatus())) {
            NodeReport nodeReport=nodeReports.get(nodeReportKey);
            nodeReport.setUseClusterMsg(false);
            nodeReport.setAction("String_Node_Str");
            if (nodeReport.getHostname().equals(apiBootstrapHostStatus.getHostName())) {
              nodeReport.setErrMsg(apiBootstrapHostStatus.getLog());
            }
          }
        }
      }
    }
    currentReport.setProgress(endProgress);
    reportQueue.addClusterReport(currentReport.clone());
    return true;
  }
  return false;
}
Program: 48512
Project: 48512
Buggy source:
@Override public boolean createCluster(ClusterBlueprint blueprint,ClusterReportQueue reportQueue) throws SoftwareManagementPluginException {
  boolean success=false;
  AmClusterDef clusterDef=null;
  try {
    logger.info("String_Node_Str");
    logger.info(ApiUtils.objectToJson(blueprint));
    logger.info("String_Node_Str" + blueprint.getName() + "String_Node_Str");
    clusterDef=new AmClusterDef(blueprint,privateKey);
    provisionCluster(clusterDef,reportQueue);
    success=true;
    Map<String,NodeReport> nodeReports=clusterDef.getCurrentReport().getNodeReports();
    for (    String nodeReportKey : nodeReports.keySet()) {
      nodeReports.get(nodeReportKey).setUseClusterMsg(true);
    }
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    clusterDef.getCurrentReport().setProgress(ProgressSplit.PROVISION_SUCCESS.getProgress());
    clusterDef.getCurrentReport().setSuccess(true);
  }
 catch (  Exception e) {
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    clusterDef.getCurrentReport().setSuccess(false);
    String errorMessage=errorMessage("String_Node_Str" + blueprint.getName(),e);
    logger.error(errorMessage);
    throw SoftwareManagementPluginException.CREATE_CLUSTER_EXCEPTION(e,AMBARI,blueprint.getName());
  }
 finally {
    clusterDef.getCurrentReport().setFinished(true);
    reportStatus(clusterDef.getCurrentReport(),reportQueue);
  }
  return success;
}

Fixed version (ground truth):
@Override public boolean createCluster(ClusterBlueprint blueprint,ClusterReportQueue reportQueue) throws SoftwareManagementPluginException {
  boolean success=false;
  AmClusterDef clusterDef=null;
  try {
    logger.info("String_Node_Str");
    logger.info(ApiUtils.objectToJson(blueprint));
    logger.info("String_Node_Str" + blueprint.getName() + "String_Node_Str");
    clusterDef=new AmClusterDef(blueprint,privateKey);
    provisionCluster(clusterDef,reportQueue);
    success=true;
    Map<String,NodeReport> nodeReports=clusterDef.getCurrentReport().getNodeReports();
    for (    String nodeReportKey : nodeReports.keySet()) {
      nodeReports.get(nodeReportKey).setUseClusterMsg(true);
    }
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    clusterDef.getCurrentReport().setProgress(ProgressSplit.PROVISION_SUCCESS.getProgress());
    clusterDef.getCurrentReport().setSuccess(true);
  }
 catch (  Exception e) {
    clusterDef.getCurrentReport().setSuccess(false);
    String errorMessage=errorMessage("String_Node_Str" + blueprint.getName(),e);
    logger.error(errorMessage);
    throw SoftwareManagementPluginException.CREATE_CLUSTER_EXCEPTION(e,AMBARI,blueprint.getName());
  }
 finally {
    clusterDef.getCurrentReport().setFinished(true);
    reportStatus(clusterDef.getCurrentReport(),reportQueue);
  }
  return success;
}
Program: 48514
Project: 48514
Buggy source:
@Override public boolean poll(){
  Long requestId=apiBootstrap.getRequestId();
  logger.info("String_Node_Str" + requestId + "String_Node_Str");
  ApiBootstrapStatus apiBootstrapStatus=apiManager.getBootstrapStatus(requestId);
  BootstrapStatus bootstrapStatus=BootstrapStatus.valueOf(apiBootstrapStatus.getStatus());
  if (bootstrapStatus.isCompletedState()) {
    currentReport.setProgress(endProgress);
    reportQueue.addClusterReport(currentReport.clone());
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean poll(){
  Long requestId=apiBootstrap.getRequestId();
  logger.info("String_Node_Str" + requestId + "String_Node_Str");
  ApiBootstrapStatus apiBootstrapStatus=apiManager.getBootstrapStatus(requestId);
  int registeredHostsCount=0;
  ApiHostList apiHostList=apiManager.getRegisteredHosts();
  for (  ApiBootstrapHostStatus apiBootstrapHostStatus : apiBootstrapStatus.getApiBootstrapHostStatus()) {
    for (    ApiHost apiHost : apiHostList.getApiHosts()) {
      if (apiHost.getApiHostInfo().getHostName().equals(apiBootstrapHostStatus.getHostName())) {
        registeredHostsCount++;
      }
    }
  }
  int bootstrapedHostCount=apiBootstrapStatus.getApiBootstrapHostStatus().size();
  BootstrapStatus bootstrapStatus=BootstrapStatus.valueOf(apiBootstrapStatus.getStatus());
  if (bootstrapStatus.isCompletedState() && bootstrapedHostCount == registeredHostsCount) {
    currentReport.setProgress(endProgress);
    reportQueue.addClusterReport(currentReport.clone());
    return true;
  }
  return false;
}
Program: 48516
Project: 48516
Buggy source:
private static HDFS_VERSION getDefaultHdfsVersion(String vendor,String distroVersion){
  if (vendor.trim().equalsIgnoreCase(Constants.HDP_VENDOR)) {
    if (distroVersion.startsWith("String_Node_Str")) {
      return HDFS_VERSION.V2;
    }
 else {
      return HDFS_VERSION.V1;
    }
  }
  logger.error("String_Node_Str");
  return HDFS_VERSION.V2;
}

Fixed version (ground truth):
private static HDP_VERSION getDefaultHdfsVersion(String vendor,String distroVersion){
  if (vendor.trim().equalsIgnoreCase(Constants.HDP_VENDOR)) {
    if (distroVersion.startsWith("String_Node_Str")) {
      return HDP_VERSION.V2_1;
    }
 else     if (distroVersion.startsWith("String_Node_Str")) {
      return HDP_VERSION.V2_0;
    }
 else {
      return HDP_VERSION.V1;
    }
  }
  logger.error("String_Node_Str");
  return HDP_VERSION.V2_1;
}
Program: 48520
Project: 48520
Buggy source:
private boolean isNamenodeHa(Set<String> allRoles){
  boolean isNamenodeHa=false;
  int nameNodesCount=0;
  for (  String role : allRoles) {
    ComponentName componentName=ComponentName.valueOf(role);
    if (componentName.isNamenode()) {
      nameNodesCount++;
    }
  }
  if (nameNodesCount > 1) {
    isNamenodeHa=true;
  }
  return isNamenodeHa;
}

Fixed version (ground truth):
private boolean isNamenodeHa(Set<String> allRoles,List<String> unRecogRoles){
  boolean isNamenodeHa=false;
  int nameNodesCount=0;
  for (  String role : allRoles) {
    if (unRecogRoles != null && unRecogRoles.contains(role)) {
      continue;
    }
    ComponentName componentName=ComponentName.valueOf(role);
    if (componentName.isNamenode()) {
      nameNodesCount++;
    }
  }
  if (nameNodesCount > 1) {
    isNamenodeHa=true;
  }
  return isNamenodeHa;
}
Program: 48522
Project: 48522
Buggy source:
@Override public boolean createCluster(ClusterBlueprint blueprint,ClusterReportQueue reportQueue) throws SoftwareManagementPluginException {
  boolean success=false;
  CmClusterDef clusterDef=null;
  try {
    clusterDef=new CmClusterDef(blueprint);
    provisionCluster(clusterDef,null,reportQueue);
    provisionParcels(clusterDef,null,reportQueue);
    configureServices(clusterDef,reportQueue,true);
    startServices(clusterDef,reportQueue,true);
    success=true;
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    clusterDef.getCurrentReport().setProgress(100);
    clusterDef.getCurrentReport().setSuccess(true);
  }
 catch (  SoftwareManagementPluginException ex) {
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    clusterDef.getCurrentReport().setSuccess(false);
    throw ex;
  }
catch (  Exception e) {
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    clusterDef.getCurrentReport().setSuccess(false);
    logger.error(e.getMessage());
    throw SoftwareManagementPluginException.CREATE_CLUSTER_EXCEPTION(e,CLOUDERA_MANAGER,clusterDef.getName());
  }
 finally {
    clusterDef.getCurrentReport().setFinished(true);
    reportQueue.addClusterReport(clusterDef.getCurrentReport().clone());
  }
  return success;
}

Fixed version (ground truth):
@Override public boolean createCluster(ClusterBlueprint blueprint,ClusterReportQueue reportQueue) throws SoftwareManagementPluginException {
  boolean success=false;
  CmClusterDef clusterDef=null;
  try {
    clusterDef=new CmClusterDef(blueprint);
    validateBlueprint(blueprint);
    provisionCluster(clusterDef,null,reportQueue);
    provisionParcels(clusterDef,null,reportQueue);
    configureServices(clusterDef,reportQueue,true);
    startServices(clusterDef,reportQueue,true);
    success=true;
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    clusterDef.getCurrentReport().setProgress(100);
    clusterDef.getCurrentReport().setSuccess(true);
  }
 catch (  SoftwareManagementPluginException ex) {
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    clusterDef.getCurrentReport().setSuccess(false);
    throw ex;
  }
catch (  Exception e) {
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    clusterDef.getCurrentReport().setSuccess(false);
    logger.error(e.getMessage());
    throw SoftwareManagementPluginException.CREATE_CLUSTER_EXCEPTION(e,CLOUDERA_MANAGER,clusterDef.getName());
  }
 finally {
    clusterDef.getCurrentReport().setFinished(true);
    reportQueue.addClusterReport(clusterDef.getCurrentReport().clone());
  }
  return success;
}
Program: 48526
Project: 48526
Buggy source:
@Override public boolean echo(){
switch (apiManager.healthCheck()) {
case Constants.HEALTH_STATUS:
    return true;
default :
  return false;
}
}

Fixed version (ground truth):
@Override public boolean echo(){
  try {
switch (apiManager.healthCheck()) {
case Constants.HEALTH_STATUS:
      return true;
default :
    return false;
}
}
 catch (Exception e) {
return false;
}
}
Program: 48528
Project: 48528
Buggy source:
@Override public boolean deleteCluster(ClusterBlueprint clusterBlueprint,ClusterReportQueue reports) throws SoftwareManagementPluginException {
  String clusterName=clusterBlueprint.getName();
  try {
    if (!isProvisioned(clusterName)) {
      return true;
    }
    ApiHostRefList hosts=apiResourceRootV6.getClustersResource().listHosts(clusterName);
    apiResourceRootV6.getClustersResource().deleteCluster(clusterName);
    for (    ApiHostRef host : hosts.getHosts()) {
      apiResourceRootV6.getHostsResource().deleteHost(host.getHostId());
    }
  }
 catch (  Exception e) {
    throw SoftwareManagementPluginException.DELETE_CLUSTER_FAILED(e,CLOUDERA_MANAGER,clusterName);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean deleteCluster(ClusterBlueprint clusterBlueprint,ClusterReportQueue reports) throws SoftwareManagementPluginException {
  String clusterName=clusterBlueprint.getName();
  try {
    if (!echo()) {
      logWarningWhenForceDeleteCluster(clusterName);
      return true;
    }
    if (!isProvisioned(clusterName)) {
      return true;
    }
    ApiHostRefList hosts=apiResourceRootV6.getClustersResource().listHosts(clusterName);
    apiResourceRootV6.getClustersResource().deleteCluster(clusterName);
    for (    ApiHostRef host : hosts.getHosts()) {
      apiResourceRootV6.getHostsResource().deleteHost(host.getHostId());
    }
  }
 catch (  Exception e) {
    throw SoftwareManagementPluginException.DELETE_CLUSTER_FAILED(e,CLOUDERA_MANAGER,clusterName);
  }
  return true;
}
Program: 48529
Project: 48529
Buggy source:
@Override public boolean onDeleteCluster(ClusterBlueprint clusterBlueprint,ClusterReportQueue reports) throws SoftwareManagementPluginException {
  return onStopCluster(clusterBlueprint,reports);
}

Fixed version (ground truth):
@Override public boolean onDeleteCluster(ClusterBlueprint clusterBlueprint,ClusterReportQueue reports) throws SoftwareManagementPluginException {
  if (!echo()) {
    logWarningWhenForceDeleteCluster(clusterBlueprint.getName());
    return true;
  }
  return onStopCluster(clusterBlueprint,reports);
}
Program: 48530
Project: 48530
Buggy source:
@Override public boolean onDeleteCluster(ClusterBlueprint clusterBlueprint,ClusterReportQueue reports) throws SoftwareManagementPluginException {
  return false;
}

Fixed version (ground truth):
@Override public boolean onDeleteCluster(ClusterBlueprint clusterBlueprint,ClusterReportQueue reports) throws SoftwareManagementPluginException {
  return true;
}
Program: 48531
Project: 48531
Buggy source:
public ServiceStatus getClusterStatus(String clusterName) throws AmbariApiException {
  ApiServiceAlertList serviceList=getServicesWithAlert(clusterName);
  if (serviceList.getApiServiceAlerts() != null) {
    boolean allStopped=true;
    boolean hasStartedAlert=false;
    for (    ApiServiceAlert service : serviceList.getApiServiceAlerts()) {
      ApiServiceInfo info=service.getApiServiceInfo();
      ApiAlert alert=service.getApiAlert();
      if (ApiServiceStatus.STARTED.name().equalsIgnoreCase(info.getState())) {
        allStopped=false;
        if (alert != null && alert.getSummary() != null && alert.getSummary().getCritical() > 0) {
          hasStartedAlert=true;
        }
      }
    }
    if (allStopped) {
      return ServiceStatus.STOPPED;
    }
    if (hasStartedAlert) {
      return ServiceStatus.ALERT;
    }
  }
  return ServiceStatus.STARTED;
}

Fixed version (ground truth):
public ServiceStatus getClusterStatus(String clusterName,HadoopStack stack) throws AmbariApiException {
  ApiServiceAlertList serviceList=getServicesWithAlert(clusterName);
  if (serviceList.getApiServiceAlerts() != null) {
    boolean allStopped=true;
    boolean hasStartedAlert=false;
    List<String> notStartedServiceNames=new ArrayList<>();
    for (    ApiServiceAlert service : serviceList.getApiServiceAlerts()) {
      ApiServiceInfo info=service.getApiServiceInfo();
      ApiAlert alert=service.getApiAlert();
      if (ApiServiceStatus.STARTED.name().equalsIgnoreCase(info.getState())) {
        allStopped=false;
        if (alert != null && alert.getSummary() != null && alert.getSummary().getCritical() > 0) {
          hasStartedAlert=true;
        }
      }
 else {
        notStartedServiceNames.add(service.getApiServiceInfo().getServiceName());
      }
    }
    if (allStopped) {
      return ServiceStatus.STOPPED;
    }
    if (notStartedServiceNames.isEmpty()) {
      if (hasStartedAlert) {
        return ServiceStatus.ALERT;
      }
 else {
        return ServiceStatus.STARTED;
      }
    }
    boolean hasStoppedService=hasNonClientServices(stack,notStartedServiceNames);
    if (hasStoppedService) {
      return ServiceStatus.ALERT;
    }
 else {
      return ServiceStatus.STARTED;
    }
  }
  return ServiceStatus.UNKONWN;
}
Program: 48532
Project: 48532
Buggy source:
public ServiceStatus getClusterStatus(String clusterName) throws AmbariApiException ;

Fixed version (ground truth):
public ServiceStatus getClusterStatus(String clusterName,HadoopStack stack) throws AmbariApiException ;
Program: 48533
Project: 48533
Buggy source:
@Override public ClusterReport queryClusterStatus(ClusterBlueprint blueprint){
  AmClusterDef clusterDef=new AmClusterDef(blueprint,privateKey);
  try {
    ServiceStatus status=apiManager.getClusterStatus(blueprint.getName());
    clusterDef.getCurrentReport().setStatus(status);
    Map<String,ServiceStatus> hostStates=apiManager.getHostStatus(blueprint.getName());
    Map<String,NodeReport> nodeReports=clusterDef.getCurrentReport().getNodeReports();
    for (    AmNodeDef node : clusterDef.getNodes()) {
      String fqdn=node.getFqdn();
      nodeReports.get(node.getName()).setStatus(hostStates.get(fqdn));
    }
  }
 catch (  NotFoundException e) {
    logger.info("String_Node_Str" + blueprint.getName() + "String_Node_Str");
    return null;
  }
  return clusterDef.getCurrentReport().clone();
}

Fixed version (ground truth):
@Override public ClusterReport queryClusterStatus(ClusterBlueprint blueprint){
  AmClusterDef clusterDef=new AmClusterDef(blueprint,privateKey);
  try {
    ServiceStatus status=apiManager.getClusterStatus(blueprint.getName(),blueprint.getHadoopStack());
    clusterDef.getCurrentReport().setStatus(status);
    Map<String,ServiceStatus> hostStates=apiManager.getHostStatus(blueprint.getName());
    Map<String,NodeReport> nodeReports=clusterDef.getCurrentReport().getNodeReports();
    for (    AmNodeDef node : clusterDef.getNodes()) {
      String fqdn=node.getFqdn();
      nodeReports.get(node.getName()).setStatus(hostStates.get(fqdn));
    }
  }
 catch (  NotFoundException e) {
    logger.info("String_Node_Str" + blueprint.getName() + "String_Node_Str");
    return null;
  }
  return clusterDef.getCurrentReport().clone();
}
Program: 48535
Project: 48535
Buggy source:
private void handleClusterStatus(String clusterName,ClusterReport report){
  ClusterEntity cluster=findByName(clusterName);
  ClusterStatus oldState=cluster.getStatus();
switch (oldState) {
case RUNNING:
case SERVICE_ERROR:
case SERVICE_WARNING:
switch (report.getStatus()) {
case STARTED:
      cluster.setStatus(ClusterStatus.RUNNING);
    break;
case ALERT:
  cluster.setStatus(ClusterStatus.SERVICE_WARNING);
break;
case STOPPED:
cluster.setStatus(ClusterStatus.SERVICE_ERROR);
break;
default :
break;
}
logger.info("String_Node_Str" + report.getStatus() + "String_Node_Str"+ oldState+ "String_Node_Str"+ cluster.getStatus());
break;
default :
logger.debug("String_Node_Str" + cluster.getStatus() + "String_Node_Str");
break;
}
}

Fixed version (ground truth):
private void handleClusterStatus(String clusterName,ClusterReport report){
  ClusterEntity cluster=findByName(clusterName);
  ClusterStatus oldState=cluster.getStatus();
switch (oldState) {
case RUNNING:
case SERVICE_STOPPED:
case SERVICE_WARNING:
switch (report.getStatus()) {
case STARTED:
      cluster.setStatus(ClusterStatus.RUNNING);
    break;
case ALERT:
  cluster.setStatus(ClusterStatus.SERVICE_WARNING);
break;
case STOPPED:
cluster.setStatus(ClusterStatus.SERVICE_STOPPED);
break;
default :
break;
}
logger.info("String_Node_Str" + report.getStatus() + "String_Node_Str"+ oldState+ "String_Node_Str"+ cluster.getStatus());
break;
default :
logger.debug("String_Node_Str" + cluster.getStatus() + "String_Node_Str");
break;
}
}
Program: 48540
Project: 48540
Buggy source:
public void setVolumns(List<String> volumns,HdfsVersion hdfsVersion){
  for (  String component : components) {
switch (component) {
case "String_Node_Str":
      String dfsNameDir=Constants.CONFIG_DFS_NAMENODE_NAME_DIR;
    if (hdfsVersion.isHdfsV1()) {
      dfsNameDir=Constants.CONFIG_DFS_NAME_DIR;
    }
  addConfiguration(Constants.CONFIG_HDFS_SITE,dfsNameDir,dataDirs(volumns,"String_Node_Str"));
break;
case "String_Node_Str":
String dfsCheckpointDir=Constants.CONFIG_DFS_NAMENODE_CHECKPOINT_DIR;
if (hdfsVersion.isHdfsV1()) {
dfsCheckpointDir=Constants.CONFIG_DFS_CHECKPOINT_DIR;
}
addConfiguration(Constants.CONFIG_HDFS_SITE,dfsCheckpointDir,volumns.get(0) + "String_Node_Str");
break;
case "String_Node_Str":
String dfsDataDir=Constants.CONFIG_DFS_DATANODE_DATA_DIR;
if (hdfsVersion.isHdfsV1()) {
dfsDataDir=Constants.CONFIG_DFS_DATA_DIR;
}
addConfiguration(Constants.CONFIG_HDFS_SITE,dfsDataDir,dataDirs(volumns,"String_Node_Str"));
break;
case "String_Node_Str":
addConfiguration(Constants.CONFIG_YARN_SITE,Constants.CONFIG_YARN_NODEMANAGER_LOCAL_DIRS,dataDirs(volumns,"String_Node_Str"));
break;
case "String_Node_Str":
addConfiguration(Constants.CONFIG_HDFS_SITE,Constants.CONFIG_JOURNALNODE_EDITS_DIR,volumns.get(0) + "String_Node_Str");
break;
case "String_Node_Str":
addConfiguration(Constants.CONFIG_MAPRED_SITE,Constants.CONFIG_MAPRED_LOCAL_DIR,dataDirs(volumns,"String_Node_Str"));
break;
default :
break;
}
}
}

Fixed version (ground truth):
public void setVolumns(List<String> volumns,HdfsVersion hdfsVersion){
  if (volumns.isEmpty()) {
    return;
  }
  for (  String component : components) {
switch (component) {
case "String_Node_Str":
      String dfsNameDir=Constants.CONFIG_DFS_NAMENODE_NAME_DIR;
    if (hdfsVersion.isHdfsV1()) {
      dfsNameDir=Constants.CONFIG_DFS_NAME_DIR;
    }
  addConfiguration(Constants.CONFIG_HDFS_SITE,dfsNameDir,dataDirs(volumns,"String_Node_Str"));
break;
case "String_Node_Str":
String dfsCheckpointDir=Constants.CONFIG_DFS_NAMENODE_CHECKPOINT_DIR;
if (hdfsVersion.isHdfsV1()) {
dfsCheckpointDir=Constants.CONFIG_DFS_CHECKPOINT_DIR;
}
addConfiguration(Constants.CONFIG_HDFS_SITE,dfsCheckpointDir,volumns.get(0) + "String_Node_Str");
break;
case "String_Node_Str":
String dfsDataDir=Constants.CONFIG_DFS_DATANODE_DATA_DIR;
if (hdfsVersion.isHdfsV1()) {
dfsDataDir=Constants.CONFIG_DFS_DATA_DIR;
}
addConfiguration(Constants.CONFIG_HDFS_SITE,dfsDataDir,dataDirs(volumns,"String_Node_Str"));
break;
case "String_Node_Str":
addConfiguration(Constants.CONFIG_YARN_SITE,Constants.CONFIG_YARN_NODEMANAGER_LOCAL_DIRS,dataDirs(volumns,"String_Node_Str"));
break;
case "String_Node_Str":
addConfiguration(Constants.CONFIG_HDFS_SITE,Constants.CONFIG_JOURNALNODE_EDITS_DIR,volumns.get(0) + "String_Node_Str");
break;
case "String_Node_Str":
addConfiguration(Constants.CONFIG_MAPRED_SITE,Constants.CONFIG_MAPRED_LOCAL_DIR,dataDirs(volumns,"String_Node_Str"));
break;
default :
break;
}
}
}
Program: 48545
Project: 48545
Buggy source:
private void queryNodesStatus(CmClusterDef cluster){
  for (  CmNodeDef node : cluster.getNodes()) {
    Map<String,NodeReport> nodeReports=cluster.getCurrentReport().getNodeReports();
    NodeReport nodeReport=nodeReports.get(node.getName());
    try {
      ApiHost host=apiResourceRootV6.getHostsResource().readHost(node.getNodeId());
      ApiHealthSummary health=host.getHealthSummary();
switch (health) {
case GOOD:
        nodeReport.setStatus(ServiceStatus.STARTED);
      logger.debug("String_Node_Str" + nodeReport.getName() + "String_Node_Str");
    break;
case CONCERNING:
  nodeReport.setStatus(ServiceStatus.UNHEALTHY);
logger.debug("String_Node_Str" + nodeReport.getName() + "String_Node_Str");
break;
case BAD:
logger.debug("String_Node_Str" + nodeReport.getName() + "String_Node_Str");
nodeReport.setStatus(ServiceStatus.ALERT);
break;
default :
logger.debug("String_Node_Str" + nodeReport.getName() + "String_Node_Str");
nodeReport.setStatus(ServiceStatus.UNKONWN);
break;
}
}
 catch (NotFoundException e) {
logger.debug("String_Node_Str" + node.getName() + "String_Node_Str");
nodeReport.setStatus(ServiceStatus.FAILED);
}
}
}

Fixed version (ground truth):
private void queryNodesStatus(CmClusterDef cluster){
  for (  CmNodeDef node : cluster.getNodes()) {
    Map<String,NodeReport> nodeReports=cluster.getCurrentReport().getNodeReports();
    NodeReport nodeReport=nodeReports.get(node.getName());
    try {
      ApiHost host=apiResourceRootV6.getHostsResource().readHost(node.getNodeId());
      ApiHealthSummary health=host.getHealthSummary();
switch (health) {
case GOOD:
        List<ApiRoleRef> roleRefs=host.getRoleRefs();
      boolean hasStarted=false;
    boolean hasStopped=false;
  for (  ApiRoleRef roleRef : roleRefs) {
    if (isRoleStarted(roleRef.getClusterName(),roleRef.getServiceName(),roleRef.getRoleName())) {
      hasStarted=true;
    }
 else {
      hasStopped=true;
    }
  }
if (hasStopped && !hasStarted) {
  nodeReport.setStatus(ServiceStatus.STOPPED);
}
 else if (hasStopped && hasStarted) {
  nodeReport.setStatus(ServiceStatus.ALERT);
}
 else if (!hasStopped && hasStarted) {
  nodeReport.setStatus(ServiceStatus.STARTED);
}
 else {
  nodeReport.setStatus(ServiceStatus.STOPPED);
}
logger.debug("String_Node_Str" + nodeReport.getName() + "String_Node_Str");
break;
case CONCERNING:
nodeReport.setStatus(ServiceStatus.UNHEALTHY);
logger.debug("String_Node_Str" + nodeReport.getName() + "String_Node_Str");
break;
case BAD:
logger.debug("String_Node_Str" + nodeReport.getName() + "String_Node_Str");
nodeReport.setStatus(ServiceStatus.ALERT);
break;
default :
logger.debug("String_Node_Str" + nodeReport.getName() + "String_Node_Str");
nodeReport.setStatus(ServiceStatus.UNKONWN);
break;
}
}
 catch (NotFoundException e) {
logger.debug("String_Node_Str" + node.getName() + "String_Node_Str");
nodeReport.setStatus(ServiceStatus.FAILED);
}
}
}
Program: 48548
Project: 48548
Buggy source:
private boolean setupPasswordLessLogin(String hostIP) throws Exception {
  String scriptName=Configuration.getString(Constants.PASSWORDLESS_LOGIN_SCRIPT,Constants.DEFAULT_PASSWORDLESS_LOGIN_SCRIPT);
  String script=getScriptName(scriptName);
  String user=Configuration.getString(Constants.SSH_USER_CONFIG_NAME,Constants.DEFAULT_SSH_USER_NAME);
  String password=Configuration.getString(Constants.SERENGETI_DEFAULT_PASSWORD);
  String cmd=script + "String_Node_Str" + hostIP+ "String_Node_Str"+ user+ "String_Node_Str"+ password;
  int timeoutCount=0;
  for (int i=0; i < Constants.SET_PASSWORD_MAX_RETRY_TIMES; i++) {
    try {
      ShellCommandExecutor.execCmd(cmd,null,null,this.setupPasswordLessLoginTimeout,Constants.MSG_SETTING_UP_PASSWORDLESS_LOGIN + hostIP + "String_Node_Str");
      logger.info("String_Node_Str" + hostIP);
      return true;
    }
 catch (    Exception e) {
      if (e.getMessage().contains(Constants.EXEC_COMMAND_TIMEOUT)) {
        timeoutCount++;
      }
      logger.warn("String_Node_Str" + i + "String_Node_Str"+ e.getMessage(),e);
      try {
        Thread.sleep(3000);
      }
 catch (      InterruptedException ie) {
        logger.warn("String_Node_Str",ie);
      }
    }
  }
  logger.error("String_Node_Str" + hostIP);
  if (timeoutCount == Constants.SET_PASSWORD_MAX_RETRY_TIMES) {
    throw SetPasswordException.SETUP_PASSWORDLESS_LOGIN_TIMEOUT(null,hostIP);
  }
  throw SetPasswordException.FAIL_TO_SETUP_PASSWORDLESS_LOGIN(hostIP);
}

Fixed version (ground truth):
private boolean setupPasswordLessLogin(String hostIP) throws Exception {
  String scriptName=Configuration.getString(Constants.PASSWORDLESS_LOGIN_SCRIPT,Constants.DEFAULT_PASSWORDLESS_LOGIN_SCRIPT);
  String script=getScriptName(scriptName);
  String user=Configuration.getString(Constants.SSH_USER_CONFIG_NAME,Constants.DEFAULT_SSH_USER_NAME);
  String password=Configuration.getString(Constants.SERENGETI_DEFAULT_PASSWORD);
  String cmd=script + "String_Node_Str" + hostIP+ "String_Node_Str"+ user+ "String_Node_Str"+ password;
  int sleepTime=Configuration.getInt(Constants.SSH_SLEEP_TIME_BEFORE_RETRY,Constants.DEFAULT_SSH_SLEEP_TIME_BEFORE_RETRY);
  int timeoutCount=0;
  for (int i=0; i < Constants.SET_PASSWORD_MAX_RETRY_TIMES; i++) {
    try {
      ShellCommandExecutor.execCmd(cmd,null,null,this.setupPasswordLessLoginTimeout,Constants.MSG_SETTING_UP_PASSWORDLESS_LOGIN + hostIP + "String_Node_Str");
      logger.info("String_Node_Str" + hostIP);
      return true;
    }
 catch (    Exception e) {
      if (e.getMessage().contains(Constants.EXEC_COMMAND_TIMEOUT)) {
        timeoutCount++;
      }
      logger.warn("String_Node_Str" + i + "String_Node_Str"+ e.getMessage(),e);
      try {
        Thread.sleep(sleepTime);
      }
 catch (      InterruptedException ie) {
        logger.warn("String_Node_Str",ie);
      }
    }
  }
  logger.error("String_Node_Str" + hostIP);
  if (timeoutCount == Constants.SET_PASSWORD_MAX_RETRY_TIMES) {
    throw SetPasswordException.SETUP_PASSWORDLESS_LOGIN_TIMEOUT(null,hostIP);
  }
  throw SetPasswordException.FAIL_TO_SETUP_PASSWORDLESS_LOGIN(hostIP);
}
Program: 48550
Project: 48550
Buggy source:
private void queryNodesStatus(CmClusterDef cluster){
  for (  CmNodeDef node : cluster.getNodes()) {
    Map<String,NodeReport> nodeReports=cluster.getCurrentReport().getNodeReports();
    NodeReport nodeReport=nodeReports.get(node.getName());
    try {
      ApiHost host=apiResourceRootV6.getHostsResource().readHost(node.getNodeId());
      ApiHealthSummary health=host.getHealthSummary();
switch (health) {
case GOOD:
        nodeReport.setStatus(ServiceStatus.STARTED);
      logger.debug("String_Node_Str" + nodeReport.getName() + "String_Node_Str");
    break;
case CONCERNING:
  nodeReport.setStatus(ServiceStatus.UNHEALTHY);
logger.debug("String_Node_Str" + nodeReport.getName() + "String_Node_Str");
break;
case BAD:
logger.debug("String_Node_Str" + nodeReport.getName() + "String_Node_Str");
nodeReport.setStatus(ServiceStatus.FAILED);
break;
default :
logger.debug("String_Node_Str" + nodeReport.getName() + "String_Node_Str");
nodeReport.setStatus(ServiceStatus.UNKONWN);
break;
}
}
 catch (NotFoundException e) {
logger.debug("String_Node_Str" + node.getName() + "String_Node_Str");
nodeReport.setStatus(ServiceStatus.FAILED);
}
}
}

Fixed version (ground truth):
private void queryNodesStatus(CmClusterDef cluster){
  for (  CmNodeDef node : cluster.getNodes()) {
    Map<String,NodeReport> nodeReports=cluster.getCurrentReport().getNodeReports();
    NodeReport nodeReport=nodeReports.get(node.getName());
    try {
      ApiHost host=apiResourceRootV6.getHostsResource().readHost(node.getNodeId());
      ApiHealthSummary health=host.getHealthSummary();
switch (health) {
case GOOD:
        nodeReport.setStatus(ServiceStatus.STARTED);
      logger.debug("String_Node_Str" + nodeReport.getName() + "String_Node_Str");
    break;
case CONCERNING:
  nodeReport.setStatus(ServiceStatus.UNHEALTHY);
logger.debug("String_Node_Str" + nodeReport.getName() + "String_Node_Str");
break;
case BAD:
logger.debug("String_Node_Str" + nodeReport.getName() + "String_Node_Str");
nodeReport.setStatus(ServiceStatus.ALERT);
break;
default :
logger.debug("String_Node_Str" + nodeReport.getName() + "String_Node_Str");
nodeReport.setStatus(ServiceStatus.UNKONWN);
break;
}
}
 catch (NotFoundException e) {
logger.debug("String_Node_Str" + node.getName() + "String_Node_Str");
nodeReport.setStatus(ServiceStatus.FAILED);
}
}
}
Program: 48552
Project: 48552
Buggy source:
@Override @Transactional public synchronized void addAppManager(AppManagerAdd appManagerAdd){
  logger.info((new Gson()).toJson(appManagerAdd));
  AppManagerEntity appManagerEntity=new AppManagerEntity(appManagerAdd);
  appManagerDAO.insert(appManagerEntity);
}

Fixed version (ground truth):
@Override @Transactional public synchronized void addAppManager(AppManagerAdd appManagerAdd){
  logger.debug("String_Node_Str" + appManagerAdd);
  AppManagerEntity appManagerEntity=new AppManagerEntity(appManagerAdd);
  appManagerDAO.insert(appManagerEntity);
  logger.debug("String_Node_Str" + appManagerAdd);
}
Program: 48553
Project: 48553
Buggy source:
@Override public void modifyAppManager(AppManagerAdd appManagerAdd){
  logger.debug("String_Node_Str" + appManagerAdd);
  String name=appManagerAdd.getName();
  AppManagerEntity entity=appManagerDAO.findByName(name);
  entity.setDescription(appManagerAdd.getDescription());
  entity.setType(appManagerAdd.getType());
  entity.setUrl(appManagerAdd.getUrl());
  entity.setUsername(appManagerAdd.getUsername());
  entity.setPassword(appManagerAdd.getPassword());
  entity.setSslCertificate(appManagerAdd.getSslCertificate());
  appManagerDAO.update(entity);
  logger.debug("String_Node_Str" + appManagerAdd);
}

Fixed version (ground truth):
@Override @Transactional public void modifyAppManager(AppManagerAdd appManagerAdd){
  logger.debug("String_Node_Str" + appManagerAdd);
  String name=appManagerAdd.getName();
  AppManagerEntity entity=appManagerDAO.findByName(name);
  entity.setDescription(appManagerAdd.getDescription());
  entity.setType(appManagerAdd.getType());
  entity.setUrl(appManagerAdd.getUrl());
  entity.setUsername(appManagerAdd.getUsername());
  entity.setPassword(appManagerAdd.getPassword());
  entity.setSslCertificate(appManagerAdd.getSslCertificate());
  appManagerDAO.update(entity);
  logger.debug("String_Node_Str" + appManagerAdd);
}
Program: 48555
Project: 48555
Buggy source:
public List<String> getDataVolumnsMountPoint(){
  List<String> mountPoints=new ArrayList<String>();
  for (  DiskEntity disk : disks) {
    if (DiskType.DATA_DISK.getType().equals(disk.getDiskType())) {
      mountPoints.add("String_Node_Str" + disk.getHardwareUUID().toLowerCase().replace("String_Node_Str","String_Node_Str") + "String_Node_Str");
    }
  }
  return mountPoints;
}

Fixed version (ground truth):
public List<String> getDataVolumnsMountPoint(){
  List<String> mountPoints=new ArrayList<String>();
  for (  DiskEntity disk : disks) {
    if (DiskType.DATA_DISK.getType().equals(disk.getDiskType())) {
      if (disk.getHardwareUUID() == null) {
        continue;
      }
      mountPoints.add("String_Node_Str" + disk.getHardwareUUID().toLowerCase().replace("String_Node_Str","String_Node_Str") + "String_Node_Str");
    }
  }
  return mountPoints;
}
Program: 48556
Project: 48556
Buggy source:
@Test public void testSubtractBasic(){
  NetworkEntity network=new NetworkEntity("String_Node_Str","String_Node_Str",AllocType.IP_POOL,"String_Node_Str","String_Node_Str","String_Node_Str",null);
  ;
  List<IpBlockEntity> setA=new ArrayList<IpBlockEntity>();
  setA.add(new IpBlockEntity(network,1L,BlockType.ASSIGNED,1L,10L));
  List<IpBlockEntity> setB1=new ArrayList<IpBlockEntity>();
  setB1.add(new IpBlockEntity(network,1L,BlockType.ASSIGNED,1L,3L));
  List<IpBlockEntity> setB2=new ArrayList<IpBlockEntity>();
  setB2.add(new IpBlockEntity(network,1L,BlockType.ASSIGNED,4L,6L));
  List<IpBlockEntity> setB3=new ArrayList<IpBlockEntity>();
  setB3.add(new IpBlockEntity(network,1L,BlockType.ASSIGNED,5L,10L));
  List<IpBlockEntity> setDiff=setA;
  setDiff=IpBlockEntity.subtract(setDiff,setB1);
  setDiff=IpBlockEntity.subtract(setDiff,setB2);
  setDiff=IpBlockEntity.subtract(setDiff,setB3);
  assertTrue(setDiff.isEmpty());
}

Fixed version (ground truth):
@Test public void testSubtractBasic(){
  NetworkEntity network=new NetworkEntity("String_Node_Str","String_Node_Str",AllocType.IP_POOL,"String_Node_Str","String_Node_Str","String_Node_Str",null);
  ;
  List<IpBlockEntity> setA=new ArrayList<IpBlockEntity>();
  setA.add(new IpBlockEntity(network,1L,BlockType.ASSIGNED,1L,10L));
  List<IpBlockEntity> setB1=new ArrayList<IpBlockEntity>();
  setB1.add(new IpBlockEntity(network,1L,BlockType.ASSIGNED,1L,3L));
  List<IpBlockEntity> setB2=new ArrayList<IpBlockEntity>();
  setB2.add(new IpBlockEntity(network,1L,BlockType.ASSIGNED,4L,6L));
  List<IpBlockEntity> setB3=new ArrayList<IpBlockEntity>();
  setB3.add(new IpBlockEntity(network,1L,BlockType.ASSIGNED,5L,10L));
  List<IpBlockEntity> setDiff=setA;
  setDiff=IpBlockEntity.subtract(setDiff,setB1);
  setDiff=IpBlockEntity.subtract(setDiff,setB2);
  setDiff=IpBlockEntity.subtract(setDiff,setB3);
  assertTrue(setDiff.isEmpty());
  List<IpBlockEntity> setC=new ArrayList<IpBlockEntity>();
  setC.add(new IpBlockEntity(network,1L,BlockType.ASSIGNED,3337306476L,3337306480L));
  List<IpBlockEntity> setD=new ArrayList<IpBlockEntity>();
  setD.add(new IpBlockEntity(network,1L,BlockType.ASSIGNED,3337306476L,3337306480L));
  setD.add(new IpBlockEntity(network,1L,BlockType.ASSIGNED,3337306476L,3337306476L));
  setDiff=setC;
  setD=ipBlockDao.merge(setD,true,true,true);
  setDiff=IpBlockEntity.subtract(setDiff,setD);
  assertTrue(setDiff.isEmpty());
  setDiff=setC;
  setD=ipBlockDao.merge(setD,true,true,true);
  setDiff=IpBlockEntity.subtract(setD,setDiff);
  assertTrue(setDiff.isEmpty());
}
Program: 48558
Project: 48558
Buggy source:
private boolean supportedWithHdfs2(ClusterBlueprint blueprint){
  String vendor=blueprint.getHadoopStack().getVendor();
  if (vendor != null && (vendor.equalsIgnoreCase(Constants.DEFAULT_VENDOR) || vendor.equalsIgnoreCase(Constants.MAPR_VENDOR) || vendor.equalsIgnoreCase(Constants.GPHD_VENDOR))) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean supportedWithHdfs2(ClusterBlueprint blueprint){
  String vendor=blueprint.getHadoopStack().getVendor();
  if (vendor != null && (vendor.equalsIgnoreCase(Constants.APACHE_VENDOR) || vendor.equalsIgnoreCase(Constants.MAPR_VENDOR) || vendor.equalsIgnoreCase(Constants.GPHD_VENDOR))) {
    return false;
  }
  return true;
}
Program: 48559
Project: 48559
Buggy source:
@Override public ApiRequest deleteService(String clusterName,String serviceName){
  logger.info("String_Node_Str" + serviceName + "String_Node_Str"+ clusterName);
  Response response=apiResourceRootV1.getClustersResource().getServicesResource(clusterName).deleteService(serviceName);
  String deleteServiceJson=handleAmbariResponse(response);
  return ApiUtils.jsonToObject(ApiRequest.class,deleteServiceJson);
}

Fixed version (ground truth):
@Override public boolean deleteService(String clusterName,String serviceName){
  logger.info("String_Node_Str" + serviceName + "String_Node_Str"+ clusterName);
  Response response=apiResourceRootV1.getClustersResource().getServicesResource(clusterName).deleteService(serviceName);
  handleAmbariResponse(response);
  return true;
}
Program: 48560
Project: 48560
Buggy source:
@Override public ApiRequest deleteCluster(String clusterName) throws AmbariApiException {
  Response response=apiResourceRootV1.getClustersResource().deleteCluster(clusterName);
  String deleteClusterJson=handleAmbariResponse(response);
  logger.debug("String_Node_Str" + deleteClusterJson);
  return ApiUtils.jsonToObject(ApiRequest.class,deleteClusterJson);
}

Fixed version (ground truth):
@Override public boolean deleteCluster(String clusterName) throws AmbariApiException {
  logger.info("String_Node_Str" + clusterName);
  Response response=apiResourceRootV1.getClustersResource().deleteCluster(clusterName);
  handleAmbariResponse(response);
  return HttpStatus.isSuccess(response.getStatus());
}
Program: 48561
Project: 48561
Buggy source:
@Override public ApiRequest deleteHost(String clusterName,String fqdn){
  logger.info("String_Node_Str" + fqdn + "String_Node_Str"+ clusterName);
  Response response=apiResourceRootV1.getClustersResource().getHostsResource(clusterName).deleteHost(fqdn);
  String deleteHostJson=handleAmbariResponse(response);
  return ApiUtils.jsonToObject(ApiRequest.class,deleteHostJson);
}

Fixed version (ground truth):
@Override public ApiRequest deleteHost(String clusterName,String fqdn) throws AmbariApiException {
  logger.info("String_Node_Str" + fqdn + "String_Node_Str"+ clusterName);
  Response response=apiResourceRootV1.getClustersResource().getHostsResource(clusterName).deleteHost(fqdn);
  String deleteHostJson=handleAmbariResponse(response);
  return ApiUtils.jsonToObject(ApiRequest.class,deleteHostJson);
}
Program: 48562
Project: 48562
Buggy source:
public ApiRequest deleteBlueprint(String blueprintName) throws AmbariApiException {
  logger.info("String_Node_Str" + blueprintName);
  Response response=apiResourceRootV1.getBlueprintsResource().deleteBlueprint(blueprintName);
  String deleteBlueprintJson=handleAmbariResponse(response);
  return ApiUtils.jsonToObject(ApiRequest.class,deleteBlueprintJson);
}

Fixed version (ground truth):
public boolean deleteBlueprint(String blueprintName) throws AmbariApiException {
  logger.info("String_Node_Str" + blueprintName);
  Response response=apiResourceRootV1.getBlueprintsResource().deleteBlueprint(blueprintName);
  handleAmbariResponse(response);
  return true;
}
Program: 48563
Project: 48563
Buggy source:
public ApiRequest deleteService(String clusterName,String serviceName);

Fixed version (ground truth):
public boolean deleteService(String clusterName,String serviceName);
Program: 48564
Project: 48564
Buggy source:
public ApiRequest deleteCluster(String clusterName) throws AmbariApiException ;

Fixed version (ground truth):
public boolean deleteCluster(String clusterName) throws AmbariApiException ;
Program: 48565
Project: 48565
Buggy source:
public ApiRequest deleteBlueprint(String blueprintName) throws AmbariApiException ;

Fixed version (ground truth):
public boolean deleteBlueprint(String blueprintName) throws AmbariApiException ;
Program: 48566
Project: 48566
Buggy source:
@Override public boolean onStopCluster(ClusterBlueprint clusterBlueprint,ClusterReportQueue reports) throws SoftwareManagementPluginException {
  String clusterName=clusterBlueprint.getName();
  AmClusterDef clusterDef=new AmClusterDef(clusterBlueprint,null);
  ClusterReport clusterReport=clusterDef.getCurrentReport();
  try {
    clusterReport.setAction("String_Node_Str");
    clusterReport.setProgress(ProgressSplit.OPERATION_BEGIN.getProgress());
    ApiRequest apiRequestSummary=apiManager.stopAllServicesInCluster(clusterName);
    if (apiRequestSummary == null || apiRequestSummary.getApiRequestInfo() == null) {
      return false;
    }
    boolean success=doSoftwareOperation(clusterName,apiRequestSummary,clusterReport,reports);
    if (!success) {
      logger.error("String_Node_Str");
      throw SoftwareManagementPluginException.STOP_CLUSTER_FAILED(clusterName,null);
    }
    return true;
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    throw SoftwareManagementPluginException.STOP_CLUSTER_FAILED(clusterName,e);
  }
}

Fixed version (ground truth):
@Override public boolean onStopCluster(ClusterBlueprint clusterBlueprint,ClusterReportQueue reports) throws SoftwareManagementPluginException {
  String clusterName=clusterBlueprint.getName();
  AmClusterDef clusterDef=new AmClusterDef(clusterBlueprint,null);
  ClusterReport clusterReport=clusterDef.getCurrentReport();
  try {
    if (!isProvisioned(clusterName)) {
      return true;
    }
    clusterReport.setAction("String_Node_Str");
    clusterReport.setProgress(ProgressSplit.OPERATION_BEGIN.getProgress());
    ApiRequest apiRequestSummary=apiManager.stopAllServicesInCluster(clusterName);
    boolean success=doSoftwareOperation(clusterName,apiRequestSummary,clusterReport,reports);
    if (!success) {
      logger.error("String_Node_Str");
      throw SoftwareManagementPluginException.STOP_CLUSTER_FAILED(clusterName,null);
    }
    return true;
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    throw SoftwareManagementPluginException.STOP_CLUSTER_FAILED(clusterName,e);
  }
}
Program: 48567
Project: 48567
Buggy source:
@Override public boolean startCluster(ClusterBlueprint clusterBlueprint,ClusterReportQueue reports) throws SoftwareManagementPluginException {
  AmClusterDef clusterDef=new AmClusterDef(clusterBlueprint,null);
  String clusterName=clusterDef.getName();
  try {
    ClusterReport clusterReport=clusterDef.getCurrentReport();
    clusterReport.setAction("String_Node_Str");
    clusterReport.setProgress(ProgressSplit.OPERATION_BEGIN.getProgress());
    boolean success=false;
    for (int i=0; i < REQUEST_MAX_RETRY_TIMES; i++) {
      try {
        ApiRequest apiRequestSummary=apiManager.startAllServicesInCluster(clusterName);
        success=doSoftwareOperation(clusterBlueprint.getName(),apiRequestSummary,clusterReport,reports);
        if (!success) {
          logger.warn("String_Node_Str");
          try {
            Thread.sleep(5000);
          }
 catch (          Exception e) {
            logger.info("String_Node_Str");
          }
        }
 else {
          break;
        }
      }
 catch (      Exception e) {
        logger.warn("String_Node_Str",e);
      }
    }
    if (!success) {
      logger.error("String_Node_Str");
      throw SoftwareManagementPluginException.START_CLUSTER_FAILED(clusterName,null);
    }
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    throw SoftwareManagementPluginException.START_CLUSTER_FAILED(clusterName,e);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean startCluster(ClusterBlueprint clusterBlueprint,ClusterReportQueue reports) throws SoftwareManagementPluginException {
  AmClusterDef clusterDef=new AmClusterDef(clusterBlueprint,null);
  String clusterName=clusterDef.getName();
  if (!isProvisioned(clusterName)) {
    throw SoftwareManagementPluginException.START_CLUSTER_FAILED("String_Node_Str",null);
  }
  try {
    ClusterReport clusterReport=clusterDef.getCurrentReport();
    clusterReport.setAction("String_Node_Str");
    clusterReport.setProgress(ProgressSplit.OPERATION_BEGIN.getProgress());
    boolean success=false;
    for (int i=0; i < REQUEST_MAX_RETRY_TIMES; i++) {
      try {
        ApiRequest apiRequestSummary=apiManager.startAllServicesInCluster(clusterName);
        success=doSoftwareOperation(clusterBlueprint.getName(),apiRequestSummary,clusterReport,reports);
        if (!success) {
          logger.warn("String_Node_Str");
          try {
            Thread.sleep(5000);
          }
 catch (          Exception e) {
            logger.info("String_Node_Str");
          }
        }
 else {
          break;
        }
      }
 catch (      Exception e) {
        logger.warn("String_Node_Str",e);
      }
    }
    if (!success) {
      logger.error("String_Node_Str");
      throw SoftwareManagementPluginException.START_CLUSTER_FAILED(clusterName,null);
    }
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    throw SoftwareManagementPluginException.START_CLUSTER_FAILED(clusterName,e);
  }
  return true;
}