Program: 48395
Project: 48395
Buggy source:
@Override public boolean scaleOutCluster(ClusterBlueprint blueprint,List<String> addedNodeNames,ClusterReportQueue reportQueue) throws SoftwareManagementPluginException {
  boolean success=false;
  CmClusterDef clusterDef=null;
  try {
    ReflectionUtils.getPreStartServicesHook().preStartServices(blueprint.getName());
    clusterDef=new CmClusterDef(blueprint);
    provisionCluster(clusterDef,addedNodeNames,reportQueue,true);
    provisionParcels(clusterDef,addedNodeNames,reportQueue);
    Map<String,List<ApiRole>> roles=configureNodeServices(clusterDef,reportQueue,addedNodeNames);
    startNodeServices(clusterDef,addedNodeNames,roles,reportQueue);
    success=true;
    clusterDef.getCurrentReport().setProgress(100);
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    clusterDef.getCurrentReport().setClusterAndNodesServiceStatus(ServiceStatus.STARTED);
  }
 catch (  SoftwareManagementPluginException ex) {
    if (ex instanceof CommandExecFailException) {
      String hostId=((CommandExecFailException)ex).getRefHostId();
      CmNodeDef nodeDef=clusterDef.idToHosts().get(hostId);
      String errMsg=null;
      if (nodeDef != null) {
        errMsg="String_Node_Str" + nodeDef.getName() + "String_Node_Str"+ ((ex.getMessage() == null) ? "String_Node_Str" : ("String_Node_Str" + ex.getMessage()));
        clusterDef.getCurrentReport().setNodesAction("String_Node_Str",addedNodeNames);
        clusterDef.getCurrentReport().setNodesStatus(ServiceStatus.STOPPED,addedNodeNames);
        clusterDef.getCurrentReport().getNodeReports().get(nodeDef.getName()).setErrMsg(errMsg);
        throw SoftwareManagementPluginException.START_SERVICE_FAILED(ex,Constants.CDH_PLUGIN_NAME,clusterDef.getName());
      }
    }
    clusterDef.getCurrentReport().setNodesError(ex.getMessage(),addedNodeNames);
    clusterDef.getCurrentReport().setNodesStatus(ServiceStatus.FAILED,addedNodeNames);
    throw ex;
  }
catch (  Exception e) {
    clusterDef.getCurrentReport().setNodesError("String_Node_Str" + e.getMessage(),addedNodeNames);
    clusterDef.getCurrentReport().setNodesStatus(ServiceStatus.FAILED,addedNodeNames);
    logger.error(e.getMessage());
    throw SoftwareManagementPluginException.SCALE_OUT_CLUSTER_FAILED(e,Constants.CDH_PLUGIN_NAME,clusterDef.getName());
  }
 finally {
    clusterDef.getCurrentReport().setSuccess(success);
    clusterDef.getCurrentReport().setFinished(true);
    reportQueue.addClusterReport(clusterDef.getCurrentReport().clone());
  }
  return success;
}

Fixed version (ground truth):
@Override public boolean scaleOutCluster(ClusterBlueprint blueprint,List<String> addedNodeNames,ClusterReportQueue reportQueue) throws SoftwareManagementPluginException {
  boolean success=false;
  CmClusterDef clusterDef=null;
  try {
    clusterDef=new CmClusterDef(blueprint);
    ReflectionUtils.getPreStartServicesHook().preStartServices(blueprint.getName());
    provisionCluster(clusterDef,addedNodeNames,reportQueue,true);
    provisionParcels(clusterDef,addedNodeNames,reportQueue);
    Map<String,List<ApiRole>> roles=configureNodeServices(clusterDef,reportQueue,addedNodeNames);
    startNodeServices(clusterDef,addedNodeNames,roles,reportQueue);
    success=true;
    clusterDef.getCurrentReport().setProgress(100);
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    clusterDef.getCurrentReport().setClusterAndNodesServiceStatus(ServiceStatus.STARTED);
  }
 catch (  SoftwareManagementPluginException ex) {
    if (ex instanceof CommandExecFailException) {
      String hostId=((CommandExecFailException)ex).getRefHostId();
      CmNodeDef nodeDef=clusterDef.idToHosts().get(hostId);
      String errMsg=null;
      if (nodeDef != null) {
        errMsg="String_Node_Str" + nodeDef.getName() + "String_Node_Str"+ ((ex.getMessage() == null) ? "String_Node_Str" : ("String_Node_Str" + ex.getMessage()));
        clusterDef.getCurrentReport().setNodesAction("String_Node_Str",addedNodeNames);
        clusterDef.getCurrentReport().setNodesStatus(ServiceStatus.STOPPED,addedNodeNames);
        clusterDef.getCurrentReport().getNodeReports().get(nodeDef.getName()).setErrMsg(errMsg);
        throw SoftwareManagementPluginException.START_SERVICE_FAILED(ex,Constants.CDH_PLUGIN_NAME,clusterDef.getName());
      }
    }
    clusterDef.getCurrentReport().setNodesError(ex.getMessage(),addedNodeNames);
    clusterDef.getCurrentReport().setNodesStatus(ServiceStatus.FAILED,addedNodeNames);
    throw ex;
  }
catch (  Exception e) {
    clusterDef.getCurrentReport().setNodesError("String_Node_Str" + e.getMessage(),addedNodeNames);
    clusterDef.getCurrentReport().setNodesStatus(ServiceStatus.FAILED,addedNodeNames);
    logger.error(e.getMessage());
    throw SoftwareManagementPluginException.SCALE_OUT_CLUSTER_FAILED(e,Constants.CDH_PLUGIN_NAME,clusterDef.getName());
  }
 finally {
    clusterDef.getCurrentReport().setSuccess(success);
    clusterDef.getCurrentReport().setFinished(true);
    reportQueue.addClusterReport(clusterDef.getCurrentReport().clone());
  }
  return success;
}