Program: 48484
Project: 48484
Buggy source:
@Override public boolean startCluster(ClusterBlueprint clusterBlueprint,ClusterReportQueue reports) throws SoftwareManagementPluginException {
  AmClusterDef clusterDef=new AmClusterDef(clusterBlueprint,null);
  String clusterName=clusterDef.getName();
  if (!isProvisioned(clusterName)) {
    throw AmException.CLUSTER_NOT_PROVISIONED(clusterName);
  }
  if (!isClusterProvisionedByBDE(clusterDef)) {
    throw SoftwareManagementPluginException.START_CLUSTER_FAILED_NOT_PROV_BY_BDE(clusterName);
  }
  ClusterReport clusterReport=clusterDef.getCurrentReport();
  clusterReport.setAction("String_Node_Str");
  clusterReport.setProgress(ProgressSplit.OPERATION_BEGIN.getProgress());
  reportStatus(clusterReport,reports);
  boolean success=false;
  Exception resultException=null;
  try {
    ReflectionUtils.getPreStartServicesHook().preStartServices(clusterName,120);
    for (int i=0; i < REQUEST_MAX_RETRY_TIMES; i++) {
      ApiRequest apiRequestSummary;
      try {
        apiRequestSummary=apiManager.startAllServicesInCluster(clusterName);
        if (apiRequestSummary == null || apiRequestSummary.getApiRequestInfo() == null) {
          success=true;
          return true;
        }
        success=doSoftwareOperation(clusterBlueprint.getName(),apiRequestSummary,clusterReport,reports);
      }
 catch (      Exception e) {
        resultException=e;
        logger.warn("String_Node_Str",e);
        try {
          Thread.sleep(5000);
        }
 catch (        InterruptedException interrupt) {
          logger.info("String_Node_Str");
        }
      }
    }
  }
  finally {
    if (!success) {
      String errMsg=getErrorMsg("String_Node_Str",resultException);
      logger.error(errMsg,resultException);
      throw SoftwareManagementPluginException.START_CLUSTER_FAILED(null,Constants.AMBARI_PLUGIN_NAME,clusterName);
    }
    clusterReport.setClusterAndNodesServiceStatus(ServiceStatus.STARTED);
    clusterReport.setClusterAndNodesAction("String_Node_Str");
    clusterReport.clearAllNodesErrorMsg();
    reportStatus(clusterReport.clone(),reports);
    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 AmException.CLUSTER_NOT_PROVISIONED(clusterName);
  }
  if (!isClusterProvisionedByBDE(clusterDef)) {
    throw SoftwareManagementPluginException.START_CLUSTER_FAILED_NOT_PROV_BY_BDE(clusterName);
  }
  ClusterReport clusterReport=clusterDef.getCurrentReport();
  clusterReport.setAction("String_Node_Str");
  clusterReport.setProgress(ProgressSplit.OPERATION_BEGIN.getProgress());
  reportStatus(clusterReport,reports);
  boolean success=false;
  Exception resultException=null;
  try {
    ReflectionUtils.getPreStartServicesHook().preStartServices(clusterName,120);
    for (int i=0; i < getRequestMaxRetryTimes(); i++) {
      ApiRequest apiRequestSummary;
      try {
        apiRequestSummary=apiManager.startAllServicesInCluster(clusterName);
        if (apiRequestSummary == null || apiRequestSummary.getApiRequestInfo() == null) {
          success=true;
          return true;
        }
        success=doSoftwareOperation(clusterBlueprint.getName(),apiRequestSummary,clusterReport,reports);
      }
 catch (      Exception e) {
        resultException=e;
        logger.warn("String_Node_Str",e);
        try {
          Thread.sleep(5000);
        }
 catch (        InterruptedException interrupt) {
          logger.info("String_Node_Str");
        }
      }
    }
  }
  finally {
    if (!success) {
      logger.error("String_Node_Str",resultException);
      throw SoftwareManagementPluginException.START_CLUSTER_FAILED(resultException,Constants.AMBARI_PLUGIN_NAME,clusterName);
    }
    clusterReport.setClusterAndNodesServiceStatus(ServiceStatus.STARTED);
    clusterReport.setClusterAndNodesAction("String_Node_Str");
    clusterReport.clearAllNodesErrorMsg();
    reportStatus(clusterReport.clone(),reports);
    return true;
  }
}