Program: 32163
Project: 32163
Buggy source:
/** 
 * Wrapper through   {@link TrainModelProcessor} and a MapReduce job to analyze biggest sensitivity MSE.
 */
private void distributedSEWrapper() throws Exception {
  TrainModelProcessor trainModelProcessor=new TrainModelProcessor();
  trainModelProcessor.setForVarSelect(true);
  trainModelProcessor.run();
  SourceType source=this.modelConfig.getDataSet().getSource();
  Configuration conf=new Configuration();
  new GenericOptionsParser(conf,new String[]{"String_Node_Str",addRuntimeJars()});
  conf.setBoolean(GuaguaMapReduceConstants.MAPRED_MAP_TASKS_SPECULATIVE_EXECUTION,true);
  conf.setBoolean(GuaguaMapReduceConstants.MAPRED_REDUCE_TASKS_SPECULATIVE_EXECUTION,true);
  conf.set(Constants.SHIFU_MODEL_CONFIG,ShifuFileUtils.getFileSystemBySourceType(source).makeQualified(new Path(super.getPathFinder().getModelConfigPath(source))).toString());
  conf.set(Constants.SHIFU_COLUMN_CONFIG,ShifuFileUtils.getFileSystemBySourceType(source).makeQualified(new Path(super.getPathFinder().getColumnConfigPath(source))).toString());
  conf.set(NNConstants.MAPRED_JOB_QUEUE_NAME,Environment.getProperty(Environment.HADOOP_JOB_QUEUE,"String_Node_Str"));
  conf.set(Constants.SHIFU_MODELSET_SOURCE_TYPE,source.toString());
  Float wrapperRatio=this.modelConfig.getVarSelect().getWrapperRatio();
  if (wrapperRatio == null) {
    log.warn("String_Node_Str");
    wrapperRatio=0.05f;
  }
  if (wrapperRatio.compareTo(Float.valueOf(1.0f)) >= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  conf.setFloat(Constants.SHIFU_VARSELECT_WRAPPER_RATIO,wrapperRatio);
  Job job=new Job(conf,"String_Node_Str" + this.modelConfig.getModelSetName());
  job.setJarByClass(getClass());
  boolean isSEVarSelMulti=Boolean.TRUE.toString().equalsIgnoreCase(Environment.getProperty(Constants.SHIFU_VARSEL_SE_MULTI,Constants.SHIFU_DEFAULT_VARSEL_SE_MULTI));
  if (isSEVarSelMulti) {
    job.setMapperClass(MultithreadedMapper.class);
    MultithreadedMapper.setMapperClass(job,VarSelectMapper.class);
    MultithreadedMapper.setNumberOfThreads(job,6);
  }
 else {
    job.setMapperClass(VarSelectMapper.class);
  }
  job.setMapOutputKeyClass(LongWritable.class);
  job.setMapOutputValueClass(DoubleWritable.class);
  job.setInputFormatClass(TextInputFormat.class);
  FileInputFormat.setInputPaths(job,ShifuFileUtils.getFileSystemBySourceType(source).makeQualified(new Path(super.getPathFinder().getNormalizedDataPath())));
  job.setReducerClass(VarSelectReducer.class);
  job.setNumReduceTasks(1);
  job.setOutputKeyClass(LongWritable.class);
  job.setOutputValueClass(NullWritable.class);
  job.setOutputFormatClass(TextOutputFormat.class);
  String varSelectMSEOutputPath=super.getPathFinder().getVarSelectMSEOutputPath(source);
  FileOutputFormat.setOutputPath(job,new Path(varSelectMSEOutputPath));
  ShifuFileUtils.deleteFile(varSelectMSEOutputPath,source);
  if (job.waitForCompletion(true)) {
    if (!ShifuFileUtils.isFileExists(varSelectMSEOutputPath + Path.SEPARATOR + "String_Node_Str",source)) {
      throw new RuntimeException("String_Node_Str");
    }
    for (    ColumnConfig config : super.columnConfigList) {
      if (config.isFinalSelect()) {
        config.setFinalSelect(false);
      }
    }
    List<Scanner> scanners=null;
    try {
      FileStatus[] globStatus=ShifuFileUtils.getFileSystemBySourceType(source).globStatus(new Path(varSelectMSEOutputPath + Path.SEPARATOR + "String_Node_Str"));
      if (globStatus == null || globStatus.length == 0) {
        throw new RuntimeException("String_Node_Str");
      }
      scanners=ShifuFileUtils.getDataScanners(globStatus[0].getPath().toString(),source);
      String str=null;
      int count=0;
      while (scanners.get(0).hasNext()) {
        ++count;
        str=scanners.get(0).nextLine();
        ColumnConfig columnConfig=this.columnConfigList.get(Integer.parseInt(str));
        columnConfig.setFinalSelect(true);
        log.info("String_Node_Str",columnConfig.getColumnName());
      }
      log.info("String_Node_Str",count);
    }
  finally {
      for (      Scanner scanner : scanners) {
        scanner.close();
      }
    }
    this.saveColumnConfigList();
    this.syncDataToHdfs(this.modelConfig.getDataSet().getSource());
  }
}

Fixed version (ground truth):
/** 
 * Wrapper through   {@link TrainModelProcessor} and a MapReduce job to analyze biggest sensitivity MSE.
 */
private void distributedSEWrapper() throws Exception {
  TrainModelProcessor trainModelProcessor=new TrainModelProcessor();
  trainModelProcessor.setForVarSelect(true);
  trainModelProcessor.run();
  SourceType source=this.modelConfig.getDataSet().getSource();
  Configuration conf=new Configuration();
  new GenericOptionsParser(conf,new String[]{"String_Node_Str",addRuntimeJars()});
  conf.setBoolean(GuaguaMapReduceConstants.MAPRED_MAP_TASKS_SPECULATIVE_EXECUTION,true);
  conf.setBoolean(GuaguaMapReduceConstants.MAPRED_REDUCE_TASKS_SPECULATIVE_EXECUTION,true);
  conf.set(Constants.SHIFU_MODEL_CONFIG,ShifuFileUtils.getFileSystemBySourceType(source).makeQualified(new Path(super.getPathFinder().getModelConfigPath(source))).toString());
  conf.set(Constants.SHIFU_COLUMN_CONFIG,ShifuFileUtils.getFileSystemBySourceType(source).makeQualified(new Path(super.getPathFinder().getColumnConfigPath(source))).toString());
  conf.set(NNConstants.MAPRED_JOB_QUEUE_NAME,Environment.getProperty(Environment.HADOOP_JOB_QUEUE,"String_Node_Str"));
  conf.set(Constants.SHIFU_MODELSET_SOURCE_TYPE,source.toString());
  Float wrapperRatio=this.modelConfig.getVarSelect().getWrapperRatio();
  if (wrapperRatio == null) {
    log.warn("String_Node_Str");
    wrapperRatio=0.05f;
  }
  if (wrapperRatio.compareTo(Float.valueOf(1.0f)) >= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  conf.setFloat(Constants.SHIFU_VARSELECT_WRAPPER_RATIO,wrapperRatio);
  Job job=new Job(conf,"String_Node_Str" + this.modelConfig.getModelSetName());
  job.setJarByClass(getClass());
  boolean isSEVarSelMulti=Boolean.TRUE.toString().equalsIgnoreCase(Environment.getProperty(Constants.SHIFU_VARSEL_SE_MULTI,Constants.SHIFU_DEFAULT_VARSEL_SE_MULTI));
  if (isSEVarSelMulti) {
    job.setMapperClass(MultithreadedMapper.class);
    MultithreadedMapper.setMapperClass(job,VarSelectMapper.class);
    MultithreadedMapper.setNumberOfThreads(job,6);
  }
 else {
    job.setMapperClass(VarSelectMapper.class);
  }
  job.setMapOutputKeyClass(LongWritable.class);
  job.setMapOutputValueClass(DoubleWritable.class);
  job.setInputFormatClass(TextInputFormat.class);
  FileInputFormat.setInputPaths(job,ShifuFileUtils.getFileSystemBySourceType(source).makeQualified(new Path(super.getPathFinder().getNormalizedDataPath())));
  job.setReducerClass(VarSelectReducer.class);
  job.setNumReduceTasks(1);
  job.setOutputKeyClass(LongWritable.class);
  job.setOutputValueClass(NullWritable.class);
  job.setOutputFormatClass(TextOutputFormat.class);
  String varSelectMSEOutputPath=super.getPathFinder().getVarSelectMSEOutputPath(source);
  FileOutputFormat.setOutputPath(job,new Path(varSelectMSEOutputPath));
  ShifuFileUtils.deleteFile(varSelectMSEOutputPath,source);
  if (job.waitForCompletion(true)) {
    if (!ShifuFileUtils.isFileExists(varSelectMSEOutputPath + Path.SEPARATOR + "String_Node_Str",source)) {
      throw new RuntimeException("String_Node_Str");
    }
    for (    ColumnConfig config : super.columnConfigList) {
      if (config.isFinalSelect()) {
        config.setFinalSelect(false);
      }
    }
    List<Scanner> scanners=null;
    try {
      FileStatus[] globStatus=ShifuFileUtils.getFileSystemBySourceType(source).globStatus(new Path(varSelectMSEOutputPath + Path.SEPARATOR + "String_Node_Str"));
      if (globStatus == null || globStatus.length == 0) {
        throw new RuntimeException("String_Node_Str");
      }
      scanners=ShifuFileUtils.getDataScanners(globStatus[0].getPath().toString(),source);
      String str=null;
      int count=0;
      while (scanners.get(0).hasNext()) {
        ++count;
        str=scanners.get(0).nextLine();
        ColumnConfig columnConfig=this.columnConfigList.get(Integer.parseInt(str));
        columnConfig.setFinalSelect(true);
        log.info("String_Node_Str",columnConfig.getColumnName());
      }
      log.info("String_Node_Str",count);
    }
  finally {
      if (scanners != null) {
        for (        Scanner scanner : scanners) {
          if (scanner != null) {
            scanner.close();
          }
        }
      }
    }
    this.saveColumnConfigList();
    this.syncDataToHdfs(this.modelConfig.getDataSet().getSource());
  }
}