nus-yam/ex-repair huggingface dataset:
Program: 48463
Project: 48463
Buggy source:
/** 
 * @param name
 * @param urlStr
 */
private void checkServerConnection(String name,String urlStr){
  URL url=null;
  try {
    url=new URL(urlStr);
  }
 catch (  MalformedURLException e) {
    logger.error("String_Node_Str" + e.getMessage());
    throw SoftwareManagerCollectorException.CONNECT_FAILURE(name,e.getMessage());
  }
  final String host=url.getHost();
  final int port=url.getPort();
  logger.info("String_Node_Str");
  try {
    ExecutorService exec=Executors.newFixedThreadPool(1);
    Future<Boolean> futureResult=exec.submit(new Callable<Boolean>(){
      @Override public Boolean call() throws Exception {
        try {
          new Socket(host,port);
          return true;
        }
 catch (        UnknownHostException e) {
          throw e;
        }
catch (        IOException e) {
          throw e;
        }
      }
    }
);
    waitForThreadResult(futureResult);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + name + "String_Node_Str",e);
    throw SoftwareManagerCollectorException.CONNECT_FAILURE(name,e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * @param appMgrName
 * @param urlStr
 */
private void checkServerConnection(String appMgrName,String urlStr){
  URL url=null;
  try {
    url=new URL(urlStr);
  }
 catch (  MalformedURLException e) {
    logger.error("String_Node_Str" + e.getMessage());
    throw SoftwareManagerCollectorException.CONNECT_FAILURE(appMgrName,e.getMessage());
  }
  final String host=url.getHost();
  final int port=url.getPort();
  logger.info("String_Node_Str");
  boolean connectOK=CommonUtil.checkServerConnection(host,port,waitTimeForAppMgrConn);
  if (!connectOK) {
    logger.error("String_Node_Str" + appMgrName + "String_Node_Str");
    throw SoftwareManagerCollectorException.CONNECT_FAILURE(appMgrName,"String_Node_Str");
  }
}
Program: 48464
Project: 48464
Buggy source:
@Transactional @RetryTransaction public void updateNodeAction(NodeEntity node,String action){
  if (node.needUpgrade(getServerVersion()) && node.canBeUpgrade()) {
    nodeDao.updateAction(node.getMoId(),action);
  }
}

Fixed version (ground truth):
@Transactional @RetryTransaction public void updateNodeAction(NodeEntity node,String action){
  node=getNodeWithNicsByMobId(node.getMoId());
  node.setAction(action);
  node.setActionFailed(false);
  node.setErrMessage(null);
  update(node);
}
Program: 48467
Project: 48467
Buggy source:
@Override public boolean setPasswordForNode(String clusterName,NodeEntity node,String password){
  AuAssert.check(clusterName != null && node != null);
  SetVMPasswordSP setVMPasswordSP=new SetVMPasswordSP(node,password);
  String vmNameWithIP=node.getVmNameWithIP();
  try {
    if (setVMPasswordSP.setPasswordForNode()) {
      updateNodeData(node,true,null,null);
      logger.info("String_Node_Str" + vmNameWithIP + "String_Node_Str");
      return true;
    }
    logger.error("String_Node_Str");
    return false;
  }
 catch (  Exception e) {
    String errMsg=(e.getCause() == null ? e.getMessage() : e.getCause().getMessage());
    updateNodeData(node,false,errMsg,CommonUtil.getCurrentTimestamp());
    logger.error("String_Node_Str" + vmNameWithIP + "String_Node_Str",e);
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean setPasswordForNode(String clusterName,NodeEntity node,String password){
  AuAssert.check(clusterName != null && node != null);
  SetVMPasswordSP setVMPasswordSP=new SetVMPasswordSP(node,password);
  String vmNameWithIP=node.getVmNameWithIP();
  try {
    clusterEntityMgr.updateNodeAction(node,Constants.NODE_ACTION_SETTING_PASSWORD);
    if (setVMPasswordSP.setPasswordForNode()) {
      updateNodeData(node,true,null,null);
      logger.info("String_Node_Str" + vmNameWithIP + "String_Node_Str");
      return true;
    }
    logger.error("String_Node_Str");
    return false;
  }
 catch (  Exception e) {
    String errMsg=(e.getCause() == null ? e.getMessage() : e.getCause().getMessage());
    updateNodeData(node,false,errMsg,CommonUtil.getCurrentTimestamp());
    logger.error("String_Node_Str" + vmNameWithIP + "String_Node_Str",e);
    return false;
  }
}
Program: 48468
Project: 48468
Buggy source:
private void upgradeNode(NodeEntity node){
  ClusterUpgradeService upgradeService=new ClusterUpgradeService();
  upgradeService.setClusterEntityMgr(clusterEntityMgr);
  String serverVersion=clusterEntityMgr.getServerVersion();
  String vmName=node.getVmName();
  if (node.needUpgrade(serverVersion) && node.canBeUpgrade()) {
    logger.debug("String_Node_Str" + vmName + "String_Node_Str");
    clusterEntityMgr.updateNodeAction(node,Constants.NODE_ACTION_UPGRADING);
    NodeUpgradeSP nodeUpgrade=new NodeUpgradeSP(node,serverVersion);
    try {
      nodeUpgrade.call();
      updateNodeData(node);
    }
 catch (    Exception e) {
      updateNodeData(node,false,e.getMessage());
      throw BddException.UPGRADE(e,e.getMessage());
    }
  }
}

Fixed version (ground truth):
private void upgradeNode(NodeEntity node){
  ClusterUpgradeService upgradeService=new ClusterUpgradeService();
  upgradeService.setClusterEntityMgr(clusterEntityMgr);
  String serverVersion=clusterEntityMgr.getServerVersion();
  String vmName=node.getVmName();
  if (node.needUpgrade(serverVersion) && node.canBeUpgrade()) {
    logger.debug("String_Node_Str" + vmName + "String_Node_Str");
    clusterEntityMgr.updateNodeActionForUpgrade(node,Constants.NODE_ACTION_UPGRADING);
    NodeUpgradeSP nodeUpgrade=new NodeUpgradeSP(node,serverVersion);
    try {
      nodeUpgrade.call();
      updateNodeData(node);
    }
 catch (    Exception e) {
      updateNodeData(node,false,e.getMessage());
      throw BddException.UPGRADE(e,e.getMessage());
    }
  }
}
Program: 48471
Project: 48471
Buggy source:
/** 
 * @param name
 * @param softwareManager
 */
private void validateSoftwareManager(String name,final SoftwareManager softwareManager){
  logger.info("String_Node_Str");
  try {
    ExecutorService exec=Executors.newFixedThreadPool(1);
    Future<Boolean> futureResult=exec.submit(new Callable<Boolean>(){
      @Override public Boolean call() throws Exception {
        return softwareManager.echo();
      }
    }
);
    boolean gotEcho=false;
    Boolean result=(Boolean)waitForThreadResult(futureResult);
    if (null != result) {
      gotEcho=result;
    }
    exec.shutdown();
    if (!gotEcho) {
      logger.error("String_Node_Str" + name + "String_Node_Str");
      throw SoftwareManagerCollectorException.ECHO_FAILURE(name);
    }
  }
 catch (  SoftwareManagementPluginException e) {
    logger.error("String_Node_Str" + name + "String_Node_Str",e);
    throw SoftwareManagerCollectorException.CONNECT_FAILURE(name,e.getMessage());
  }
  validateSoftwareManagerVersion(softwareManager);
}

Fixed version (ground truth):
/** 
 * @param name
 * @param softwareManager
 */
private void validateSoftwareManager(String name,final SoftwareManager softwareManager){
  logger.info("String_Node_Str");
  try {
    if (!softwareManager.echo()) {
      logger.error("String_Node_Str" + name + "String_Node_Str");
      throw SoftwareManagerCollectorException.ECHO_FAILURE(name);
    }
  }
 catch (  SoftwareManagementPluginException e) {
    logger.error("String_Node_Str" + name + "String_Node_Str",e);
    throw SoftwareManagerCollectorException.CONNECT_FAILURE(name,e.getMessage());
  }
  validateSoftwareManagerVersion(softwareManager);
}
Program: 48473
Project: 48473
Buggy source:
@Override public String call() throws Exception {
  return softwareManager.getVersion();
}

Fixed version (ground truth):
@Override public Boolean call() throws Exception {
  try {
    new Socket(host,port);
    return true;
  }
 catch (  UnknownHostException e) {
    throw e;
  }
catch (  IOException e) {
    throw e;
  }
}
Program: 48477
Project: 48477
Buggy source:
public AmClusterDef(ClusterBlueprint blueprint,String privateKey){
  this.name=blueprint.getName();
  this.version=blueprint.getHadoopStack().getFullVersion();
  this.verbose=true;
  this.sshKey=privateKey;
  this.user=Constants.AMBARI_SSH_USER;
  this.currentReport=new ClusterReport(blueprint);
  this.configurations=AmUtils.toAmConfigurations(blueprint.getConfiguration());
  this.nodes=new ArrayList<AmNodeDef>();
  HdfsVersion hdfs=getDefaultHdfsVersion(this.version);
  for (  NodeGroupInfo group : blueprint.getNodeGroups()) {
    for (    NodeInfo node : group.getNodes()) {
      AmNodeDef nodeDef=new AmNodeDef();
      nodeDef.setName(node.getName());
      nodeDef.setIp(node.getMgtIpAddress());
      nodeDef.setFqdn(node.getHostname());
      nodeDef.setRackInfo(node.getRack());
      nodeDef.setConfigurations(AmUtils.toAmConfigurations(group.getConfiguration()));
      nodeDef.setComponents(group.getRoles());
      nodeDef.setVolumns(node.getVolumes(),hdfs);
      this.nodes.add(nodeDef);
    }
  }
  AmStackDef stackDef=new AmStackDef();
  stackDef.setName(blueprint.getHadoopStack().getVendor());
  stackDef.setVersion(blueprint.getHadoopStack().getFullVersion());
  this.amStack=stackDef;
}

Fixed version (ground truth):
public AmClusterDef(ClusterBlueprint blueprint,String privateKey,String ambariServerVersion){
  this.name=blueprint.getName();
  this.version=blueprint.getHadoopStack().getFullVersion();
  this.verbose=true;
  this.sshKey=privateKey;
  this.user=Constants.AMBARI_SSH_USER;
  this.currentReport=new ClusterReport(blueprint);
  this.configurations=AmUtils.toAmConfigurations(blueprint.getConfiguration());
  this.nodes=new ArrayList<AmNodeDef>();
  HdfsVersion hdfs=getDefaultHdfsVersion(this.version);
  for (  NodeGroupInfo group : blueprint.getNodeGroups()) {
    for (    NodeInfo node : group.getNodes()) {
      AmNodeDef nodeDef=new AmNodeDef();
      nodeDef.setName(node.getName());
      nodeDef.setIp(node.getMgtIpAddress());
      nodeDef.setFqdn(node.getHostname());
      nodeDef.setRackInfo(node.getRack());
      nodeDef.setConfigurations(AmUtils.toAmConfigurations(group.getConfiguration()));
      nodeDef.setComponents(group.getRoles());
      nodeDef.setVolumns(node.getVolumes(),hdfs,ambariServerVersion);
      this.nodes.add(nodeDef);
    }
  }
  AmStackDef stackDef=new AmStackDef();
  stackDef.setName(blueprint.getHadoopStack().getVendor());
  stackDef.setVersion(blueprint.getHadoopStack().getFullVersion());
  this.amStack=stackDef;
}
Program: 48479
Project: 48479
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(success);
  }
 catch (  Exception e) {
    clusterDef.getCurrentReport().setSuccess(success);
    String errorMessage=errorMessage("String_Node_Str" + blueprint.getName(),e);
    logger.error(errorMessage);
    throw SoftwareManagementPluginException.CREATE_CLUSTER_EXCEPTION(e,Constants.AMBARI_PLUGIN_NAME,blueprint.getName());
  }
 finally {
    clusterDef.getCurrentReport().setFinished(true);
    if (success) {
      clusterDef.getCurrentReport().setClusterAndNodesServiceStatus(ServiceStatus.STARTED);
    }
    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");
    String ambariServerVersion=getVersion();
    clusterDef=new AmClusterDef(blueprint,privateKey,ambariServerVersion);
    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(success);
  }
 catch (  Exception e) {
    clusterDef.getCurrentReport().setSuccess(success);
    String errorMessage=errorMessage("String_Node_Str" + blueprint.getName(),e);
    logger.error(errorMessage);
    throw SoftwareManagementPluginException.CREATE_CLUSTER_EXCEPTION(e,Constants.AMBARI_PLUGIN_NAME,blueprint.getName());
  }
 finally {
    clusterDef.getCurrentReport().setFinished(true);
    if (success) {
      clusterDef.getCurrentReport().setClusterAndNodesServiceStatus(ServiceStatus.STARTED);
    }
    reportStatus(clusterDef.getCurrentReport(),reportQueue);
  }
  return success;
}
Program: 48480
Project: 48480
Buggy source:
public static KeyStore loadAppMgrKeyStore(){
  File file=new File(Constants.APPMANAGER_KEYSTORE_PATH + Constants.APPMANAGER_KEYSTORE_FILE);
  if (file.isFile() == false) {
    char SEP=File.separatorChar;
    File dir=new File(System.getProperty("String_Node_Str") + SEP + "String_Node_Str"+ SEP+ "String_Node_Str");
    file=new File(dir,Constants.APPMANAGER_KEYSTORE_FILE);
    if (file.isFile() == false) {
      file=new File(dir,"String_Node_Str");
    }
  }
  KeyStore keyStore=null;
  try {
    keyStore=KeyStore.getInstance(KeyStore.getDefaultType());
  }
 catch (  KeyStoreException e) {
    logger.error("String_Node_Str",e);
    return null;
  }
  InputStream in=null;
  try {
    in=new FileInputStream(file);
    keyStore.load(in,Constants.APPMANAGER_KEYSTORE_PASSWORD);
  }
 catch (  FileNotFoundException e) {
    logger.error("String_Node_Str" + file.getAbsolutePath(),e);
    return null;
  }
catch (  NoSuchAlgorithmException e) {
    logger.error("String_Node_Str",e);
    return null;
  }
catch (  CertificateException e) {
    logger.error("String_Node_Str",e);
    return null;
  }
catch (  IOException e) {
    logger.error("String_Node_Str",e);
    return null;
  }
 finally {
    if (in != null) {
      try {
        in.close();
      }
 catch (      IOException e) {
        logger.warn("String_Node_Str");
      }
    }
  }
  return keyStore;
}

Fixed version (ground truth):
public static KeyStore loadAppMgrKeyStore(String keystorePath){
  File file=new File(keystorePath + Constants.APPMANAGER_KEYSTORE_FILE);
  if (file.isFile() == false) {
    char SEP=File.separatorChar;
    File dir=new File(System.getProperty("String_Node_Str") + SEP + "String_Node_Str"+ SEP+ "String_Node_Str");
    file=new File(dir,Constants.APPMANAGER_KEYSTORE_FILE);
    if (file.isFile() == false) {
      file=new File(dir,"String_Node_Str");
    }
  }
  KeyStore keyStore=null;
  try {
    keyStore=KeyStore.getInstance(KeyStore.getDefaultType());
  }
 catch (  KeyStoreException e) {
    logger.error("String_Node_Str",e);
    return null;
  }
  InputStream in=null;
  try {
    in=new FileInputStream(file);
    keyStore.load(in,Constants.APPMANAGER_KEYSTORE_PASSWORD);
  }
 catch (  FileNotFoundException e) {
    logger.error("String_Node_Str" + file.getAbsolutePath(),e);
    return null;
  }
catch (  NoSuchAlgorithmException e) {
    logger.error("String_Node_Str",e);
    return null;
  }
catch (  CertificateException e) {
    logger.error("String_Node_Str",e);
    return null;
  }
catch (  IOException e) {
    logger.error("String_Node_Str",e);
    return null;
  }
 finally {
    if (in != null) {
      try {
        in.close();
      }
 catch (      IOException e) {
        logger.warn("String_Node_Str");
      }
    }
  }
  return keyStore;
}
Program: 48481
Project: 48481
Buggy source:
@Override public void checkServerTrusted(X509Certificate[] chain,String authType) throws CertificateException {
  logger.info("String_Node_Str");
  try {
    KeyStore keyStore=CommonUtil.loadAppMgrKeyStore();
    if (keyStore == null) {
      logger.error("String_Node_Str");
      return;
    }
    MessageDigest md5=MessageDigest.getInstance("String_Node_Str");
    String md5Fingerprint="String_Node_Str";
    for (int i=0; i < chain.length; i++) {
      X509Certificate cert=chain[i];
      md5.update(cert.getEncoded());
      md5Fingerprint=CommonUtil.toHexString(md5.digest());
      logger.debug("String_Node_Str" + i + "String_Node_Str"+ cert);
      if (keyStore.getCertificate(md5Fingerprint) != null) {
        if (i == chain.length - 1) {
          return;
        }
 else {
          continue;
        }
      }
      logger.error("String_Node_Str" + md5Fingerprint);
      logger.error("String_Node_Str" + cert);
      throw SoftwareManagementPluginException.UNKNOWN_CERTIFICATE(cert.getSubjectDN().toString());
    }
  }
 catch (  NoSuchAlgorithmException e) {
    logger.error("String_Node_Str" + e.getMessage(),e);
  }
catch (  KeyStoreException e) {
    logger.error("String_Node_Str" + e.getMessage(),e);
  }
}

Fixed version (ground truth):
@Override public void checkServerTrusted(X509Certificate[] chain,String authType) throws CertificateException {
  logger.info("String_Node_Str");
  try {
    KeyStore keyStore=CommonUtil.loadAppMgrKeyStore(Constants.APPMANAGER_KEYSTORE_PATH);
    if (keyStore == null) {
      logger.error("String_Node_Str");
      return;
    }
    MessageDigest md5=MessageDigest.getInstance("String_Node_Str");
    String md5Fingerprint="String_Node_Str";
    for (int i=0; i < chain.length; i++) {
      X509Certificate cert=chain[i];
      md5.update(cert.getEncoded());
      md5Fingerprint=CommonUtil.toHexString(md5.digest());
      logger.debug("String_Node_Str" + i + "String_Node_Str"+ cert);
      if (keyStore.getCertificate(md5Fingerprint) != null) {
        if (i == chain.length - 1) {
          return;
        }
 else {
          continue;
        }
      }
      logger.error("String_Node_Str" + md5Fingerprint);
      logger.error("String_Node_Str" + cert);
      throw SoftwareManagementPluginException.UNKNOWN_CERTIFICATE(cert.getSubjectDN().toString());
    }
  }
 catch (  NoSuchAlgorithmException e) {
    logger.error("String_Node_Str" + e.getMessage(),e);
  }
catch (  KeyStoreException e) {
    logger.error("String_Node_Str" + e.getMessage(),e);
  }
}
Program: 48483
Project: 48483
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();
  boolean success=false;
  try {
    if (!isProvisioned(clusterName)) {
      return true;
    }
    if (!isClusterProvisionedByBDE(clusterDef)) {
      throw SoftwareManagementPluginException.STOP_CLUSTER_FAILED(Constants.AMBARI_PLUGIN_NAME,clusterName,"String_Node_Str");
    }
    clusterReport.setAction("String_Node_Str");
    clusterReport.setProgress(ProgressSplit.OPERATION_BEGIN.getProgress());
    reportStatus(clusterReport,reports);
    ApiRequest apiRequestSummary=apiManager.stopAllServicesInCluster(clusterName);
    if (apiRequestSummary == null || apiRequestSummary.getApiRequestInfo() == null) {
      logger.info("String_Node_Str" + clusterName);
      return true;
    }
    doSoftwareOperation(clusterName,apiRequestSummary,clusterReport,reports);
    clusterReport.setClusterAndNodesAction("String_Node_Str");
    clusterReport.clearAllNodesErrorMsg();
    clusterReport.setClusterAndNodesServiceStatus(ServiceStatus.STOPPED);
    reportStatus(clusterReport.clone(),reports);
    return true;
  }
 catch (  Exception e) {
    String errMsg=getErrorMsg("String_Node_Str",e);
    logger.error(errMsg,e);
    throw SoftwareManagementPluginException.STOP_CLUSTER_EXCEPTION(e,Constants.AMBARI_PLUGIN_NAME,clusterName);
  }
}

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();
  boolean success=false;
  try {
    if (!isProvisioned(clusterName)) {
      return true;
    }
    if (!isClusterProvisionedByBDE(clusterDef)) {
      throw SoftwareManagementPluginException.STOP_CLUSTER_FAILED(Constants.AMBARI_PLUGIN_NAME,clusterName,"String_Node_Str");
    }
    clusterReport.setAction("String_Node_Str");
    clusterReport.setProgress(ProgressSplit.OPERATION_BEGIN.getProgress());
    reportStatus(clusterReport,reports);
    ApiRequest apiRequestSummary=apiManager.stopAllServicesInCluster(clusterName);
    if (apiRequestSummary == null || apiRequestSummary.getApiRequestInfo() == null) {
      logger.info("String_Node_Str" + clusterName);
      return true;
    }
    doSoftwareOperation(clusterName,apiRequestSummary,clusterReport,reports);
    clusterReport.setClusterAndNodesAction("String_Node_Str");
    clusterReport.clearAllNodesErrorMsg();
    clusterReport.setClusterAndNodesServiceStatus(ServiceStatus.STOPPED);
    reportStatus(clusterReport.clone(),reports);
    return true;
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    throw SoftwareManagementPluginException.STOP_CLUSTER_EXCEPTION(e,Constants.AMBARI_PLUGIN_NAME,clusterName);
  }
}
Program: 48485
Project: 48485
Buggy source:
@Test(groups={"String_Node_Str"}) public void testForceDeleteClusterWhenStopFailed(){
  AmbariImpl spy=Mockito.spy(provider);
  Mockito.when(spy.echo()).thenReturn(false);
  Mockito.when(spy.isProvisioned(Mockito.anyString())).thenReturn(true);
  Mockito.doReturn(false).when(spy).onStopCluster(Mockito.<ClusterBlueprint>any(),Mockito.<ClusterReportQueue>any());
  Assert.assertTrue(spy.onDeleteCluster(blueprint,reportQueue));
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"}) public void testForceDeleteClusterWhenStopFailed(){
  AmbariImpl spy=Mockito.spy(provider);
  Mockito.when(spy.echo()).thenReturn(true);
  Mockito.when(spy.isProvisioned(Mockito.anyString())).thenReturn(true);
  Mockito.doReturn(true).when(spy).isClusterProvisionedByBDE(Mockito.<AmClusterDef>any());
  Mockito.doReturn(false).when(spy).onStopCluster(Mockito.<ClusterBlueprint>any(),Mockito.<ClusterReportQueue>any());
  ApiManager apiManager=new FakeApiManager(makeClientBuilder());
  ApiManager backup=spy.getApiManager();
  spy.setApiManager(apiManager);
  Assert.assertTrue(spy.onDeleteCluster(blueprint,reportQueue));
  spy.setApiManager(backup);
}
Program: 48486
Project: 48486
Buggy source:
@Test(groups={"String_Node_Str"}) public void testForceDeleteClusterWhenStopSucceed(){
  AmbariImpl spy=Mockito.spy(provider);
  Mockito.when(spy.echo()).thenReturn(false);
  Mockito.when(spy.isProvisioned(Mockito.anyString())).thenReturn(true);
  Mockito.doReturn(true).when(spy).onStopCluster(Mockito.<ClusterBlueprint>any(),Mockito.<ClusterReportQueue>any());
  Assert.assertTrue(spy.onDeleteCluster(blueprint,reportQueue));
}

Fixed version (ground truth):
@Test public void testForceDeleteClusterWhenStopSucceed(){
  AmbariImpl spy=Mockito.spy(provider);
  Mockito.when(spy.echo()).thenReturn(true);
  Mockito.when(spy.isProvisioned(Mockito.anyString())).thenReturn(true);
  Mockito.doReturn(true).when(spy).isClusterProvisionedByBDE(Mockito.<AmClusterDef>any());
  Mockito.doReturn(true).when(spy).onStopCluster(Mockito.<ClusterBlueprint>any(),Mockito.<ClusterReportQueue>any());
  ApiManager apiManager=new FakeApiManager(makeClientBuilder());
  ApiManager backup=spy.getApiManager();
  spy.setApiManager(apiManager);
  Assert.assertTrue(spy.onDeleteCluster(blueprint,reportQueue));
  spy.setApiManager(backup);
}
Program: 48487
Project: 48487
Buggy source:
@Test(groups={"String_Node_Str"}) public void testDeleteClusterNotProvisionedByBDE(){
  AmbariImpl spy=Mockito.spy(provider);
  Mockito.when(spy.echo()).thenReturn(false);
  Mockito.when(spy.isProvisioned(Mockito.anyString())).thenReturn(true);
  Assert.assertTrue(spy.onDeleteCluster(blueprint,reportQueue));
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"}) public void testDeleteClusterNotProvisionedByBDE(){
  AmbariImpl spy=Mockito.spy(provider);
  Mockito.when(spy.echo()).thenReturn(true);
  Mockito.when(spy.isProvisioned(Mockito.anyString())).thenReturn(true);
  Mockito.doReturn(false).when(spy).isClusterProvisionedByBDE(Mockito.<AmClusterDef>any());
  Assert.assertTrue(spy.onDeleteCluster(blueprint,reportQueue));
}
Program: 48488
Project: 48488
Buggy source:
@Test(groups={"String_Node_Str"}) public void testStopStartedCluster(){
  AmbariImpl spy=Mockito.spy(provider);
  AmbariManagerClientbuilder clientbuilder=makeClientBuilder();
  ApiManager apiManager=new FakeApiManager(clientbuilder){
    @Override public ApiRequest stopAllServicesInCluster(    String clusterName) throws AmbariApiException {
      ApiRequest apiRequest=new ApiRequest();
      apiRequest.setApiRequestInfo(new ApiRequestInfo());
      return apiRequest;
    }
  }
;
  Mockito.when(spy.isProvisioned(blueprint.getName())).thenReturn(true);
  Mockito.doReturn(true).when(spy).isClusterProvisionedByBDE(Mockito.<AmClusterDef>any());
  ApiManager backup=spy.getApiManager();
  spy.setApiManager(apiManager);
  Assert.assertTrue(spy.onStopCluster(blueprint,reportQueue));
  spy.setApiManager(backup);
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"}) public void testStopStartedCluster(){
  AmbariImpl spy=Mockito.spy(provider);
  AmbariManagerClientbuilder clientbuilder=makeClientBuilder();
  ApiManager apiManager=new FakeApiManager(clientbuilder){
    @Override public ApiRequest stopAllServicesInCluster(    String clusterName) throws AmbariApiException {
      ApiRequest apiRequest=new ApiRequest();
      apiRequest.setApiRequestInfo(new ApiRequestInfo());
      return apiRequest;
    }
  }
;
  Mockito.when(spy.isProvisioned(blueprint.getName())).thenReturn(true);
  Mockito.doReturn(true).when(spy).isClusterProvisionedByBDE(Mockito.<AmClusterDef>any());
  try {
    Mockito.when(spy.doSoftwareOperation(Mockito.anyString(),Mockito.<ApiRequest>any(),Mockito.<ClusterReport>any(),Mockito.<ClusterReportQueue>any())).thenReturn(true);
  }
 catch (  Exception e) {
  }
  ApiManager backup=spy.getApiManager();
  spy.setApiManager(apiManager);
  Assert.assertTrue(spy.onStopCluster(blueprint,reportQueue));
  spy.setApiManager(backup);
}
Program: 48489
Project: 48489
Buggy source:
@Test(groups={"String_Node_Str"}) public void testStartStoppedCluster(){
  AmbariImpl spy=Mockito.spy(provider);
  AmbariManagerClientbuilder clientbuilder=makeClientBuilder();
  ApiManager apiManager=new FakeApiManager(clientbuilder){
    @Override public ApiRequest startAllServicesInCluster(    String clusterName) throws AmbariApiException {
      ApiRequest apiRequest=new ApiRequest();
      apiRequest.setApiRequestInfo(new ApiRequestInfo());
      return apiRequest;
    }
  }
;
  Mockito.when(spy.isProvisioned(blueprint.getName())).thenReturn(true);
  Mockito.doReturn(true).when(spy).isClusterProvisionedByBDE(Mockito.<AmClusterDef>any());
  ApiManager backup=spy.getApiManager();
  spy.setApiManager(apiManager);
  Assert.assertTrue(spy.startCluster(blueprint,reportQueue));
  spy.setApiManager(backup);
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"}) public void testStartStoppedCluster(){
  AmbariImpl spy=Mockito.spy(provider);
  AmbariManagerClientbuilder clientbuilder=makeClientBuilder();
  ApiManager apiManager=new FakeApiManager(clientbuilder){
    @Override public ApiRequest startAllServicesInCluster(    String clusterName) throws AmbariApiException {
      ApiRequest apiRequest=new ApiRequest();
      apiRequest.setApiRequestInfo(new ApiRequestInfo());
      return apiRequest;
    }
  }
;
  try {
    Mockito.when(spy.doSoftwareOperation(Mockito.anyString(),Mockito.<ApiRequest>any(),Mockito.<ClusterReport>any(),Mockito.<ClusterReportQueue>any())).thenReturn(true);
  }
 catch (  Exception e) {
  }
  Mockito.when(spy.isProvisioned(blueprint.getName())).thenReturn(true);
  Mockito.doReturn(true).when(spy).isClusterProvisionedByBDE(Mockito.<AmClusterDef>any());
  Mockito.doReturn(1).when(spy).getRequestMaxRetryTimes();
  ApiManager backup=spy.getApiManager();
  spy.setApiManager(apiManager);
  Assert.assertTrue(spy.startCluster(blueprint,reportQueue));
  spy.setApiManager(backup);
}
Program: 48490
Project: 48490
Buggy source:
@Test(groups={"String_Node_Str"}) public void testStopAlreadyStoppedCluster(){
  AmbariImpl spy=Mockito.spy(provider);
  AmbariManagerClientbuilder clientbuilder=makeClientBuilder();
  ApiManager apiManager=new FakeApiManager(clientbuilder);
  Mockito.when(spy.isProvisioned(blueprint.getName())).thenReturn(true);
  provider.isProvisioned(blueprint.getName());
  Mockito.doReturn(true).when(spy).isClusterProvisionedByBDE(Mockito.<AmClusterDef>any());
  ApiManager backup=spy.getApiManager();
  spy.setApiManager(apiManager);
  Assert.assertTrue(spy.onStopCluster(blueprint,reportQueue));
  spy.setApiManager(backup);
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"}) public void testStopAlreadyStoppedCluster(){
  AmbariImpl spy=Mockito.spy(provider);
  AmbariManagerClientbuilder clientbuilder=makeClientBuilder();
  ApiManager apiManager=new FakeApiManager(clientbuilder);
  Mockito.when(spy.isProvisioned(blueprint.getName())).thenReturn(true);
  Mockito.doReturn(true).when(spy).isClusterProvisionedByBDE(Mockito.<AmClusterDef>any());
  ApiManager backup=spy.getApiManager();
  spy.setApiManager(apiManager);
  Assert.assertTrue(spy.onStopCluster(blueprint,reportQueue));
  spy.setApiManager(backup);
}
Program: 48491
Project: 48491
Buggy source:
public List<String> getNetworkNames(){
  List<String> networks=new ArrayList<String>();
  if (getNetworkConfig() != null && !getNetworkConfig().isEmpty()) {
    for (    List<String> nets : getNetworkConfig().values()) {
      for (      String netName : nets) {
        networks.add(netName);
      }
    }
  }
  return networks;
}

Fixed version (ground truth):
@JsonIgnore public List<String> getNetworkNames(){
  List<String> networks=new ArrayList<String>();
  if (getNetworkConfig() != null && !getNetworkConfig().isEmpty()) {
    for (    List<String> nets : getNetworkConfig().values()) {
      for (      String netName : nets) {
        networks.add(netName);
      }
    }
  }
  return networks;
}
Program: 48492
Project: 48492
Buggy source:
public static ClusterConfigException NETWORK_IS_NOT_SPECIFIED(String clusterName,int size){
  return new ClusterConfigException(null,"String_Node_Str",clusterName,size);
}

Fixed version (ground truth):
public static ClusterConfigException NETWORK_IS_NOT_SPECIFIED(String clusterName){
  return new ClusterConfigException(null,"String_Node_Str",clusterName);
}
Program: 48493
Project: 48493
Buggy source:
public synchronized void loadSoftwareManagers(){
  if (appManagerService.findAppManagerByName(Constants.IRONFAN) == null) {
    AppManagerAdd appManagerAdd=new AppManagerAdd();
    appManagerAdd.setName(Constants.IRONFAN);
    appManagerAdd.setDescription(Constants.IRONFAN_DESCRIPTION);
    appManagerAdd.setType(Constants.IRONFAN);
    appManagerAdd.setUrl("String_Node_Str");
    appManagerAdd.setUsername("String_Node_Str");
    appManagerAdd.setPassword("String_Node_Str");
    appManagerAdd.setSslCertificate("String_Node_Str");
    appManagerService.addAppManager(appManagerAdd);
  }
  List<AppManagerEntity> appManagers=appManagerService.findAll();
  for (  AppManagerEntity appManager : appManagers) {
    loadSoftwareManager(appManager);
  }
}

Fixed version (ground truth):
public synchronized void loadSoftwareManagers(){
  if (appManagerService.findAppManagerByName(Constants.IRONFAN) == null) {
    AppManagerAdd appManagerAdd=new AppManagerAdd();
    appManagerAdd.setName(Constants.IRONFAN);
    appManagerAdd.setDescription(Constants.IRONFAN_DESCRIPTION);
    appManagerAdd.setType(Constants.IRONFAN);
    appManagerAdd.setUrl("String_Node_Str");
    appManagerAdd.setUsername("String_Node_Str");
    appManagerAdd.setPassword("String_Node_Str");
    appManagerAdd.setSslCertificate("String_Node_Str");
    appManagerService.addAppManager(appManagerAdd);
  }
  List<AppManagerEntity> appManagers=appManagerService.findAll();
  for (  AppManagerEntity appManager : appManagers) {
    try {
      loadSoftwareManager(appManager);
    }
 catch (    Exception e) {
      logger.error("String_Node_Str" + appManager.getName());
      logger.error(e.getMessage());
    }
  }
}
Program: 48495
Project: 48495
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().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(success);
  }
 catch (  Exception e) {
    clusterDef.getCurrentReport().setSuccess(success);
    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);
    if (success) {
      clusterDef.getCurrentReport().setClusterAndNodesServiceStatus(ServiceStatus.STARTED);
    }
    reportStatus(clusterDef.getCurrentReport(),reportQueue);
  }
  return success;
}
Program: 48497
Project: 48497
Buggy source:
public AmbariApiException(String errCode,String message,Throwable cause){
  super(message,cause);
  this.errCode=errCode;
}

Fixed version (ground truth):
public AmbariApiException(){
}
Program: 48498
Project: 48498
Buggy source:
public static AmbariApiException RESPONSE_EXCEPTION(int errCode,String message){
  return new AmbariApiException(String.valueOf(errCode),message,null);
}

Fixed version (ground truth):
public static AmbariApiException RESPONSE_EXCEPTION(int errCode,String message){
  return new AmbariApiException("String_Node_Str",null,message);
}
Program: 48500
Project: 48500
Buggy source:
@Override public boolean scaleOutCluster(ClusterBlueprint blueprint,List<String> addedNodeNames,ClusterReportQueue reports) 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);
    bootstrap(clusterDef,addedNodeNames,reports);
    provisionComponents(clusterDef,addedNodeNames,reports);
    success=true;
    clusterDef.getCurrentReport().setNodesAction("String_Node_Str",addedNodeNames);
    clusterDef.getCurrentReport().setNodesStatus(ServiceStatus.STARTED,addedNodeNames);
    clusterDef.getCurrentReport().setProgress(ProgressSplit.PROVISION_SUCCESS.getProgress());
    clusterDef.getCurrentReport().setSuccess(true);
  }
 catch (  Exception e) {
    clusterDef.getCurrentReport().setNodesError("String_Node_Str" + e.getMessage(),addedNodeNames);
    clusterDef.getCurrentReport().setSuccess(false);
    String errorMessage=errorMessage("String_Node_Str" + blueprint.getName(),e);
    logger.error(errorMessage,e);
    throw SoftwareManagementPluginException.SCALE_OUT_CLUSTER_FAILED(e,Constants.AMBARI_PLUGIN_NAME,blueprint.getName());
  }
 finally {
    clusterDef.getCurrentReport().setFinished(true);
    reportStatus(clusterDef.getCurrentReport(),reports);
  }
  return success;
}

Fixed version (ground truth):
@Override public boolean scaleOutCluster(ClusterBlueprint blueprint,List<String> addedNodeNames,ClusterReportQueue reports) 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);
    bootstrap(clusterDef,addedNodeNames,reports);
    provisionComponents(clusterDef,addedNodeNames,reports);
    success=true;
    clusterDef.getCurrentReport().setNodesAction("String_Node_Str",addedNodeNames);
    clusterDef.getCurrentReport().setNodesStatus(ServiceStatus.STARTED,addedNodeNames);
    clusterDef.getCurrentReport().setProgress(ProgressSplit.PROVISION_SUCCESS.getProgress());
    clusterDef.getCurrentReport().setSuccess(true);
  }
 catch (  Exception e) {
    clusterDef.getCurrentReport().clearAllNodesErrorMsg();
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    clusterDef.getCurrentReport().setNodesError("String_Node_Str" + e.getMessage(),addedNodeNames);
    clusterDef.getCurrentReport().setSuccess(false);
    String errorMessage=errorMessage("String_Node_Str" + blueprint.getName(),e);
    logger.error(errorMessage,e);
    throw SoftwareManagementPluginException.SCALE_OUT_CLUSTER_FAILED(e,Constants.AMBARI_PLUGIN_NAME,blueprint.getName());
  }
 finally {
    clusterDef.getCurrentReport().setFinished(true);
    reportStatus(clusterDef.getCurrentReport(),reports);
  }
  return success;
}
Program: 48502
Project: 48502
Buggy source:
private void createConfigGroups(AmClusterDef clusterDef,Map<String,String> configTypeToService,List<AmNodeDef> targetNodeDefs) throws SoftwareManagementPluginException {
  List<ApiConfigGroup> configGroups=new ArrayList<>();
  Map<String,ApiConfigGroup> serviceToGroup=new HashMap<>();
  for (  AmNodeDef nodeDef : targetNodeDefs) {
    serviceToGroup.clear();
    List<Map<String,Object>> configs=nodeDef.getConfigurations();
    int i=1;
    for (    Map<String,Object> map : configs) {
      for (      String type : map.keySet()) {
        String serviceName=configTypeToService.get(type + "String_Node_Str");
        ApiConfigGroup confGroup=serviceToGroup.get(serviceName);
        if (confGroup == null) {
          confGroup=createConfigGroup(clusterDef,nodeDef,serviceName);
          serviceToGroup.put(serviceName,confGroup);
        }
        ApiConfigGroupConfiguration sameType=null;
        for (        ApiConfigGroupConfiguration config : confGroup.getApiConfigGroupInfo().getDesiredConfigs()) {
          if (config.getType().equals(type)) {
            sameType=config;
            break;
          }
        }
        if (sameType == null) {
          sameType=createApiConfigGroupConf(i,type,serviceName,confGroup);
        }
        Map<String,String> property=(Map<String,String>)map.get(type);
        sameType.getProperties().putAll(property);
      }
    }
    configGroups.addAll(serviceToGroup.values());
  }
  apiManager.createConfigGroups(clusterDef.getName(),configGroups);
}

Fixed version (ground truth):
private void createConfigGroups(AmClusterDef clusterDef,Map<String,String> configTypeToService,List<AmNodeDef> targetNodeDefs) throws SoftwareManagementPluginException {
  List<ApiConfigGroup> configGroups=new ArrayList<>();
  Map<String,ApiConfigGroup> serviceToGroup=new HashMap<>();
  for (  AmNodeDef nodeDef : targetNodeDefs) {
    serviceToGroup.clear();
    List<Map<String,Object>> configs=nodeDef.getConfigurations();
    int i=1;
    for (    Map<String,Object> map : configs) {
      for (      String type : map.keySet()) {
        String serviceName=configTypeToService.get(type + "String_Node_Str");
        ApiConfigGroup confGroup=serviceToGroup.get(serviceName);
        if (confGroup == null) {
          confGroup=createConfigGroup(clusterDef,nodeDef,serviceName);
          serviceToGroup.put(serviceName,confGroup);
        }
        ApiConfigGroupConfiguration sameType=null;
        for (        ApiConfigGroupConfiguration config : confGroup.getApiConfigGroupInfo().getDesiredConfigs()) {
          if (config.getType().equals(type)) {
            sameType=config;
            break;
          }
        }
        if (sameType == null) {
          sameType=createApiConfigGroupConf(i,type,serviceName,confGroup);
        }
        Map<String,String> property=(Map<String,String>)map.get(type);
        sameType.getProperties().putAll(property);
      }
    }
    configGroups.addAll(serviceToGroup.values());
  }
  if (configGroups.isEmpty()) {
    return;
  }
  logger.debug("String_Node_Str" + configGroups);
  apiManager.createConfigGroups(clusterDef.getName(),configGroups);
}
Program: 48503
Project: 48503
Buggy source:
private void stopAllComponents(AmClusterDef clusterDef,List<String> existingHosts,ClusterReportQueue reports) throws Exception {
  ApiRequest apiRequestSummary=apiManager.stopAllComponentsInHosts(clusterDef.getName(),existingHosts);
  if (apiRequestSummary.getApiRequestInfo() == null) {
    logger.debug("String_Node_Str");
    return;
  }
  ClusterOperationPoller poller=new ClusterOperationPoller(apiManager,apiRequestSummary,clusterDef.getName(),clusterDef.getCurrentReport(),reports,ProgressSplit.PROVISION_SUCCESS.getProgress());
  poller.waitForComplete();
  boolean success=false;
  ApiRequest apiRequest=apiManager.getRequest(clusterDef.getName(),apiRequestSummary.getApiRequestInfo().getRequestId());
  ClusterRequestStatus clusterRequestStatus=ClusterRequestStatus.valueOf(apiRequest.getApiRequestInfo().getRequestStatus());
  if (!clusterRequestStatus.isFailedState()) {
    success=true;
  }
  if (!success) {
    throw SoftwareManagementPluginException.STOP_CLUSTER_FAILED(AMBARI,clusterDef.getName());
  }
}

Fixed version (ground truth):
private void stopAllComponents(AmClusterDef clusterDef,List<String> existingHosts,ClusterReportQueue reports) throws Exception {
  ApiRequest apiRequestSummary=apiManager.stopAllComponentsInHosts(clusterDef.getName(),existingHosts);
  if (apiRequestSummary == null || apiRequestSummary.getApiRequestInfo() == null) {
    logger.debug("String_Node_Str");
    return;
  }
  ClusterOperationPoller poller=new ClusterOperationPoller(apiManager,apiRequestSummary,clusterDef.getName(),clusterDef.getCurrentReport(),reports,ProgressSplit.PROVISION_SUCCESS.getProgress());
  poller.waitForComplete();
  boolean success=false;
  ApiRequest apiRequest=apiManager.getRequest(clusterDef.getName(),apiRequestSummary.getApiRequestInfo().getRequestId());
  ClusterRequestStatus clusterRequestStatus=ClusterRequestStatus.valueOf(apiRequest.getApiRequestInfo().getRequestStatus());
  if (!clusterRequestStatus.isFailedState()) {
    success=true;
  }
  if (!success) {
    throw SoftwareManagementPluginException.STOP_CLUSTER_FAILED(AMBARI,clusterDef.getName());
  }
}
Program: 48508
Project: 48508
Buggy source:
public List<AppManagerRead> getAllAppManagerReads(){
  logger.debug("String_Node_Str");
  List<AppManagerRead> appManagerReads=appManagerService.getAllAppManagerReads();
  logger.debug("String_Node_Str");
  return appManagerReads;
}

Fixed version (ground truth):
public List<AppManagerRead> getAllAppManagerReads(){
  logger.debug("String_Node_Str");
  List<AppManagerRead> appManagerReads=appManagerService.getAllAppManagerReads();
  for (  AppManagerRead appManagerRead : appManagerReads) {
    updateManagedClusters(appManagerRead);
  }
  logger.debug("String_Node_Str");
  return appManagerReads;
}
Program: 48509
Project: 48509
Buggy source:
/** 
 * @param appManagerRead
 */
private void setAppManagerReadDynamicProperties(AppManagerRead appManagerRead){
  appManagerRead.setManagedClusters(clusterEntityManager.findByAppManager(appManagerRead.getName()));
  String softMgrVersion="String_Node_Str";
  final SoftwareManager softwareManager=this.getSoftwareManager(appManagerRead.getName());
  if (softwareManager != null) {
    ExecutorService exec=Executors.newFixedThreadPool(1);
    Future<String> futureResult=exec.submit(new Callable<String>(){
      @Override public String call() throws Exception {
        return softwareManager.getVersion();
      }
    }
);
    String result=(String)waitForThreadResult(futureResult);
    if (null != result) {
      softMgrVersion=result;
    }
    exec.shutdown();
    appManagerRead.setVersion(softMgrVersion);
  }
}

Fixed version (ground truth):
/** 
 * @param appManagerRead
 */
private void setAppManagerReadDynamicProperties(AppManagerRead appManagerRead){
  updateManagedClusters(appManagerRead);
  updateVersion(appManagerRead);
}
Program: 48510
Project: 48510
Buggy source:
@Override @Transactional(readOnly=true) public List<AppManagerRead> getAllAppManagerReads(){
  List<AppManagerEntity> entities=appManagerDAO.findAllSortByName();
  List<AppManagerRead> reads=new ArrayList<AppManagerRead>();
  AppManagerRead read;
  for (  AppManagerEntity entity : entities) {
    reads.add(toAppManagerRead(entity));
  }
  return reads;
}

Fixed version (ground truth):
@Override @Transactional(readOnly=true) public List<AppManagerRead> getAllAppManagerReads(){
  List<AppManagerEntity> entities=appManagerDAO.findAllSortByName();
  List<AppManagerRead> reads=new ArrayList<AppManagerRead>();
  for (  AppManagerEntity entity : entities) {
    reads.add(toAppManagerRead(entity));
  }
  return reads;
}