Program: 86455
Project: 86455
Buggy source:
public static void configurePackage(String env,File configFile) throws Exception {
  Logger logger=LoggerFactory.getLogger(PackageConfigurer.class);
  TransformerFactory transformerFactory=TransformerFactory.newInstance();
  Transformer transformer=transformerFactory.newTransformer();
  XMLFileListUtil listFileUtil=new XMLFileListUtil();
  List<File> fileList=listFileUtil.getProxyFiles(configFile);
  FileReader fileutil=new FileReader();
  ConfigTokens conf=fileutil.getBundleConfigs(configFile);
  for (int i=0; i < fileList.size(); i++) {
    Document xmlDoc=fileutil.getXMLDocument(fileList.get(i));
    try {
      Policy configTokens=conf.getConfigbyEnv(env).getProxyFileNameMatch(fileList.get(i).getName());
      if (configTokens != null) {
        logger.info("String_Node_Str",env,fileList.get(i).getName());
        xmlDoc=replaceTokens(xmlDoc,configTokens);
        DOMSource source=new DOMSource(xmlDoc);
        StreamResult result=new StreamResult(fileList.get(i));
        transformer.transform(source,result);
      }
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",env,fileList.get(i).getName());
      throw e;
    }
  }
  fileList=listFileUtil.getPolicyFiles(configFile);
  for (int i=0; i < fileList.size(); i++) {
    Document xmlDoc=fileutil.getXMLDocument(fileList.get(i));
    try {
      Policy configTokens=conf.getConfigbyEnv(env).getPolicyFileNameMatch(fileList.get(i).getName());
      if (configTokens != null) {
        logger.info("String_Node_Str",env,fileList.get(i).getName());
        xmlDoc=replaceTokens(xmlDoc,configTokens);
        DOMSource source=new DOMSource(xmlDoc);
        StreamResult result=new StreamResult(fileList.get(i));
        transformer.transform(source,result);
      }
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",env,fileList.get(i).getName());
      throw e;
    }
  }
  fileList=listFileUtil.getTargetFiles(configFile);
  for (int i=0; i < fileList.size(); i++) {
    Document xmlDoc=fileutil.getXMLDocument(fileList.get(i));
    try {
      Policy configTokens=conf.getConfigbyEnv(env).getTargetFileNameMatch(fileList.get(i).getName());
      if (configTokens != null) {
        logger.info("String_Node_Str",env,fileList.get(i).getName());
        xmlDoc=replaceTokens(xmlDoc,configTokens);
        DOMSource source=new DOMSource(xmlDoc);
        StreamResult result=new StreamResult(fileList.get(i));
        transformer.transform(source,result);
      }
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",env,fileList.get(i).getName());
      throw e;
    }
  }
  fileList=listFileUtil.getAPIProxyFiles(configFile);
  Document xmlDoc=fileutil.getXMLDocument(fileList.get(0));
  javax.xml.xpath.XPathFactory factory=javax.xml.xpath.XPathFactory.newInstance();
  javax.xml.xpath.XPath xpath=factory.newXPath();
  javax.xml.xpath.XPathExpression expression=xpath.compile("String_Node_Str");
  NodeList nodes=(NodeList)expression.evaluate(xmlDoc,XPathConstants.NODESET);
  if (nodes.item(0).hasChildNodes()) {
    String orginialText="String_Node_Str";
    orginialText=nodes.item(0).getTextContent();
    nodes.item(0).setTextContent(getComment(fileList.get(0)) + "String_Node_Str" + orginialText);
  }
 else {
    nodes.item(0).setTextContent(getComment(fileList.get(0)));
  }
  DOMSource source=new DOMSource(xmlDoc);
  StreamResult result=new StreamResult(fileList.get(0));
  transformer.transform(source,result);
}

Fixed version (ground truth):
public static void configurePackage(String env,File configFile) throws Exception {
  Logger logger=LoggerFactory.getLogger(PackageConfigurer.class);
  TransformerFactory transformerFactory=TransformerFactory.newInstance();
  Transformer transformer=transformerFactory.newTransformer();
  XMLFileListUtil listFileUtil=new XMLFileListUtil();
  List<File> fileList=listFileUtil.getProxyFiles(configFile);
  FileReader fileutil=new FileReader();
  ConfigTokens conf=fileutil.getBundleConfigs(configFile);
  for (int i=0; i < fileList.size(); i++) {
    Document xmlDoc=fileutil.getXMLDocument(fileList.get(i));
    try {
      Policy configTokens=conf.getConfigbyEnv(env).getProxyFileNameMatch(fileList.get(i).getName());
      if (configTokens != null) {
        logger.info("String_Node_Str",env,fileList.get(i).getName());
        xmlDoc=replaceTokens(xmlDoc,configTokens);
        DOMSource source=new DOMSource(xmlDoc);
        StreamResult result=new StreamResult(fileList.get(i));
        transformer.transform(source,result);
      }
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",env,fileList.get(i).getName());
      throw e;
    }
  }
  fileList=listFileUtil.getPolicyFiles(configFile);
  for (int i=0; i < fileList.size(); i++) {
    Document xmlDoc=fileutil.getXMLDocument(fileList.get(i));
    try {
      Policy configTokens=conf.getConfigbyEnv(env).getPolicyFileNameMatch(fileList.get(i).getName());
      if (configTokens != null) {
        logger.info("String_Node_Str",env,fileList.get(i).getName());
        xmlDoc=replaceTokens(xmlDoc,configTokens);
        DOMSource source=new DOMSource(xmlDoc);
        StreamResult result=new StreamResult(fileList.get(i));
        transformer.transform(source,result);
      }
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",env,fileList.get(i).getName());
      throw e;
    }
  }
  fileList=listFileUtil.getTargetFiles(configFile);
  for (int i=0; i < fileList.size(); i++) {
    Document xmlDoc=fileutil.getXMLDocument(fileList.get(i));
    try {
      Policy configTokens=conf.getConfigbyEnv(env).getTargetFileNameMatch(fileList.get(i).getName());
      if (configTokens != null) {
        logger.info("String_Node_Str",env,fileList.get(i).getName());
        xmlDoc=replaceTokens(xmlDoc,configTokens);
        DOMSource source=new DOMSource(xmlDoc);
        StreamResult result=new StreamResult(fileList.get(i));
        transformer.transform(source,result);
      }
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",env,fileList.get(i).getName());
      throw e;
    }
  }
  fileList=listFileUtil.getAPIProxyFiles(configFile);
  Document xmlDoc=fileutil.getXMLDocument(fileList.get(0));
  javax.xml.xpath.XPathFactory factory=javax.xml.xpath.XPathFactory.newInstance();
  javax.xml.xpath.XPath xpath=factory.newXPath();
  javax.xml.xpath.XPathExpression expression=xpath.compile("String_Node_Str");
  NodeList nodes=(NodeList)expression.evaluate(xmlDoc,XPathConstants.NODESET);
  if (nodes.item(0).hasChildNodes()) {
    nodes.item(0).setTextContent(expression.evaluate(xmlDoc));
  }
 else {
    nodes.item(0).setTextContent(getComment(fileList.get(0)));
  }
  DOMSource source=new DOMSource(xmlDoc);
  StreamResult result=new StreamResult(fileList.get(0));
  transformer.transform(source,result);
}