Program: 86450
Project: 86450
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");
  Node node=(Node)expression.evaluate(xmlDoc,XPathConstants.NODE);
  if (node == null) {
    Element root=xmlDoc.getDocumentElement();
    node=xmlDoc.createElement("String_Node_Str");
    root.appendChild(node);
  }
  if (node.hasChildNodes()) {
    node.setTextContent(expression.evaluate(xmlDoc));
  }
 else {
    node.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));
        result.setSystemId(fileList.get(i).getAbsolutePath());
        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));
        result.setSystemId(fileList.get(i).getAbsolutePath());
        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));
        result.setSystemId(fileList.get(i).getAbsolutePath());
        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");
  Node node=(Node)expression.evaluate(xmlDoc,XPathConstants.NODE);
  if (node == null) {
    Element root=xmlDoc.getDocumentElement();
    node=xmlDoc.createElement("String_Node_Str");
    root.appendChild(node);
  }
  if (node.hasChildNodes()) {
    node.setTextContent(expression.evaluate(xmlDoc));
  }
 else {
    node.setTextContent(getComment(fileList.get(0)));
  }
  DOMSource source=new DOMSource(xmlDoc);
  StreamResult result=new StreamResult(fileList.get(0));
  result.setSystemId(fileList.get(0).getAbsolutePath());
  transformer.transform(source,result);
}