Program: 31609
Project: 31609
Buggy source:
/** 
 * runner for statistics
 */
@Override public int run() throws Exception {
  log.info("String_Node_Str");
  long start=System.currentTimeMillis();
  try {
    setUp(ModelStep.STATS);
    log.debug("String_Node_Str",this.modelConfig.getStats().getCateMaxNumBin());
    syncDataToHdfs(modelConfig.getDataSet().getSource());
    if (getBooleanParam(this.params,IS_COMPUTE_CORR)) {
      boolean foundValidMeanValueColumn=false;
      for (      ColumnConfig config : this.columnConfigList) {
        if (!config.isMeta() && !config.isTarget()) {
          if (config.getMean() != null) {
            foundValidMeanValueColumn=true;
            break;
          }
        }
      }
      if (!foundValidMeanValueColumn) {
        log.warn("String_Node_Str");
        return -1;
      }
      log.info("String_Node_Str");
      SourceType source=this.modelConfig.getDataSet().getSource();
      String corrPath=super.getPathFinder().getCorrelationPath(source);
      boolean reuseCorrResult=Environment.getBoolean("String_Node_Str",Boolean.FALSE);
      if (reuseCorrResult && ShifuFileUtils.isFileExists(corrPath,SourceType.HDFS)) {
        dumpCorrelationResult(source,corrPath);
      }
 else {
        runCorrMapReduceJob();
      }
      saveColumnConfigList();
    }
 else     if (getBooleanParam(this.params,IS_COMPUTE_PSI)) {
      boolean foundValidMeanValueColumn=false;
      for (      ColumnConfig config : this.columnConfigList) {
        if (!config.isMeta() && !config.isTarget()) {
          if (config.getMean() != null) {
            foundValidMeanValueColumn=true;
            break;
          }
        }
      }
      if (!foundValidMeanValueColumn) {
        log.warn("String_Node_Str");
        return -1;
      }
      if (StringUtils.isNotEmpty(modelConfig.getPsiColumnName())) {
        new MapReducerStatsWorker(this,modelConfig,columnConfigList).runPSI();
      }
 else {
        log.warn("String_Node_Str");
      }
    }
 else     if (getBooleanParam(this.params,IS_REBIN)) {
      String backupColumnConfigPath=this.pathFinder.getBackupColumnConfig();
      if (!ShifuFileUtils.isFileExists(new Path(backupColumnConfigPath),SourceType.LOCAL)) {
        ShifuFileUtils.createDirIfNotExists(new SourceFile(Constants.TMP,SourceType.LOCAL));
        saveColumnConfigList(backupColumnConfigPath,this.columnConfigList);
      }
 else {
        List<ColumnConfig> backColumnConfigList=CommonUtils.loadColumnConfigList(backupColumnConfigPath,SourceType.LOCAL);
        for (        ColumnConfig backupColumnConfig : backColumnConfigList) {
          for (          ColumnConfig columnConfig : this.columnConfigList) {
            if (NSColumnUtils.isColumnEqual(backupColumnConfig.getColumnName(),columnConfig.getColumnName())) {
              columnConfig.setColumnBinning(backupColumnConfig.getColumnBinning());
            }
          }
        }
      }
      List<ColumnConfig> rebinColumns=new ArrayList<ColumnConfig>();
      List<String> catVariables=getStringList(this.params,REQUEST_VARS,"String_Node_Str");
      for (      ColumnConfig columnConfig : this.columnConfigList) {
        if (CollectionUtils.isEmpty(catVariables) || isRequestColumn(catVariables,columnConfig)) {
          rebinColumns.add(columnConfig);
        }
      }
      if (CollectionUtils.isNotEmpty(rebinColumns)) {
        for (        ColumnConfig columnConfig : rebinColumns) {
          doReBin(columnConfig);
        }
      }
      saveColumnConfigList();
    }
 else {
      AbstractStatsExecutor statsExecutor=null;
      if (modelConfig.isMapReduceRunMode()) {
        if (modelConfig.getBinningAlgorithm().equals(ModelStatsConf.BinningAlgorithm.DynamicBinning)) {
          statsExecutor=new DIBStatsExecutor(this,modelConfig,columnConfigList);
        }
 else         if (modelConfig.getBinningAlgorithm().equals(ModelStatsConf.BinningAlgorithm.MunroPat)) {
          statsExecutor=new MunroPatStatsExecutor(this,modelConfig,columnConfigList);
        }
 else         if (modelConfig.getBinningAlgorithm().equals(ModelStatsConf.BinningAlgorithm.MunroPatI)) {
          statsExecutor=new MunroPatIStatsExecutor(this,modelConfig,columnConfigList);
        }
 else         if (modelConfig.getBinningAlgorithm().equals(ModelStatsConf.BinningAlgorithm.SPDT)) {
          statsExecutor=new SPDTStatsExecutor(this,modelConfig,columnConfigList);
        }
 else         if (modelConfig.getBinningAlgorithm().equals(ModelStatsConf.BinningAlgorithm.SPDTI)) {
          statsExecutor=new SPDTIStatsExecutor(this,modelConfig,columnConfigList);
        }
 else {
          statsExecutor=new SPDTIStatsExecutor(this,modelConfig,columnConfigList);
        }
      }
 else       if (modelConfig.isLocalRunMode()) {
        statsExecutor=new AkkaStatsWorker(this,modelConfig,columnConfigList);
      }
 else {
        throw new ShifuException(ShifuErrorCode.ERROR_UNSUPPORT_MODE);
      }
      statsExecutor.doStats();
      String backupColumnConfigPath=this.pathFinder.getBackupColumnConfig();
      ShifuFileUtils.createDirIfNotExists(new SourceFile(Constants.TMP,SourceType.LOCAL));
      saveColumnConfigList(backupColumnConfigPath,this.columnConfigList);
    }
    syncDataToHdfs(modelConfig.getDataSet().getSource());
    clearUp(ModelStep.STATS);
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
    return -1;
  }
  log.info("String_Node_Str",(System.currentTimeMillis() - start));
  return 0;
}

Fixed version (ground truth):
/** 
 * runner for statistics
 */
@Override public int run() throws Exception {
  log.info("String_Node_Str");
  long start=System.currentTimeMillis();
  try {
    setUp(ModelStep.STATS);
    syncDataToHdfs(modelConfig.getDataSet().getSource());
    if (getBooleanParam(this.params,Constants.IS_COMPUTE_CORR)) {
      boolean foundValidMeanValueColumn=false;
      for (      ColumnConfig config : this.columnConfigList) {
        if (!config.isMeta() && !config.isTarget()) {
          if (config.getMean() != null) {
            foundValidMeanValueColumn=true;
            break;
          }
        }
      }
      if (!foundValidMeanValueColumn) {
        log.warn("String_Node_Str");
        return -1;
      }
      log.info("String_Node_Str");
      SourceType source=this.modelConfig.getDataSet().getSource();
      String corrPath=super.getPathFinder().getCorrelationPath(source);
      boolean reuseCorrResult=Environment.getBoolean("String_Node_Str",Boolean.FALSE);
      if (reuseCorrResult && ShifuFileUtils.isFileExists(corrPath,SourceType.HDFS)) {
        dumpCorrelationResult(source,corrPath);
      }
 else {
        runCorrMapReduceJob();
      }
      saveColumnConfigList();
    }
 else     if (getBooleanParam(this.params,Constants.IS_COMPUTE_PSI)) {
      boolean foundValidMeanValueColumn=false;
      for (      ColumnConfig config : this.columnConfigList) {
        if (!config.isMeta() && !config.isTarget()) {
          if (config.getMean() != null) {
            foundValidMeanValueColumn=true;
            break;
          }
        }
      }
      if (!foundValidMeanValueColumn) {
        log.warn("String_Node_Str");
        return -1;
      }
      if (StringUtils.isNotEmpty(modelConfig.getPsiColumnName())) {
        new MapReducerStatsWorker(this,modelConfig,columnConfigList).runPSI();
      }
 else {
        log.warn("String_Node_Str");
      }
    }
 else     if (getBooleanParam(this.params,Constants.IS_REBIN)) {
      String backupColumnConfigPath=this.pathFinder.getBackupColumnConfig();
      if (!ShifuFileUtils.isFileExists(new Path(backupColumnConfigPath),SourceType.LOCAL)) {
        ShifuFileUtils.createDirIfNotExists(new SourceFile(Constants.TMP,SourceType.LOCAL));
        saveColumnConfigList(backupColumnConfigPath,this.columnConfigList);
      }
 else {
        List<ColumnConfig> backColumnConfigList=CommonUtils.loadColumnConfigList(backupColumnConfigPath,SourceType.LOCAL);
        for (        ColumnConfig backupColumnConfig : backColumnConfigList) {
          for (          ColumnConfig columnConfig : this.columnConfigList) {
            if (NSColumnUtils.isColumnEqual(backupColumnConfig.getColumnName(),columnConfig.getColumnName())) {
              columnConfig.setColumnBinning(backupColumnConfig.getColumnBinning());
            }
          }
        }
      }
      List<ColumnConfig> rebinColumns=new ArrayList<ColumnConfig>();
      List<String> catVariables=getStringList(this.params,Constants.REQUEST_VARS,"String_Node_Str");
      for (      ColumnConfig columnConfig : this.columnConfigList) {
        if (CollectionUtils.isEmpty(catVariables) || isRequestColumn(catVariables,columnConfig)) {
          rebinColumns.add(columnConfig);
        }
      }
      if (CollectionUtils.isNotEmpty(rebinColumns)) {
        for (        ColumnConfig columnConfig : rebinColumns) {
          doReBin(columnConfig);
        }
      }
      saveColumnConfigList();
    }
 else {
      AbstractStatsExecutor statsExecutor=null;
      if (modelConfig.isMapReduceRunMode()) {
        if (modelConfig.getBinningAlgorithm().equals(ModelStatsConf.BinningAlgorithm.DynamicBinning)) {
          statsExecutor=new DIBStatsExecutor(this,modelConfig,columnConfigList);
        }
 else         if (modelConfig.getBinningAlgorithm().equals(ModelStatsConf.BinningAlgorithm.MunroPat)) {
          statsExecutor=new MunroPatStatsExecutor(this,modelConfig,columnConfigList);
        }
 else         if (modelConfig.getBinningAlgorithm().equals(ModelStatsConf.BinningAlgorithm.MunroPatI)) {
          statsExecutor=new MunroPatIStatsExecutor(this,modelConfig,columnConfigList);
        }
 else         if (modelConfig.getBinningAlgorithm().equals(ModelStatsConf.BinningAlgorithm.SPDT)) {
          statsExecutor=new SPDTStatsExecutor(this,modelConfig,columnConfigList);
        }
 else         if (modelConfig.getBinningAlgorithm().equals(ModelStatsConf.BinningAlgorithm.SPDTI)) {
          statsExecutor=new SPDTIStatsExecutor(this,modelConfig,columnConfigList);
        }
 else {
          statsExecutor=new SPDTIStatsExecutor(this,modelConfig,columnConfigList);
        }
      }
 else       if (modelConfig.isLocalRunMode()) {
        statsExecutor=new AkkaStatsWorker(this,modelConfig,columnConfigList);
      }
 else {
        throw new ShifuException(ShifuErrorCode.ERROR_UNSUPPORT_MODE);
      }
      statsExecutor.doStats();
      String backupColumnConfigPath=this.pathFinder.getBackupColumnConfig();
      ShifuFileUtils.createDirIfNotExists(new SourceFile(Constants.TMP,SourceType.LOCAL));
      saveColumnConfigList(backupColumnConfigPath,this.columnConfigList);
    }
    syncDataToHdfs(modelConfig.getDataSet().getSource());
    clearUp(ModelStep.STATS);
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
    return -1;
  }
  log.info("String_Node_Str",(System.currentTimeMillis() - start));
  return 0;
}