Program: 48470
Project: 48470
Buggy source:
private boolean stopServices(ClusterBlueprint clusterBlueprint,ClusterReportQueue reportQueue) throws SoftwareManagementPluginException {
  assert(clusterBlueprint != null && clusterBlueprint.getName() != null && !clusterBlueprint.getName().isEmpty());
  String clusterName=clusterBlueprint.getName();
  CmClusterDef clusterDef=null;
  ClusterReport report=null;
  boolean succeed=false;
  try {
    clusterDef=new CmClusterDef(clusterBlueprint);
    report=clusterDef.getCurrentReport();
    if (isStopped(clusterName) || !needStop(clusterName)) {
      succeed=true;
      return true;
    }
    executeAndReport("String_Node_Str",apiResourceRootV6.getClustersResource().stopCommand(clusterName),ProgressSplit.STOP_SERVICES.getProgress(),report,reportQueue,true);
    succeed=true;
    return true;
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    report.setClusterAndNodesServiceStatus(ServiceStatus.STOP_FAILED);
    HashMap<String,Set<String>> unstoppedRoles=getFailedRoles(clusterName,ApiRoleState.STOPPED);
    setRolesErrorMsg(report,unstoppedRoles,"String_Node_Str");
    throw SoftwareManagementPluginException.STOP_CLUSTER_EXCEPTION(e,Constants.CDH_PLUGIN_NAME,clusterBlueprint.getName());
  }
 finally {
    if (clusterDef != null) {
      if (succeed) {
        report.setClusterAndNodesServiceStatus(ServiceStatus.STOPPED);
        report.setProgress(ProgressSplit.STOP_SERVICES.getProgress());
        logger.info("String_Node_Str");
      }
      report.setClusterAndNodesAction("String_Node_Str");
      report.setFinished(true);
      report.setSuccess(succeed);
      reportQueue.addClusterReport(report.clone());
    }
  }
}

Fixed version (ground truth):
private boolean stopServices(ClusterBlueprint clusterBlueprint,ClusterReportQueue reportQueue) throws SoftwareManagementPluginException {
  assert(clusterBlueprint != null && clusterBlueprint.getName() != null && !clusterBlueprint.getName().isEmpty());
  String clusterName=clusterBlueprint.getName();
  CmClusterDef clusterDef=null;
  ClusterReport report=null;
  boolean succeed=false;
  try {
    if (!isProvisioned(clusterName)) {
      return true;
    }
    clusterDef=new CmClusterDef(clusterBlueprint);
    report=clusterDef.getCurrentReport();
    if (isStopped(clusterName) || !needStop(clusterName)) {
      succeed=true;
      return true;
    }
    executeAndReport("String_Node_Str",apiResourceRootV6.getClustersResource().stopCommand(clusterName),ProgressSplit.STOP_SERVICES.getProgress(),report,reportQueue,true);
    succeed=true;
    return true;
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    report.setClusterAndNodesServiceStatus(ServiceStatus.STOP_FAILED);
    HashMap<String,Set<String>> unstoppedRoles=getFailedRoles(clusterName,ApiRoleState.STOPPED);
    setRolesErrorMsg(report,unstoppedRoles,"String_Node_Str");
    throw SoftwareManagementPluginException.STOP_CLUSTER_EXCEPTION(e,Constants.CDH_PLUGIN_NAME,clusterBlueprint.getName());
  }
 finally {
    if (clusterDef != null) {
      if (succeed) {
        report.setClusterAndNodesServiceStatus(ServiceStatus.STOPPED);
        report.setProgress(ProgressSplit.STOP_SERVICES.getProgress());
        logger.info("String_Node_Str");
      }
      report.setClusterAndNodesAction("String_Node_Str");
      report.setFinished(true);
      report.setSuccess(succeed);
      reportQueue.addClusterReport(report.clone());
    }
  }
}