nus-yam/ex-repair huggingface dataset:
Program: 31917
Project: 31917
Buggy source:
private void selectByFeatureImportance() throws Exception {
  List<BasicML> models=CommonUtils.loadBasicModels(this.modelConfig,this.columnConfigList,null);
  if (models == null || models.size() < 1) {
    TrainModelProcessor trainModelProcessor=new TrainModelProcessor();
    trainModelProcessor.setForVarSelect(true);
    trainModelProcessor.run();
  }
  List<Map<Integer,MutablePair<String,Double>>> importanceList=new ArrayList<Map<Integer,MutablePair<String,Double>>>();
  Map<Integer,MutablePair<String,Double>> mergedResult=null;
  for (  BasicML basicModel : models) {
    if (basicModel instanceof TreeModel) {
      TreeModel model=(TreeModel)basicModel;
      Map<Integer,MutablePair<String,Double>> importances=model.getFeatureImportances();
      importanceList.add(importances);
    }
  }
  if (importanceList.size() < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mergedResult=this.mergeImportanceList(importanceList);
  this.writeFeatureImportance(mergedResult);
  if (super.modelConfig.getVarSelect().getFilterEnable()) {
    this.postProcessFIVarSelect(mergedResult);
  }
}

Fixed version (ground truth):
private void selectByFeatureImportance() throws Exception {
  List<BasicML> models=null;
  if (!super.modelConfig.getVarSelect().getFilterEnable()) {
    models=CommonUtils.loadBasicModels(this.modelConfig,this.columnConfigList,null);
  }
  if (models == null || models.size() < 1) {
    TrainModelProcessor trainModelProcessor=new TrainModelProcessor();
    trainModelProcessor.setForVarSelect(true);
    trainModelProcessor.run();
    models=CommonUtils.loadBasicModels(this.modelConfig,this.columnConfigList,null);
  }
  List<Map<Integer,MutablePair<String,Double>>> importanceList=new ArrayList<Map<Integer,MutablePair<String,Double>>>();
  Map<Integer,MutablePair<String,Double>> mergedResult=null;
  for (  BasicML basicModel : models) {
    if (basicModel instanceof TreeModel) {
      TreeModel model=(TreeModel)basicModel;
      Map<Integer,MutablePair<String,Double>> importances=model.getFeatureImportances();
      importanceList.add(importances);
    }
  }
  if (importanceList.size() < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mergedResult=this.mergeImportanceList(importanceList);
  this.writeFeatureImportance(mergedResult);
  if (super.modelConfig.getVarSelect().getFilterEnable()) {
    this.postProcessFIVarSelect(mergedResult);
  }
}
Program: 31921
Project: 31921
Buggy source:
/** 
 * Wrapper through   {@link TrainModelProcessor} and a MapReduce job to analyze biggest sensitivity RMS.
 */
private void distributedSEWrapper() throws Exception {
  TrainModelProcessor trainModelProcessor=new TrainModelProcessor();
  trainModelProcessor.setForVarSelect(true);
  trainModelProcessor.run();
  SourceType source=this.modelConfig.getDataSet().getSource();
  Configuration conf=new Configuration();
  prepareSEJobConf(source,conf);
  String varSelectMSEOutputPath=super.getPathFinder().getVarSelectMSEOutputPath(source);
  Job job=createSEMapReduceJob(source,conf,varSelectMSEOutputPath);
  ShifuFileUtils.deleteFile(varSelectMSEOutputPath,source);
  if (job.waitForCompletion(true)) {
    if (super.modelConfig.getVarSelect().getFilterEnable()) {
      postProcess4SEVarSelect(source,varSelectMSEOutputPath);
    }
 else {
      log.info("String_Node_Str");
    }
    log.info("String_Node_Str",varSelectMSEOutputPath,Constants.SHIFU_VARSELECT_SE_OUTPUT_NAME);
  }
 else {
    log.error("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Wrapper through   {@link TrainModelProcessor} and a MapReduce job to analyze biggest sensitivity RMS.
 */
private void distributedSEWrapper() throws Exception {
  TrainModelProcessor trainModelProcessor=new TrainModelProcessor();
  trainModelProcessor.setForVarSelect(true);
  trainModelProcessor.run();
  SourceType source=this.modelConfig.getDataSet().getSource();
  Configuration conf=new Configuration();
  prepareSEJobConf(source,conf);
  String varSelectMSEOutputPath=super.getPathFinder().getVarSelectMSEOutputPath(source);
  Job job=createSEMapReduceJob(source,conf,varSelectMSEOutputPath);
  ShifuFileUtils.deleteFile(varSelectMSEOutputPath,source);
  if (job.waitForCompletion(true)) {
    if (super.modelConfig.getVarSelect().getFilterEnable()) {
      postProcess4SEVarSelect(source,varSelectMSEOutputPath);
    }
 else {
      log.info("String_Node_Str");
      log.info("String_Node_Str",varSelectMSEOutputPath,Constants.SHIFU_VARSELECT_SE_OUTPUT_NAME);
    }
  }
 else {
    log.error("String_Node_Str");
  }
}
Program: 31922
Project: 31922
Buggy source:
/** 
 * To do some auto variable selection like remove ID-like variables, remove variable with high missing rate.
 */
private void autoVarSelCondition(){
  for (  ColumnConfig config : columnConfigList) {
    if (isHighMissingRateColumn(config) && !config.isForceSelect()) {
      log.warn("String_Node_Str",config.getColumnName());
      config.setFinalSelect(false);
      continue;
    }
  }
}

Fixed version (ground truth):
/** 
 * To do some auto variable selection like remove ID-like variables, remove variable with high missing rate.
 */
private void autoVarSelCondition(){
  for (  ColumnConfig config : columnConfigList) {
    if (!config.isTarget() && !config.isMeta() && !config.isForceSelect()&& config.isFinalSelect()&& isHighMissingRateColumn(config)) {
      log.warn("String_Node_Str",config.getColumnName());
      config.setFinalSelect(false);
    }
  }
}
Program: 31923
Project: 31923
Buggy source:
@Override protected void clearUp(ModelStep step) throws IOException {
  autoVarSelCondition();
  try {
    this.saveColumnConfigListAndColumnStats(true);
  }
 catch (  Exception e) {
    throw new ShifuException(ShifuErrorCode.ERROR_WRITE_COLCONFIG,e);
  }
  this.syncDataToHdfs(this.modelConfig.getDataSet().getSource());
}

Fixed version (ground truth):
@Override protected void clearUp(ModelStep step) throws IOException {
  if (!isToReset) {
    autoVarSelCondition();
  }
  try {
    this.saveColumnConfigListAndColumnStats(true);
  }
 catch (  Exception e) {
    throw new ShifuException(ShifuErrorCode.ERROR_WRITE_COLCONFIG,e);
  }
  this.syncDataToHdfs(this.modelConfig.getDataSet().getSource());
}
Program: 31925
Project: 31925
Buggy source:
/** 
 * Write all column->MSE pairs to output.
 */
@Override protected void cleanup(Context context) throws IOException, InterruptedException {
  LOG.info("String_Node_Str",results.size());
  for (  Entry<Long,ColumnInfo> entry : results.entrySet()) {
    this.outputKey.set(entry.getKey());
    ColumnInfo columnInfo=entry.getValue();
    columnInfo.setCount(this.recordCount);
    context.write(this.outputKey,columnInfo);
  }
  LOG.info("String_Node_Str",results.size());
  this.executorManager.forceShutDown();
}

Fixed version (ground truth):
/** 
 * Write all column->MSE pairs to output.
 */
@Override protected void cleanup(Context context) throws IOException, InterruptedException {
  for (  Entry<Long,ColumnInfo> entry : results.entrySet()) {
    this.outputKey.set(entry.getKey());
    ColumnInfo columnInfo=entry.getValue();
    columnInfo.setCount(this.recordCount);
    context.write(this.outputKey,columnInfo);
  }
  LOG.debug("String_Node_Str",results);
}
Program: 31926
Project: 31926
Buggy source:
/** 
 * Do initialization like ModelConfig and ColumnConfig loading, model loading and others like input or output number loading.
 */
@Override protected void setup(Context context) throws IOException, InterruptedException {
  loadConfigFiles(context);
  loadModel();
  this.filterBy=context.getConfiguration().get(Constants.SHIFU_VARSELECT_FILTEROUT_TYPE,Constants.FILTER_BY_SE);
  int[] inputOutputIndex=DTrainUtils.getInputOutputCandidateCounts(this.columnConfigList);
  this.inputNodeCount=inputOutputIndex[0] == 0 ? inputOutputIndex[2] : inputOutputIndex[0];
  this.candidateCount=inputOutputIndex[2];
  this.inputs=new double[this.inputNodeCount];
  this.outputs=new double[inputOutputIndex[1]];
  this.columnIndexes=new long[this.inputNodeCount];
  this.inputsMLData=new BasicMLData(this.inputNodeCount);
  this.outputKey=new LongWritable();
  this.executorManager=new ExecutorManager<SEColResult>();
}

Fixed version (ground truth):
/** 
 * Do initialization like ModelConfig and ColumnConfig loading, model loading and others like input or output number loading.
 */
@Override protected void setup(Context context) throws IOException, InterruptedException {
  loadConfigFiles(context);
  loadModel();
  this.filterBy=context.getConfiguration().get(Constants.SHIFU_VARSELECT_FILTEROUT_TYPE,Constants.FILTER_BY_SE);
  int[] inputOutputIndex=DTrainUtils.getInputOutputCandidateCounts(this.columnConfigList);
  this.inputNodeCount=inputOutputIndex[0] == 0 ? inputOutputIndex[2] : inputOutputIndex[0];
  this.candidateCount=inputOutputIndex[2];
  this.inputs=new double[this.inputNodeCount];
  this.outputs=new double[inputOutputIndex[1]];
  this.columnIndexes=new long[this.inputNodeCount];
  this.inputsMLData=new BasicMLData(this.inputNodeCount);
  this.outputKey=new LongWritable();
  LOG.info("String_Node_Str",filterBy);
}
Program: 31928
Project: 31928
Buggy source:
@Override protected void cleanup(Context context) throws IOException, InterruptedException {
  Collections.sort(this.results,new Comparator<Pair>(){
    @Override public int compare(    Pair o1,    Pair o2){
      return Double.compare(o2.value.getRms(),o1.value.getRms());
    }
  }
);
  LOG.debug("String_Node_Str",this.results);
  int candidates=this.filterNum;
  if (candidates <= 0) {
    if (Constants.FILTER_BY_ST.equalsIgnoreCase(this.filterBy) || Constants.FILTER_BY_SE.equalsIgnoreCase(this.filterBy)) {
      candidates=(int)(this.inputNodeCount * (1.0f - this.filterOutRatio));
    }
 else {
      candidates=(int)(this.inputNodeCount * (this.filterOutRatio));
    }
  }
  for (int i=0; i < this.results.size(); i++) {
    Pair pair=this.results.get(i);
    this.outputKey.set(pair.key + "String_Node_Str");
    if (i < candidates) {
      context.write(this.outputKey,OUTPUT_VALUE);
    }
    StringBuilder sb=new StringBuilder(100);
    sb.append(this.columnConfigList.get((int)pair.key).getColumnName()).append("String_Node_Str").append(pair.value.getMean()).append("String_Node_Str").append(pair.value.getRms()).append("String_Node_Str").append(pair.value.getVariance());
    this.outputValue.set(sb.toString());
    this.mos.write(Constants.SHIFU_VARSELECT_SE_OUTPUT_NAME,this.outputKey,this.outputValue);
  }
  this.mos.close();
}

Fixed version (ground truth):
@Override protected void cleanup(Context context) throws IOException, InterruptedException {
  Collections.sort(this.results,new Comparator<Pair>(){
    @Override public int compare(    Pair o1,    Pair o2){
      return Double.compare(o2.value.getRms(),o1.value.getRms());
    }
  }
);
  LOG.debug("String_Node_Str",this.results);
  int candidates=this.filterNum;
  if (candidates <= 0) {
    if (Constants.FILTER_BY_ST.equalsIgnoreCase(this.filterBy) || Constants.FILTER_BY_SE.equalsIgnoreCase(this.filterBy)) {
      candidates=(int)(this.inputNodeCount * (1.0f - this.filterOutRatio));
    }
 else {
      candidates=(int)(this.inputNodeCount * (this.filterOutRatio));
    }
  }
  LOG.info("String_Node_Str",candidates);
  for (int i=0; i < this.results.size(); i++) {
    Pair pair=this.results.get(i);
    this.outputKey.set(pair.key + "String_Node_Str");
    if (i < candidates) {
      context.write(this.outputKey,OUTPUT_VALUE);
    }
    StringBuilder sb=new StringBuilder(100);
    sb.append(this.columnConfigList.get((int)pair.key).getColumnName()).append("String_Node_Str").append(pair.value.getMean()).append("String_Node_Str").append(pair.value.getRms()).append("String_Node_Str").append(pair.value.getVariance());
    this.outputValue.set(sb.toString());
    this.mos.write(Constants.SHIFU_VARSELECT_SE_OUTPUT_NAME,this.outputKey,this.outputValue);
  }
  this.mos.close();
}
Program: 31929
Project: 31929
Buggy source:
/** 
 * Do initialization like ModelConfig and ColumnConfig loading.
 */
@Override protected void setup(Context context) throws IOException, InterruptedException {
  loadConfigFiles(context);
  int[] inputOutputIndex=DTrainUtils.getInputOutputCandidateCounts(this.columnConfigList);
  this.inputNodeCount=inputOutputIndex[0] == 0 ? inputOutputIndex[2] : inputOutputIndex[0];
  this.filterOutRatio=context.getConfiguration().getFloat(Constants.SHIFU_VARSELECT_FILTEROUT_RATIO,Constants.SHIFU_DEFAULT_VARSELECT_FILTEROUT_RATIO);
  this.filterNum=context.getConfiguration().getInt(Constants.SHIFU_VARSELECT_FILTER_NUM,Constants.SHIFU_DEFAULT_VARSELECT_FILTER_NUM);
  this.outputKey=new Text();
  this.outputValue=new Text();
  this.filterBy=context.getConfiguration().get(Constants.SHIFU_VARSELECT_FILTEROUT_TYPE,Constants.FILTER_BY_SE);
  this.mos=new MultipleOutputs<Text,Text>(context);
}

Fixed version (ground truth):
/** 
 * Do initialization like ModelConfig and ColumnConfig loading.
 */
@Override protected void setup(Context context) throws IOException, InterruptedException {
  loadConfigFiles(context);
  int[] inputOutputIndex=DTrainUtils.getInputOutputCandidateCounts(this.columnConfigList);
  this.inputNodeCount=inputOutputIndex[0] == 0 ? inputOutputIndex[2] : inputOutputIndex[0];
  this.filterOutRatio=context.getConfiguration().getFloat(Constants.SHIFU_VARSELECT_FILTEROUT_RATIO,Constants.SHIFU_DEFAULT_VARSELECT_FILTEROUT_RATIO);
  this.filterNum=context.getConfiguration().getInt(Constants.SHIFU_VARSELECT_FILTER_NUM,Constants.SHIFU_DEFAULT_VARSELECT_FILTER_NUM);
  this.outputKey=new Text();
  this.outputValue=new Text();
  this.filterBy=context.getConfiguration().get(Constants.SHIFU_VARSELECT_FILTEROUT_TYPE,Constants.FILTER_BY_SE);
  this.mos=new MultipleOutputs<Text,Text>(context);
  LOG.info("String_Node_Str",filterBy,filterOutRatio,filterNum);
}
Program: 31930
Project: 31930
Buggy source:
private void init(MasterContext<NNParams,NNParams> context){
  this.isDry=Boolean.TRUE.toString().equals(context.getProps().getProperty(CommonConstants.SHIFU_DRY_DTRAIN));
  if (this.isDry) {
    return;
  }
  if (isInit.compareAndSet(false,true)) {
    loadConfigFiles(context.getProps());
    this.trainerId=context.getProps().getProperty(CommonConstants.SHIFU_TRAINER_ID);
    this.tmpModelsFolder=context.getProps().getProperty(CommonConstants.SHIFU_TMP_MODELS_FOLDER);
    gridSearch=new GridSearch(modelConfig.getTrain().getParams());
    validParams=this.modelConfig.getTrain().getParams();
    if (gridSearch.hasHyperParam()) {
      validParams=gridSearch.getParams(Integer.parseInt(trainerId));
      LOG.info("String_Node_Str",validParams);
    }
    Integer kCrossValidation=this.modelConfig.getTrain().getNumKFold();
    if (kCrossValidation != null && kCrossValidation > 0) {
      isKFoldCV=true;
    }
    initNetwork();
  }
  try {
    Path progressLog=new Path(context.getProps().getProperty(CommonConstants.SHIFU_DTRAIN_PROGRESS_FILE));
    this.progressOutput=FileSystem.get(new Configuration()).create(progressLog);
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void init(MasterContext<NNParams,NNParams> context){
  this.isDry=Boolean.TRUE.toString().equals(context.getProps().getProperty(CommonConstants.SHIFU_DRY_DTRAIN));
  if (this.isDry) {
    return;
  }
  if (isInit.compareAndSet(false,true)) {
    loadConfigFiles(context.getProps());
    this.trainerId=context.getProps().getProperty(CommonConstants.SHIFU_TRAINER_ID);
    this.tmpModelsFolder=context.getProps().getProperty(CommonConstants.SHIFU_TMP_MODELS_FOLDER);
    gridSearch=new GridSearch(modelConfig.getTrain().getParams());
    validParams=this.modelConfig.getTrain().getParams();
    if (gridSearch.hasHyperParam()) {
      validParams=gridSearch.getParams(Integer.parseInt(trainerId));
      LOG.info("String_Node_Str",validParams);
    }
    Integer kCrossValidation=this.modelConfig.getTrain().getNumKFold();
    if (kCrossValidation != null && kCrossValidation > 0) {
      isKFoldCV=true;
    }
    initNetwork();
  }
  try {
    Path progressLog=new Path(context.getProps().getProperty(CommonConstants.SHIFU_DTRAIN_PROGRESS_FILE));
    if (ShifuFileUtils.isFileExists(progressLog,SourceType.HDFS)) {
      this.progressOutput=FileSystem.get(new Configuration()).append(progressLog);
    }
 else {
      this.progressOutput=FileSystem.get(new Configuration()).create(progressLog);
    }
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
}
Program: 31931
Project: 31931
Buggy source:
/** 
 * According to SourceType to check whether file exists.
 * @param path - path of source file
 * @param sourceType - local/hdfs
 * @return - true if file exists, or false
 * @throws IOException - if any I/O exception in processing
 */
public static boolean isFileExists(String path,SourceType sourceType) throws IOException {
  FileSystem fs=getFileSystemBySourceType(sourceType);
  FileStatus[] fileStatusArr=fs.globStatus(new Path(path));
  return !(fileStatusArr == null || fileStatusArr.length == 0);
}

Fixed version (ground truth):
/** 
 * According to SourceType to check whether file exists.
 * @param path - @Path of source file
 * @param sourceType - local/hdfs
 * @return - true if file exists, or false
 * @throws IOException - if any I/O exception in processing
 */
public static boolean isFileExists(Path path,SourceType sourceType) throws IOException {
  FileSystem fs=getFileSystemBySourceType(sourceType);
  FileStatus[] fileStatusArr=fs.globStatus(path);
  return !(fileStatusArr == null || fileStatusArr.length == 0);
}
Program: 31932
Project: 31932
Buggy source:
public CsvFile(String filePath,String delimiter){
  this.filePath=filePath;
  this.delimiter=delimiter;
}

Fixed version (ground truth):
public CsvFile(String filePath,String delimiter){
  this.filePath=filePath;
  this.delimiter=delimiter;
  this.iterator=new CvsFileIterator(filePath,delimiter);
}
Program: 31933
Project: 31933
Buggy source:
private void open(String filePath) throws IOException {
  this.reader=new BufferedReader(new FileReader(filePath));
  String headerLine=reader.readLine();
  this.header=StringUtils.split(headerLine,delimiter);
}

Fixed version (ground truth):
private void open(String filePath) throws IOException {
  this.reader=new BufferedReader(new FileReader(filePath));
  String headerLine=reader.readLine();
  this.header=StringUtils.splitPreserveAllTokens(headerLine,delimiter);
}
Program: 31934
Project: 31934
Buggy source:
@Override protected void map(LongWritable key,Text value,Context context) throws IOException, InterruptedException {
  String valueStr=value.toString();
  if (valueStr == null || valueStr.length() == 0 || valueStr.trim().length() == 0) {
    LOG.warn("String_Node_Str");
    return;
  }
  context.getCounter(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str").increment(1L);
  if (!this.dataPurifier.isFilterOut(valueStr)) {
    context.getCounter(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str").increment(1L);
    return;
  }
  String[] units=CommonUtils.split(valueStr,this.modelConfig.getDataSetDelimiter());
  String tag=units[this.tagColumnNum];
  if (!this.tags.contains(tag)) {
    if (System.currentTimeMillis() % 20 == 0) {
      LOG.warn("String_Node_Str",tag);
    }
    context.getCounter(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str").increment(1L);
    return;
  }
  int i=0;
  for (  String unit : units) {
    CountAndFrequentItems countAndFrequentItems=this.variableCountMap.get(i);
    if (countAndFrequentItems == null) {
      countAndFrequentItems=new CountAndFrequentItems();
      this.variableCountMap.put(i,countAndFrequentItems);
    }
    countAndFrequentItems.offer(this.missingOrInvalidValues,unit);
    i++;
  }
}

Fixed version (ground truth):
@Override protected void map(LongWritable key,Text value,Context context) throws IOException, InterruptedException {
  String valueStr=value.toString();
  if (valueStr == null || valueStr.length() == 0 || valueStr.trim().length() == 0) {
    LOG.warn("String_Node_Str");
    return;
  }
  context.getCounter(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str").increment(1L);
  if (!this.dataPurifier.isFilterOut(valueStr)) {
    context.getCounter(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str").increment(1L);
    return;
  }
  String[] units=CommonUtils.split(valueStr,this.modelConfig.getDataSetDelimiter());
  String tag=units[this.tagColumnNum];
  if (!this.tags.contains(tag)) {
    if (System.currentTimeMillis() % 50 == 0L) {
      LOG.warn("String_Node_Str",tag);
    }
    context.getCounter(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str").increment(1L);
    return;
  }
  int i=0;
  for (  String unit : units) {
    CountAndFrequentItems countAndFrequentItems=this.variableCountMap.get(i);
    if (countAndFrequentItems == null) {
      countAndFrequentItems=new CountAndFrequentItems();
      this.variableCountMap.put(i,countAndFrequentItems);
    }
    countAndFrequentItems.offer(this.missingOrInvalidValues,unit);
    i++;
  }
}
Program: 31935
Project: 31935
Buggy source:
public CountAndFrequentItemsWritable(long count,long invalidCount,long validNumCount,byte[] hyperBytes,Set<String> frequetItems){
  this.hyperBytes=hyperBytes;
  this.frequetItems=frequetItems;
}

Fixed version (ground truth):
public CountAndFrequentItemsWritable(long count,long invalidCount,long validNumCount,byte[] hyperBytes,Set<String> frequetItems){
  this.count=count;
  this.invalidCount=invalidCount;
  this.validNumCount=validNumCount;
  this.hyperBytes=hyperBytes;
  this.frequetItems=frequetItems;
}
Program: 31936
Project: 31936
Buggy source:
/** 
 * Initialization for column statistics in mapper.
 */
@Override protected void setup(Context context) throws IOException, InterruptedException {
  loadConfigFiles(context);
  this.dataSetDelimiter=this.modelConfig.getDataSetDelimiter();
  this.dataPurifier=new DataPurifier(this.modelConfig);
  loadWeightColumnNum();
  loadTagWeightNum();
  this.columnBinningInfo=new HashMap<Integer,BinningInfoWritable>(this.columnConfigList.size() * 4 / 3);
  this.categoricalBinMap=new HashMap<Integer,Map<String,Integer>>(this.columnConfigList.size() * 4 / 3);
  loadColumnBinningInfo();
  this.outputKey=new IntWritable();
  this.posTags=new HashSet<String>(modelConfig.getPosTags());
  this.negTags=new HashSet<String>(modelConfig.getNegTags());
  this.tags=new HashSet<String>(modelConfig.getFlattenTags());
  this.missingOrInvalidValues=new HashSet<String>(this.modelConfig.getDataSet().getMissingOrInvalidValues());
  LOG.debug("String_Node_Str",this.columnBinningInfo);
}

Fixed version (ground truth):
/** 
 * Initialization for column statistics in mapper.
 */
@Override protected void setup(Context context) throws IOException, InterruptedException {
  loadConfigFiles(context);
  this.dataSetDelimiter=this.modelConfig.getDataSetDelimiter();
  this.dataPurifier=new DataPurifier(this.modelConfig);
  loadWeightColumnNum();
  loadTagWeightNum();
  this.columnBinningInfo=new HashMap<Integer,BinningInfoWritable>(this.columnConfigList.size() * 4 / 3);
  this.categoricalBinMap=new HashMap<Integer,Map<String,Integer>>(this.columnConfigList.size() * 4 / 3);
  loadColumnBinningInfo();
  this.outputKey=new IntWritable();
  this.posTags=new HashSet<String>(modelConfig.getPosTags());
  this.negTags=new HashSet<String>(modelConfig.getNegTags());
  this.tags=new HashSet<String>(modelConfig.getFlattenTags());
  this.missingOrInvalidValues=new HashSet<String>(this.modelConfig.getDataSet().getMissingOrInvalidValues());
  this.isThrowforWeightException="String_Node_Str".equalsIgnoreCase(context.getConfiguration().get("String_Node_Str","String_Node_Str"));
  LOG.debug("String_Node_Str",this.columnBinningInfo);
}
Program: 31938
Project: 31938
Buggy source:
/** 
 * Write   {@link #trees},   {@link #toDoQueue} and MasterParams to HDFS.
 */
private void writeStatesToHdfs(Path out,DTMasterParams masterParams){
  FSDataOutputStream fos=null;
  try {
    fos=FileSystem.get(conf).create(out);
    int treeLength=trees.size();
    fos.writeInt(treeLength);
    for (    TreeNode treeNode : trees) {
      treeNode.write(fos);
    }
    fos.writeInt(this.toDoQueue.size());
    for (    TreeNode treeNode : this.toDoQueue) {
      treeNode.write(fos);
    }
    if (this.isLeafWise && this.toSplitQueue != null) {
      fos.writeInt(this.toSplitQueue.size());
      for (      TreeNode treeNode : this.toSplitQueue) {
        treeNode.write(fos);
      }
    }
    masterParams.write(fos);
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
 finally {
    IOUtils.closeStream(fos);
  }
}

Fixed version (ground truth):
/** 
 * Write   {@link #trees},   {@link #toDoQueue} and MasterParams to HDFS.
 */
private void writeStatesToHdfs(Path out,DTMasterParams masterParams,List<TreeNode> trees,boolean isLeafWise,Queue<TreeNode> toDoQueue,Queue<TreeNode> toSplitQueue){
  FSDataOutputStream fos=null;
  try {
    fos=FileSystem.get(conf).create(out);
    int treeLength=trees.size();
    fos.writeInt(treeLength);
    for (    TreeNode treeNode : trees) {
      treeNode.write(fos);
    }
    fos.writeInt(toDoQueue.size());
    for (    TreeNode treeNode : toDoQueue) {
      treeNode.write(fos);
    }
    if (isLeafWise && toSplitQueue != null) {
      fos.writeInt(toSplitQueue.size());
      for (      TreeNode treeNode : toSplitQueue) {
        treeNode.write(fos);
      }
    }
    masterParams.write(fos);
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
 finally {
    IOUtils.closeStream(fos);
  }
}
Program: 31940
Project: 31940
Buggy source:
@Override public void run(){
  long start=System.currentTimeMillis();
  writeStatesToHdfs(DTMaster.this.checkpointOutput,masterParams);
  LOG.info("String_Node_Str",context.getCurrentIteration(),(System.currentTimeMillis() - start));
}

Fixed version (ground truth):
@Override public void run(){
  long start=System.currentTimeMillis();
  writeStatesToHdfs(DTMaster.this.checkpointOutput,masterParams,finalTrees,finalIsLeaf,finalTodoQueue,finalToSplitQueue);
  LOG.info("String_Node_Str",context.getCurrentIteration(),(System.currentTimeMillis() - start));
}
Program: 31942
Project: 31942
Buggy source:
/** 
 * Do checkpoint for master states, this is for master fail over
 */
private void doCheckPoint(final MasterContext<DTMasterParams,DTWorkerParams> context,final DTMasterParams masterParams){
  LOG.info("String_Node_Str",this.checkpointOutput);
  Thread cpPersistThread=new Thread(new Runnable(){
    @Override public void run(){
      long start=System.currentTimeMillis();
      writeStatesToHdfs(DTMaster.this.checkpointOutput,masterParams);
      LOG.info("String_Node_Str",context.getCurrentIteration(),(System.currentTimeMillis() - start));
    }
  }
,"String_Node_Str");
  cpPersistThread.setDaemon(true);
  cpPersistThread.start();
}

Fixed version (ground truth):
/** 
 * Do checkpoint for master states, this is for master fail over
 */
private void doCheckPoint(final MasterContext<DTMasterParams,DTWorkerParams> context,final DTMasterParams masterParams){
  LOG.info("String_Node_Str",this.checkpointOutput);
  final Queue<TreeNode> finalTodoQueue=this.toDoQueue;
  final Queue<TreeNode> finalToSplitQueue=this.toSplitQueue;
  final boolean finalIsLeaf=this.isLeafWise;
  final List<TreeNode> finalTrees=this.trees;
  Thread cpPersistThread=new Thread(new Runnable(){
    @Override public void run(){
      long start=System.currentTimeMillis();
      writeStatesToHdfs(DTMaster.this.checkpointOutput,masterParams,finalTrees,finalIsLeaf,finalTodoQueue,finalToSplitQueue);
      LOG.info("String_Node_Str",context.getCurrentIteration(),(System.currentTimeMillis() - start));
    }
  }
,"String_Node_Str");
  cpPersistThread.setDaemon(true);
  cpPersistThread.start();
}
Program: 31943
Project: 31943
Buggy source:
private List<Integer> getSubsamplingFeatures(FeatureSubsetStrategy featureSubsetStrategy){
switch (featureSubsetStrategy) {
case HALF:
    return sampleFeaturesForNodeStats(this.allFeatures,this.allFeatures.size() / 2);
case ONETHIRD:
  return sampleFeaturesForNodeStats(this.allFeatures,this.allFeatures.size() / 3);
case TWOTHIRDS:
return sampleFeaturesForNodeStats(this.allFeatures,this.allFeatures.size() * 2 / 3);
case SQRT:
return sampleFeaturesForNodeStats(this.allFeatures,(int)(this.allFeatures.size() * Math.sqrt(this.inputNum) / this.inputNum));
case LOG2:
return sampleFeaturesForNodeStats(this.allFeatures,(int)(this.allFeatures.size() * Math.log(this.inputNum) / Math.log(2) / this.inputNum));
case AUTO:
if (this.treeNum > 1) {
return sampleFeaturesForNodeStats(this.allFeatures,this.allFeatures.size() / 2);
}
 else {
return new ArrayList<Integer>();
}
case ALL:
default :
return new ArrayList<Integer>();
}
}

Fixed version (ground truth):
private List<Integer> getSubsamplingFeatures(FeatureSubsetStrategy featureSubsetStrategy,double featureSubsetRate){
  if (featureSubsetStrategy == null) {
    return sampleFeaturesForNodeStats(this.allFeatures,(int)(this.allFeatures.size() * featureSubsetRate));
  }
 else {
switch (featureSubsetStrategy) {
case HALF:
      return sampleFeaturesForNodeStats(this.allFeatures,this.allFeatures.size() / 2);
case ONETHIRD:
    return sampleFeaturesForNodeStats(this.allFeatures,this.allFeatures.size() / 3);
case TWOTHIRDS:
  return sampleFeaturesForNodeStats(this.allFeatures,this.allFeatures.size() * 2 / 3);
case SQRT:
return sampleFeaturesForNodeStats(this.allFeatures,(int)(this.allFeatures.size() * Math.sqrt(this.inputNum) / this.inputNum));
case LOG2:
return sampleFeaturesForNodeStats(this.allFeatures,(int)(this.allFeatures.size() * Math.log(this.inputNum) / Math.log(2) / this.inputNum));
case AUTO:
if (this.treeNum > 1) {
return sampleFeaturesForNodeStats(this.allFeatures,this.allFeatures.size() / 2);
}
 else {
return new ArrayList<Integer>();
}
case ALL:
default :
return new ArrayList<Integer>();
}
}
}
Program: 31944
Project: 31944
Buggy source:
/** 
 * Create train and eval task for sub-model
 * @param subModelName
 * @param evalSetName
 * @return
 */
private Callable<Integer> createTrainAndEvalTasks(final String subModelName,final String evalSetName) throws IOException {
  if (this.isToShuffleData) {
    ModelConfig subModelConfig=CommonUtils.loadModelConfig(subModelName + File.separator + Constants.MODEL_CONFIG_JSON_FILE_NAME,RawSourceData.SourceType.LOCAL);
    subModelConfig.getTrain().setCustomPaths(null);
    saveModelConfig(subModelName,subModelConfig);
  }
  return new Callable(){
    @Override public Integer call(){
      try {
        if (isToShuffleData) {
          return ProcessManager.runShellProcess(subModelName,new String[][]{new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"},new String[]{"String_Node_Str","String_Node_Str"},new String[]{"String_Node_Str","String_Node_Str","String_Node_Str",evalSetName}});
        }
 else {
          return ProcessManager.runShellProcess(subModelName,new String[][]{new String[]{"String_Node_Str","String_Node_Str"},new String[]{"String_Node_Str","String_Node_Str","String_Node_Str",evalSetName}});
        }
      }
 catch (      IOException e) {
        LOG.error("String_Node_Str",e);
        return 1;
      }
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Create train and eval task for sub-model
 * @param subModelName
 * @param evalSetName
 * @return
 */
private Callable<Integer> createTrainAndEvalTasks(final String subModelName,final String evalSetName) throws IOException {
  if (this.isToShuffleData) {
    ModelConfig subModelConfig=CommonUtils.loadModelConfig(subModelName + File.separator + Constants.MODEL_CONFIG_JSON_FILE_NAME,RawSourceData.SourceType.LOCAL);
    subModelConfig.getTrain().setCustomPaths(null);
    saveModelConfig(subModelName,subModelConfig);
  }
  return new Callable<Integer>(){
    @Override public Integer call(){
      try {
        if (isToShuffleData) {
          return ProcessManager.runShellProcess(subModelName,new String[][]{new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"},new String[]{"String_Node_Str","String_Node_Str"},new String[]{"String_Node_Str","String_Node_Str","String_Node_Str",evalSetName}});
        }
 else {
          return ProcessManager.runShellProcess(subModelName,new String[][]{new String[]{"String_Node_Str","String_Node_Str"},new String[]{"String_Node_Str","String_Node_Str","String_Node_Str",evalSetName}});
        }
      }
 catch (      IOException e) {
        LOG.error("String_Node_Str",e);
        return 1;
      }
    }
  }
;
}
Program: 31950
Project: 31950
Buggy source:
protected void addCrossValidationDataset(List<InputSplit> trainingSplit,JobContext context) throws IOException {
  List<InputSplit> trainingNoMaster=new ArrayList<InputSplit>();
  for (  InputSplit split : trainingSplit) {
    GuaguaInputSplit guaguaInput=(GuaguaInputSplit)split;
    if (guaguaInput.isMaster()) {
      continue;
    }
    trainingNoMaster.add(guaguaInput);
  }
  List<List<FileSplit>> csSplits=this.getCrossValidationSplits(context,trainingNoMaster.size());
  for (int i=0; i < csSplits.size(); i++) {
    List<FileSplit> oneInput=csSplits.get(i);
    GuaguaInputSplit guaguaInput=(GuaguaInputSplit)trainingNoMaster.get(i);
    int trainingSize=guaguaInput.getFileSplits().length;
    FileSplit[] finalSplits=(FileSplit[])ArrayUtils.addAll(guaguaInput.getFileSplits(),oneInput.toArray(new FileSplit[0]));
    guaguaInput.setFileSplits(finalSplits);
    Boolean[] validationFlags=new Boolean[finalSplits.length];
    for (int j=0; j < finalSplits.length; j++) {
      validationFlags[j]=j < trainingSize ? false : true;
    }
    guaguaInput.setExtensions(validationFlags);
  }
  LOG.info("String_Node_Str" + trainingSplit.size());
  LOG.info("String_Node_Str" + csSplits.size());
}

Fixed version (ground truth):
protected void addCrossValidationDataset(List<InputSplit> trainingSplit,JobContext context) throws IOException {
  List<InputSplit> trainingNoMaster=new ArrayList<InputSplit>();
  for (  InputSplit split : trainingSplit) {
    GuaguaInputSplit guaguaInput=(GuaguaInputSplit)split;
    if (guaguaInput.isMaster()) {
      continue;
    }
    trainingNoMaster.add(guaguaInput);
  }
  List<List<FileSplit>> csSplits=this.getCrossValidationSplits(context,trainingNoMaster.size());
  for (int i=0; i < csSplits.size(); i++) {
    List<FileSplit> oneInput=csSplits.get(i);
    GuaguaInputSplit guaguaInput=(GuaguaInputSplit)trainingNoMaster.get(i);
    int trainingSize=guaguaInput.getFileSplits().length;
    FileSplit[] finalSplits=(FileSplit[])ArrayUtils.addAll(guaguaInput.getFileSplits(),oneInput.toArray(new FileSplit[0]));
    guaguaInput.setFileSplits(finalSplits);
    Boolean[] validationFlags=new Boolean[finalSplits.length];
    for (int j=0; j < finalSplits.length; j++) {
      validationFlags[j]=j < trainingSize ? false : true;
    }
    guaguaInput.setExtensions(validationFlags);
  }
  LOG.info("String_Node_Str",trainingSplit.size());
  LOG.info("String_Node_Str",csSplits.size());
}
Program: 31951
Project: 31951
Buggy source:
/** 
 * Splitter building logic including master setting, also includes combining input feature like Pig.
 */
@Override public List<InputSplit> getSplits(JobContext job) throws IOException {
  List<InputSplit> newSplits=super.getSplits(job);
  String testDirs=job.getConfiguration().get("String_Node_Str","String_Node_Str");
  LOG.info("String_Node_Str" + testDirs);
  if (org.apache.commons.lang.StringUtils.isNotBlank(testDirs)) {
    this.addCrossValidationDataset(newSplits,job);
  }
  return newSplits;
}

Fixed version (ground truth):
/** 
 * Splitter building logic including master setting, also includes combining input feature like Pig.
 */
@Override public List<InputSplit> getSplits(JobContext job) throws IOException {
  List<InputSplit> newSplits=super.getSplits(job);
  String testDirs=job.getConfiguration().get("String_Node_Str","String_Node_Str");
  LOG.info("String_Node_Str",testDirs);
  if (org.apache.commons.lang.StringUtils.isNotBlank(testDirs)) {
    this.addCrossValidationDataset(newSplits,job);
  }
  return newSplits;
}
Program: 31954
Project: 31954
Buggy source:
public static boolean isHadoopConfigurationInjected(String key){
  return key.startsWith("String_Node_Str") || key.startsWith("String_Node_Str") || key.startsWith("String_Node_Str")|| key.startsWith("String_Node_Str")|| key.startsWith("String_Node_Str")|| key.startsWith("String_Node_Str")|| key.startsWith("String_Node_Str");
}

Fixed version (ground truth):
public static boolean isHadoopConfigurationInjected(String key){
  return key.startsWith("String_Node_Str") || key.startsWith("String_Node_Str") || key.startsWith("String_Node_Str")|| key.startsWith("String_Node_Str")|| key.startsWith("String_Node_Str")|| key.startsWith("String_Node_Str")|| key.startsWith("String_Node_Str")|| key.startsWith("String_Node_Str")|| key.startsWith("String_Node_Str")|| key.startsWith("String_Node_Str");
}
Program: 31955
Project: 31955
Buggy source:
public DTEarlyStopDecider(int treeDepth){
  if (treeDepth <= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.treeDepth=treeDepth;
  trainErrorDecider=new MinAverageDecider(this.treeDepth,this.treeDepth * this.magicNumber){
    @Override public boolean getDecide(){
      return this.gain < this.maxGain / 1000;
    }
  }
;
  validationErrorDecider=new MinAverageDecider(this.treeDepth,this.treeDepth * this.magicNumber){
    @Override public boolean getDecide(){
      return this.gain < 0;
    }
  }
;
}

Fixed version (ground truth):
public DTEarlyStopDecider(int treeDepth){
  if (treeDepth <= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.treeDepth=treeDepth;
  trainErrorDecider=new MinAverageDecider(this.treeDepth,this.treeDepth * MAGIC_NUMBER){
    @Override public boolean getDecide(){
      return this.gain < this.maxGain / 1000;
    }
  }
;
  validationErrorDecider=new MinAverageDecider(this.treeDepth,this.treeDepth * MAGIC_NUMBER){
    @Override public boolean getDecide(){
      return this.gain < 0;
    }
  }
;
}
Program: 31956
Project: 31956
Buggy source:
private boolean canStop(){
  return this.validationGainContinueNegCount >= magicNumber || this.trainGainContinueLowerCount >= magicNumber;
}

Fixed version (ground truth):
private boolean canStop(){
  return this.validationGainContinueNegCount >= MAGIC_NUMBER || this.trainGainContinueLowerCount >= MAGIC_NUMBER;
}
Program: 31957
Project: 31957
Buggy source:
/** 
 * Get the minimal value in the queue. Should be called when the queue is full.
 * @return the value of the minimal value of the queue
 */
double getQueueMin(){
  double queueMin=this.min;
  this.clear();
  return queueMin;
}

Fixed version (ground truth):
/** 
 * Get the minimal value in the queue. Should be called when the queue is full.
 * @return the value of the minimal value of the queue
 */
@SuppressWarnings("String_Node_Str") double getQueueMin(){
  double queueMin=this.min;
  this.clear();
  return queueMin;
}
Program: 31960
Project: 31960
Buggy source:
@BeforeMethod public void setUp() throws Exception {
  BasicConfigurator.configure();
  LogManager.getRootLogger().setLevel(Level.DEBUG);
  ClassLoader classLoader=getClass().getClassLoader();
  URL url=classLoader.getResource("String_Node_Str");
  File file=new File(this.getClass().getClassLoader().getResource(DATA_FILE_NAME).getFile());
  Scanner scanner=new Scanner(file);
  while (scanner.hasNext()) {
    String line=scanner.nextLine();
    String[] info=line.split("String_Node_Str");
    if (info.length != 2) {
      LOG.error("String_Node_Str" + line);
    }
    trainErrorList.add(Double.valueOf(info[0]));
    validationErrorList.add(Double.valueOf(info[1]));
  }
  scanner.close();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @BeforeMethod public void setUp() throws Exception {
  BasicConfigurator.configure();
  LogManager.getRootLogger().setLevel(Level.DEBUG);
  ClassLoader classLoader=getClass().getClassLoader();
  File file=new File(this.getClass().getClassLoader().getResource(DATA_FILE_NAME).getFile());
  Scanner scanner=new Scanner(file);
  while (scanner.hasNext()) {
    String line=scanner.nextLine();
    String[] info=line.split("String_Node_Str");
    if (info.length != 2) {
      LOG.error("String_Node_Str" + line);
    }
    trainErrorList.add(Double.valueOf(info[0]));
    validationErrorList.add(Double.valueOf(info[1]));
  }
  scanner.close();
}
Program: 31962
Project: 31962
Buggy source:
public String getAbsolutePath(String path){
  String shifuHome=Environment.getProperty(Environment.SHIFU_HOME);
  if (shifuHome == null || shifuHome.length() == 0) {
    return path;
  }
 else {
    String pathStr=(new Path(path)).isAbsolute() ? path : new Path(Environment.getProperty(Environment.SHIFU_HOME),path).toString();
    File file=new File(pathStr);
    if (file.exists()) {
      return pathStr;
    }
 else {
      return path;
    }
  }
}

Fixed version (ground truth):
public String getAbsolutePath(String path){
  String shifuHome=Environment.getProperty(Environment.SHIFU_HOME);
  if (shifuHome == null || shifuHome.length() == 0) {
    return path;
  }
 else {
    return (new Path(path)).isAbsolute() ? path : new Path(Environment.getProperty(Environment.SHIFU_HOME),path).toString();
  }
}
Program: 31964
Project: 31964
Buggy source:
@SuppressWarnings("String_Node_Str") @Test public void testTreeModel() throws Exception {
  InputStream is=null;
  try {
    is=new FileInputStream("String_Node_Str");
    IndependentTreeModel model=IndependentTreeModel.loadFromStream(is);
    PMML pmml=PMMLUtils.loadPMML("String_Node_Str");
    MiningModelEvaluator evaluator=new MiningModelEvaluator(pmml);
    List<Map<FieldName,FieldValue>> input=CsvUtil.load(evaluator,"String_Node_Str","String_Node_Str");
    for (    Map<FieldName,FieldValue> map : input) {
      Map<String,Object> newMap=new HashMap<String,Object>();
      Map<FieldName,Double> regressionTerm=(Map<FieldName,Double>)evaluator.evaluate(map);
      for (      Map.Entry<FieldName,Double> entry : regressionTerm.entrySet()) {
        System.out.println(entry.getValue() * 1000);
      }
      for (      Entry<FieldName,FieldValue> entry : map.entrySet()) {
        FieldName key=entry.getKey();
        FieldValue value=entry.getValue();
switch (value.getOpType()) {
case CONTINUOUS:
          newMap.put(key.getValue(),Double.parseDouble(value.getValue().toString()));
        break;
case CATEGORICAL:
      newMap.put(key.getValue(),value.getValue().toString());
    break;
}
}
double[] results=model.compute(newMap);
System.out.println(results[0] * 1000);
System.out.println("String_Node_Str");
}
}
  finally {
IOUtils.closeQuietly(is);
}
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Test public void testTreeModel() throws Exception {
  InputStream is=null;
  try {
    is=new FileInputStream("String_Node_Str");
    IndependentTreeModel model=IndependentTreeModel.loadFromStream(is);
    PMML pmml=PMMLUtils.loadPMML("String_Node_Str");
    MiningModelEvaluator evaluator=new MiningModelEvaluator(pmml);
    List<Map<FieldName,FieldValue>> input=CsvUtil.load(evaluator,"String_Node_Str","String_Node_Str");
    for (    Map<FieldName,FieldValue> map : input) {
      Map<String,Object> newMap=new HashMap<String,Object>();
      Map<FieldName,Double> regressionTerm=(Map<FieldName,Double>)evaluator.evaluate(map);
      double pmmlScore=0d;
      for (      Map.Entry<FieldName,Double> entry : regressionTerm.entrySet()) {
        pmmlScore=entry.getValue() * 1000;
      }
      for (      Entry<FieldName,FieldValue> entry : map.entrySet()) {
        FieldName key=entry.getKey();
        FieldValue value=entry.getValue();
switch (value.getOpType()) {
case CONTINUOUS:
          newMap.put(key.getValue(),Double.parseDouble(value.getValue().toString()));
        break;
case CATEGORICAL:
      newMap.put(key.getValue(),value.getValue().toString());
    break;
}
}
double[] results=model.compute(newMap);
double ownScore=results[0] * 1000;
Assert.assertTrue(Math.abs(pmmlScore - ownScore) <= 1);
}
}
  finally {
IOUtils.closeQuietly(is);
}
}
Program: 31965
Project: 31965
Buggy source:
@Override public void finish(){
  this.modelRunner.close();
  if (modelConfig.isClassification()) {
    return;
  }
  BufferedWriter writer=null;
  Configuration jobConf=UDFContext.getUDFContext().getJobConf();
  String scoreOutput=jobConf.get(Constants.SHIFU_EVAL_MAXMIN_SCORE_OUTPUT);
  log.debug("String_Node_Str" + scoreOutput + "String_Node_Str"+ jobConf.get("String_Node_Str")+ "String_Node_Str"+ jobConf.get("String_Node_Str")+ "String_Node_Str"+ jobConf.get("String_Node_Str")+ "String_Node_Str"+ jobConf.get("String_Node_Str"));
  try {
    FileSystem fileSystem=FileSystem.get(jobConf);
    fileSystem.mkdirs(new Path(scoreOutput));
    String taskMaxMinScoreFile=scoreOutput + File.separator + "String_Node_Str"+ jobConf.get("String_Node_Str");
    writer=ShifuFileUtils.getWriter(taskMaxMinScoreFile,SourceType.HDFS);
    writer.write(maxScore + "String_Node_Str" + minScore);
  }
 catch (  IOException e) {
    log.error("String_Node_Str",e);
  }
 finally {
    if (writer != null) {
      try {
        writer.close();
      }
 catch (      IOException ignore) {
      }
    }
  }
}

Fixed version (ground truth):
@Override public void finish(){
  if (this.modelRunner != null) {
    this.modelRunner.close();
  }
  if (modelConfig.isClassification()) {
    return;
  }
  BufferedWriter writer=null;
  Configuration jobConf=UDFContext.getUDFContext().getJobConf();
  String scoreOutput=jobConf.get(Constants.SHIFU_EVAL_MAXMIN_SCORE_OUTPUT);
  log.debug("String_Node_Str" + scoreOutput + "String_Node_Str"+ jobConf.get("String_Node_Str")+ "String_Node_Str"+ jobConf.get("String_Node_Str")+ "String_Node_Str"+ jobConf.get("String_Node_Str")+ "String_Node_Str"+ jobConf.get("String_Node_Str"));
  try {
    FileSystem fileSystem=FileSystem.get(jobConf);
    fileSystem.mkdirs(new Path(scoreOutput));
    String taskMaxMinScoreFile=scoreOutput + File.separator + "String_Node_Str"+ jobConf.get("String_Node_Str");
    writer=ShifuFileUtils.getWriter(taskMaxMinScoreFile,SourceType.HDFS);
    writer.write(maxScore + "String_Node_Str" + minScore);
  }
 catch (  IOException e) {
    log.error("String_Node_Str",e);
  }
 finally {
    if (writer != null) {
      try {
        writer.close();
      }
 catch (      IOException ignore) {
      }
    }
  }
}
Program: 31970
Project: 31970
Buggy source:
public static String[] getFinalHeaders(EvalConfig evalConfig) throws IOException {
  String[] fields=null;
  boolean isSchemaProvided=true;
  if (StringUtils.isNotBlank(evalConfig.getDataSet().getHeaderPath())) {
    fields=CommonUtils.getHeaders(evalConfig.getDataSet().getHeaderPath(),evalConfig.getDataSet().getHeaderDelimiter(),evalConfig.getDataSet().getSource());
  }
 else {
    fields=CommonUtils.takeFirstLine(evalConfig.getDataSet().getDataPath(),StringUtils.isBlank(evalConfig.getDataSet().getHeaderDelimiter()) ? evalConfig.getDataSet().getDataDelimiter() : evalConfig.getDataSet().getHeaderDelimiter(),evalConfig.getDataSet().getSource());
    if (StringUtils.join(fields,"String_Node_Str").contains(evalConfig.getDataSet().getTargetColumnName())) {
      isSchemaProvided=true;
      log.warn("String_Node_Str");
      log.warn("String_Node_Str");
    }
 else {
      isSchemaProvided=false;
      log.warn("String_Node_Str");
      log.warn("String_Node_Str");
      log.warn("String_Node_Str");
    }
  }
  for (int i=0; i < fields.length; i++) {
    if (!isSchemaProvided) {
      fields[i]=i + "String_Node_Str";
    }
  }
  return fields;
}

Fixed version (ground truth):
public static String[] getFinalHeaders(EvalConfig evalConfig) throws IOException {
  String[] fields=null;
  boolean isSchemaProvided=true;
  if (StringUtils.isNotBlank(evalConfig.getDataSet().getHeaderPath())) {
    fields=CommonUtils.getHeaders(evalConfig.getDataSet().getHeaderPath(),evalConfig.getDataSet().getHeaderDelimiter(),evalConfig.getDataSet().getSource());
  }
 else {
    fields=CommonUtils.takeFirstLine(evalConfig.getDataSet().getDataPath(),StringUtils.isBlank(evalConfig.getDataSet().getHeaderDelimiter()) ? evalConfig.getDataSet().getDataDelimiter() : evalConfig.getDataSet().getHeaderDelimiter(),evalConfig.getDataSet().getSource());
    if (StringUtils.join(fields,"String_Node_Str").contains(evalConfig.getDataSet().getTargetColumnName())) {
      isSchemaProvided=true;
      log.warn("String_Node_Str");
      log.warn("String_Node_Str");
    }
 else {
      isSchemaProvided=false;
      log.warn("String_Node_Str");
      log.warn("String_Node_Str");
      log.warn("String_Node_Str");
    }
  }
  for (int i=0; i < fields.length; i++) {
    if (!isSchemaProvided) {
      fields[i]=i + "String_Node_Str";
    }
 else {
      fields[i]=getRelativePigHeaderColumnName(fields[i]);
    }
  }
  return fields;
}