Program: 61040
Project: 61040
Buggy source:
/** 
 * Run an ImportTsv job and perform basic validation on the results. Returns the ImportTsv <code>Tool</code> instance so that other tests can inspect it for further validation as necessary. This method is static to insure non-reliance on instance's util/conf facilities.
 * @param args Any arguments to pass BEFORE inputFile path is appended.
 * @return The Tool instance used to run the test.
 */
protected static Tool doMROnTableTest(HBaseTestingUtility util,TableName table,String family,String data,Map<String,String> args,int valueMultiplier,int expectedKVCount) throws Exception {
  Configuration conf=new Configuration(util.getConfiguration());
  FileSystem fs=FileSystem.get(conf);
  Path inputPath=fs.makeQualified(new Path(util.getDataTestDirOnTestFS(table.getNameAsString()),"String_Node_Str"));
  FSDataOutputStream op=fs.create(inputPath,true);
  if (data == null) {
    data="String_Node_Str";
  }
  op.write(Bytes.toBytes(data));
  op.close();
  LOG.debug(String.format("String_Node_Str",inputPath));
  if (conf.getBoolean(FORCE_COMBINER_CONF,true)) {
    LOG.debug("String_Node_Str");
    conf.setInt("String_Node_Str",1);
  }
  String[] argsArray=new String[args.size() + 2];
  Iterator it=args.entrySet().iterator();
  int i=0;
  while (it.hasNext()) {
    Map.Entry pair=(Map.Entry)it.next();
    argsArray[i]="String_Node_Str" + pair.getKey() + "String_Node_Str"+ pair.getValue();
    i++;
  }
  argsArray[i]=table.getNameAsString();
  argsArray[i + 1]=inputPath.toString();
  Tool tool=new ImportTsv();
  LOG.debug("String_Node_Str" + argsArray);
  assertEquals(0,ToolRunner.run(conf,tool,argsArray));
  boolean isDryRun=args.containsKey(ImportTsv.DRY_RUN_CONF_KEY) && "String_Node_Str".equalsIgnoreCase(args.get(ImportTsv.DRY_RUN_CONF_KEY));
  if (args.containsKey(ImportTsv.BULK_OUTPUT_CONF_KEY)) {
    if (isDryRun) {
      assertFalse(String.format("String_Node_Str",ImportTsv.BULK_OUTPUT_CONF_KEY),fs.exists(new Path(ImportTsv.BULK_OUTPUT_CONF_KEY)));
    }
 else {
      validateHFiles(fs,args.get(ImportTsv.BULK_OUTPUT_CONF_KEY),family,expectedKVCount);
    }
  }
 else {
    validateTable(conf,table,family,valueMultiplier,isDryRun);
  }
  if (conf.getBoolean(DELETE_AFTER_LOAD_CONF,true)) {
    LOG.debug("String_Node_Str");
    util.cleanupDataTestDirOnTestFS(table.getNameAsString());
  }
  return tool;
}

Fixed version (ground truth):
/** 
 * Run an ImportTsv job and perform basic validation on the results. Returns the ImportTsv <code>Tool</code> instance so that other tests can inspect it for further validation as necessary. This method is static to insure non-reliance on instance's util/conf facilities.
 * @param args Any arguments to pass BEFORE inputFile path is appended.
 * @return The Tool instance used to run the test.
 */
protected static Tool doMROnTableTest(HBaseTestingUtility util,TableName table,String family,String data,Map<String,String> args,int valueMultiplier,int expectedKVCount) throws Exception {
  Configuration conf=new Configuration(util.getConfiguration());
  FileSystem fs=FileSystem.get(conf);
  Path inputPath=fs.makeQualified(new Path(util.getDataTestDirOnTestFS(table.getNameAsString()),"String_Node_Str"));
  FSDataOutputStream op=fs.create(inputPath,true);
  if (data == null) {
    data="String_Node_Str";
  }
  op.write(Bytes.toBytes(data));
  op.close();
  LOG.debug(String.format("String_Node_Str",inputPath));
  if (conf.getBoolean(FORCE_COMBINER_CONF,true)) {
    LOG.debug("String_Node_Str");
    conf.setInt("String_Node_Str",1);
  }
  String[] argsArray=new String[args.size() + 2];
  Iterator it=args.entrySet().iterator();
  int i=0;
  while (it.hasNext()) {
    Map.Entry pair=(Map.Entry)it.next();
    argsArray[i]="String_Node_Str" + pair.getKey() + "String_Node_Str"+ pair.getValue();
    i++;
  }
  argsArray[i]=table.getNameAsString();
  argsArray[i + 1]=inputPath.toString();
  Tool tool=new ImportTsv();
  LOG.debug("String_Node_Str" + Arrays.toString(argsArray));
  assertEquals(0,ToolRunner.run(conf,tool,argsArray));
  boolean isDryRun=args.containsKey(ImportTsv.DRY_RUN_CONF_KEY) && "String_Node_Str".equalsIgnoreCase(args.get(ImportTsv.DRY_RUN_CONF_KEY));
  if (args.containsKey(ImportTsv.BULK_OUTPUT_CONF_KEY)) {
    if (isDryRun) {
      assertFalse(String.format("String_Node_Str",ImportTsv.BULK_OUTPUT_CONF_KEY),fs.exists(new Path(ImportTsv.BULK_OUTPUT_CONF_KEY)));
    }
 else {
      validateHFiles(fs,args.get(ImportTsv.BULK_OUTPUT_CONF_KEY),family,expectedKVCount);
    }
  }
 else {
    validateTable(conf,table,family,valueMultiplier,isDryRun);
  }
  if (conf.getBoolean(DELETE_AFTER_LOAD_CONF,true)) {
    LOG.debug("String_Node_Str");
    util.cleanupDataTestDirOnTestFS(table.getNameAsString());
  }
  return tool;
}