Program: 6744
Project: 6744
Buggy source:
@Test public void hijackConfFileTest() throws Exception {
  Configuration conf=new Configuration(false);
  conf.set("String_Node_Str","String_Node_Str");
  Assert.assertEquals(1,conf.size());
  File confFile=tmpFolder.newFile("String_Node_Str");
  try (FileOutputStream os=new FileOutputStream(confFile)){
    conf.writeXml(os);
  }
   File newConfFile=ExploreServiceUtils.hijackConfFile(confFile);
  conf=new Configuration(false);
  conf.addResource(newConfFile.toURI().toURL());
  Assert.assertEquals(3,conf.size());
  Assert.assertEquals("String_Node_Str",conf.get(Job.MAPREDUCE_JOB_USER_CLASSPATH_FIRST));
  Assert.assertEquals("String_Node_Str",conf.get(Job.MAPREDUCE_JOB_CLASSLOADER));
  Assert.assertEquals("String_Node_Str",conf.get("String_Node_Str"));
  confFile=tmpFolder.newFile("String_Node_Str");
  conf=new YarnConfiguration();
  try (FileOutputStream os=new FileOutputStream(confFile)){
    conf.writeXml(os);
  }
   String yarnApplicationClassPath="String_Node_Str" + conf.get(YarnConfiguration.YARN_APPLICATION_CLASSPATH,Joiner.on("String_Node_Str").join(YarnConfiguration.DEFAULT_YARN_APPLICATION_CLASSPATH));
  newConfFile=ExploreServiceUtils.hijackConfFile(confFile);
  conf=new Configuration(false);
  conf.addResource(newConfFile.toURI().toURL());
  Assert.assertEquals(yarnApplicationClassPath,conf.get(YarnConfiguration.YARN_APPLICATION_CLASSPATH));
  confFile=tmpFolder.newFile("String_Node_Str");
  conf=new YarnConfiguration();
  try (FileOutputStream os=new FileOutputStream(confFile)){
    conf.writeXml(os);
  }
   String mapredApplicationClassPath="String_Node_Str" + conf.get(MRJobConfig.MAPREDUCE_APPLICATION_CLASSPATH,MRJobConfig.DEFAULT_MAPREDUCE_APPLICATION_CLASSPATH);
  newConfFile=ExploreServiceUtils.hijackConfFile(confFile);
  conf=new Configuration(false);
  conf.addResource(newConfFile.toURI().toURL());
  Assert.assertEquals(mapredApplicationClassPath,conf.get(MRJobConfig.MAPREDUCE_APPLICATION_CLASSPATH));
  confFile=tmpFolder.newFile("String_Node_Str");
  Assert.assertEquals(confFile,ExploreServiceUtils.hijackConfFile(confFile));
}

Fixed version (ground truth):
@Test public void hijackConfFileTest() throws Exception {
  Configuration conf=new Configuration(false);
  conf.set("String_Node_Str","String_Node_Str");
  Assert.assertEquals(1,conf.size());
  File tempDir=tmpFolder.newFolder();
  File confFile=tmpFolder.newFile("String_Node_Str");
  try (FileOutputStream os=new FileOutputStream(confFile)){
    conf.writeXml(os);
  }
   File newConfFile=ExploreServiceUtils.updateConfFileForExplore(confFile,tempDir);
  conf=new Configuration(false);
  conf.addResource(newConfFile.toURI().toURL());
  Assert.assertEquals(3,conf.size());
  Assert.assertEquals("String_Node_Str",conf.get(Job.MAPREDUCE_JOB_USER_CLASSPATH_FIRST));
  Assert.assertEquals("String_Node_Str",conf.get(Job.MAPREDUCE_JOB_CLASSLOADER));
  Assert.assertEquals("String_Node_Str",conf.get("String_Node_Str"));
  confFile=tmpFolder.newFile("String_Node_Str");
  conf=new YarnConfiguration();
  try (FileOutputStream os=new FileOutputStream(confFile)){
    conf.writeXml(os);
  }
   String yarnApplicationClassPath="String_Node_Str" + conf.get(YarnConfiguration.YARN_APPLICATION_CLASSPATH,Joiner.on("String_Node_Str").join(YarnConfiguration.DEFAULT_YARN_APPLICATION_CLASSPATH));
  newConfFile=ExploreServiceUtils.updateConfFileForExplore(confFile,tempDir);
  conf=new Configuration(false);
  conf.addResource(newConfFile.toURI().toURL());
  Assert.assertEquals(yarnApplicationClassPath,conf.get(YarnConfiguration.YARN_APPLICATION_CLASSPATH));
  confFile=tmpFolder.newFile("String_Node_Str");
  conf=new YarnConfiguration();
  try (FileOutputStream os=new FileOutputStream(confFile)){
    conf.writeXml(os);
  }
   String mapredApplicationClassPath="String_Node_Str" + conf.get(MRJobConfig.MAPREDUCE_APPLICATION_CLASSPATH,MRJobConfig.DEFAULT_MAPREDUCE_APPLICATION_CLASSPATH);
  newConfFile=ExploreServiceUtils.updateConfFileForExplore(confFile,tempDir);
  conf=new Configuration(false);
  conf.addResource(newConfFile.toURI().toURL());
  Assert.assertEquals(mapredApplicationClassPath,conf.get(MRJobConfig.MAPREDUCE_APPLICATION_CLASSPATH));
  confFile=tmpFolder.newFile("String_Node_Str");
  Assert.assertEquals(confFile,ExploreServiceUtils.updateConfFileForExplore(confFile,tempDir));
}