Program: 13776
Project: 13776
Buggy source:
@Override public int run(String[] strings) throws Exception {
  int ret=1;
  try {
    Configuration halvadeConf=getConf();
    halvadeOpts=new HalvadeOptions();
    int optR=halvadeOpts.GetOptions(strings,halvadeConf);
    if (optR != 0)     return optR;
    if (halvadeOpts.justPut)     return 0;
    Job halvadeJob=new Job(halvadeConf,"String_Node_Str");
    halvadeJob.addCacheArchive(new URI(halvadeOpts.halvadeDir + "String_Node_Str"));
    halvadeJob.setJarByClass(be.ugent.intec.halvade.hadoop.mapreduce.BWAMemMapper.class);
    FileSystem fs=FileSystem.get(new URI(halvadeOpts.in),halvadeConf);
    try {
      if (fs.getFileStatus(new Path(halvadeOpts.in)).isDirectory()) {
        FileStatus[] files=fs.listStatus(new Path(halvadeOpts.in));
        for (        FileStatus file : files) {
          if (!file.isDirectory()) {
            FileInputFormat.addInputPath(halvadeJob,file.getPath());
          }
        }
      }
 else {
        FileInputFormat.addInputPath(halvadeJob,new Path(halvadeOpts.in));
      }
    }
 catch (    Exception e) {
      Logger.EXCEPTION(e);
    }
    FileOutputFormat.setOutputPath(halvadeJob,new Path(halvadeOpts.out));
    if (halvadeOpts.aln)     halvadeJob.setMapperClass(be.ugent.intec.halvade.hadoop.mapreduce.BWAAlnMapper.class);
 else     halvadeJob.setMapperClass(be.ugent.intec.halvade.hadoop.mapreduce.BWAMemMapper.class);
    halvadeJob.setMapOutputKeyClass(ChromosomeRegion.class);
    halvadeJob.setMapOutputValueClass(SAMRecordWritable.class);
    halvadeJob.setInputFormatClass(TextInputFormat.class);
    halvadeJob.setPartitionerClass(ChrRgPartitioner.class);
    halvadeJob.setSortComparatorClass(ChrRgPositionComparator.class);
    halvadeJob.setGroupingComparatorClass(ChrRgRegionComparator.class);
    if (halvadeOpts.justAlign)     halvadeJob.setNumReduceTasks(0);
 else     halvadeJob.setNumReduceTasks(halvadeOpts.reducers);
    halvadeJob.setReducerClass(be.ugent.intec.halvade.hadoop.mapreduce.GATKReducer.class);
    halvadeJob.setOutputKeyClass(Text.class);
    halvadeJob.setOutputValueClass(VariantContextWritable.class);
    if (halvadeOpts.dryRun)     return 0;
    Timer timer=new Timer();
    timer.start();
    ret=halvadeJob.waitForCompletion(true) ? 0 : 1;
    timer.stop();
    Logger.DEBUG("String_Node_Str" + timer);
    if (halvadeOpts.combineVcf && ret == 0) {
      Logger.DEBUG("String_Node_Str");
      Configuration combineConf=getConf();
      if (!halvadeOpts.out.endsWith("String_Node_Str"))       halvadeOpts.out+="String_Node_Str";
      MyConf.setInputDir(combineConf,halvadeOpts.out);
      MyConf.setOutDir(combineConf,halvadeOpts.out + "String_Node_Str");
      MyConf.setReportAllVariant(combineConf,halvadeOpts.reportAll);
      Job combineJob=new Job(combineConf,"String_Node_Str");
      combineJob.setJarByClass(be.ugent.intec.halvade.hadoop.mapreduce.VCFCombineMapper.class);
      try {
        if (fs.getFileStatus(new Path(halvadeOpts.out)).isDirectory()) {
          FileStatus[] files=fs.listStatus(new Path(halvadeOpts.out));
          for (          FileStatus file : files) {
            if (!file.isDirectory() && file.getPath().getName().endsWith("String_Node_Str")) {
              FileInputFormat.addInputPath(combineJob,file.getPath());
            }
          }
        }
      }
 catch (      Exception e) {
        Logger.EXCEPTION(e);
      }
      FileOutputFormat.setOutputPath(combineJob,new Path(halvadeOpts.out + "String_Node_Str"));
      combineJob.setMapperClass(be.ugent.intec.halvade.hadoop.mapreduce.VCFCombineMapper.class);
      combineJob.setMapOutputKeyClass(LongWritable.class);
      combineJob.setMapOutputValueClass(VariantContextWritable.class);
      combineJob.setInputFormatClass(VCFInputFormat.class);
      combineJob.setNumReduceTasks(1);
      combineJob.setReducerClass(be.ugent.intec.halvade.hadoop.mapreduce.VCFCombineReducer.class);
      combineJob.setOutputKeyClass(Text.class);
      combineJob.setOutputValueClass(VariantContextWritable.class);
      timer=new Timer();
      timer.start();
      ret=combineJob.waitForCompletion(true) ? 0 : 1;
      timer.stop();
      Logger.DEBUG("String_Node_Str" + timer);
    }
 else {
    }
  }
 catch (  Exception e) {
    Logger.EXCEPTION(e);
  }
  return ret;
}

Fixed version (ground truth):
@Override public int run(String[] strings) throws Exception {
  int ret=1;
  try {
    Configuration halvadeConf=getConf();
    halvadeOpts=new HalvadeOptions();
    int optR=halvadeOpts.GetOptions(strings,halvadeConf);
    if (optR != 0)     return optR;
    Job halvadeJob=Job.getInstance(halvadeConf,"String_Node_Str");
    halvadeJob.addCacheArchive(new URI(halvadeOpts.halvadeBinaries));
    halvadeJob.setJarByClass(be.ugent.intec.halvade.hadoop.mapreduce.HalvadeMapper.class);
    FileSystem fs=FileSystem.get(new URI(halvadeOpts.in),halvadeConf);
    try {
      if (fs.getFileStatus(new Path(halvadeOpts.in)).isDirectory()) {
        FileStatus[] files=fs.listStatus(new Path(halvadeOpts.in));
        for (        FileStatus file : files) {
          if (!file.isDirectory()) {
            FileInputFormat.addInputPath(halvadeJob,file.getPath());
          }
        }
      }
 else {
        FileInputFormat.addInputPath(halvadeJob,new Path(halvadeOpts.in));
      }
    }
 catch (    Exception e) {
      Logger.EXCEPTION(e);
    }
    FileOutputFormat.setOutputPath(halvadeJob,new Path(halvadeOpts.out));
    if (halvadeOpts.rnaPipeline)     halvadeJob.setMapperClass(be.ugent.intec.halvade.hadoop.mapreduce.StarAlignMapper.class);
 else {
      if (halvadeOpts.aln)       halvadeJob.setMapperClass(be.ugent.intec.halvade.hadoop.mapreduce.BWAAlnMapper.class);
 else       halvadeJob.setMapperClass(be.ugent.intec.halvade.hadoop.mapreduce.BWAMemMapper.class);
    }
    halvadeJob.setMapOutputKeyClass(ChromosomeRegion.class);
    halvadeJob.setMapOutputValueClass(SAMRecordWritable.class);
    halvadeJob.setInputFormatClass(TextInputFormat.class);
    halvadeJob.setPartitionerClass(ChrRgPartitioner.class);
    halvadeJob.setSortComparatorClass(ChrRgPositionComparator.class);
    halvadeJob.setGroupingComparatorClass(ChrRgRegionComparator.class);
    if (halvadeOpts.justAlign)     halvadeJob.setNumReduceTasks(0);
 else     halvadeJob.setNumReduceTasks(halvadeOpts.reducers);
    if (halvadeOpts.rnaPipeline)     halvadeJob.setReducerClass(be.ugent.intec.halvade.hadoop.mapreduce.RnaGATKReducer.class);
 else     halvadeJob.setReducerClass(be.ugent.intec.halvade.hadoop.mapreduce.DnaGATKReducer.class);
    halvadeJob.setOutputKeyClass(Text.class);
    halvadeJob.setOutputValueClass(VariantContextWritable.class);
    if (halvadeOpts.dryRun)     return 0;
    Timer timer=new Timer();
    timer.start();
    ret=halvadeJob.waitForCompletion(true) ? 0 : 1;
    timer.stop();
    Logger.DEBUG("String_Node_Str" + timer);
    if (halvadeOpts.combineVcf && ret == 0) {
      Logger.DEBUG("String_Node_Str");
      Configuration combineConf=getConf();
      if (!halvadeOpts.out.endsWith("String_Node_Str"))       halvadeOpts.out+="String_Node_Str";
      HalvadeConf.setInputDir(combineConf,halvadeOpts.out);
      HalvadeConf.setOutDir(combineConf,halvadeOpts.out + "String_Node_Str");
      HalvadeConf.setReportAllVariant(combineConf,halvadeOpts.reportAll);
      Job combineJob=new Job(combineConf,"String_Node_Str");
      combineJob.setJarByClass(be.ugent.intec.halvade.hadoop.mapreduce.VCFCombineMapper.class);
      try {
        if (fs.getFileStatus(new Path(halvadeOpts.out)).isDirectory()) {
          FileStatus[] files=fs.listStatus(new Path(halvadeOpts.out));
          for (          FileStatus file : files) {
            if (!file.isDirectory() && file.getPath().getName().endsWith("String_Node_Str")) {
              FileInputFormat.addInputPath(combineJob,file.getPath());
            }
          }
        }
      }
 catch (      Exception e) {
        Logger.EXCEPTION(e);
      }
      FileOutputFormat.setOutputPath(combineJob,new Path(halvadeOpts.out + "String_Node_Str"));
      combineJob.setMapperClass(be.ugent.intec.halvade.hadoop.mapreduce.VCFCombineMapper.class);
      combineJob.setMapOutputKeyClass(LongWritable.class);
      combineJob.setMapOutputValueClass(VariantContextWritable.class);
      combineJob.setInputFormatClass(VCFInputFormat.class);
      combineJob.setNumReduceTasks(1);
      combineJob.setReducerClass(be.ugent.intec.halvade.hadoop.mapreduce.VCFCombineReducer.class);
      combineJob.setOutputKeyClass(Text.class);
      combineJob.setOutputValueClass(VariantContextWritable.class);
      timer=new Timer();
      timer.start();
      ret=combineJob.waitForCompletion(true) ? 0 : 1;
      timer.stop();
      Logger.DEBUG("String_Node_Str" + timer);
    }
 else {
    }
  }
 catch (  Exception e) {
    Logger.EXCEPTION(e);
  }
  return ret;
}