Program: 59406
Project: 59406
Buggy source:
@Override public void updateWebXmlFile(){
  String webXmlPath=projectOperations.getPathResolver().getIdentifier(LogicalPath.getInstance(Path.SRC_MAIN_WEBAPP,"String_Node_Str"),"String_Node_Str");
  Validate.isTrue(fileManager.exists(webXmlPath),"String_Node_Str");
  MutableFile webXmlMutableFile=null;
  Document webXml;
  try {
    webXmlMutableFile=fileManager.updateFile(webXmlPath);
    webXml=XmlUtils.getDocumentBuilder().parse(webXmlMutableFile.getInputStream());
  }
 catch (  Exception e) {
    throw new IllegalStateException(e);
  }
  Element root=webXml.getDocumentElement();
  boolean modified=false;
  Element filter=XmlUtils.findFirstElement("String_Node_Str",root);
  if (filter == null) {
    insertXmlElement(webXml,root,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
    modified=true;
  }
  Element filterMapping=XmlUtils.findFirstElement("String_Node_Str",root);
  if (filterMapping == null) {
    insertXmlElement(webXml,root,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
    modified=true;
  }
  Element servlet=XmlUtils.findFirstElement("String_Node_Str",root);
  if (servlet == null) {
    insertXmlElement(webXml,root,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
    modified=true;
  }
  Element servletMapping=XmlUtils.findFirstElement("String_Node_Str",root);
  if (servletMapping == null) {
    insertXmlElement(webXml,root,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
    modified=true;
  }
  if (modified) {
    XmlUtils.writeXml(webXmlMutableFile.getOutputStream(),webXml);
  }
}

Fixed version (ground truth):
@Override public void updateWebXmlFile(){
  LogicalPath webappPath=WebProjectUtils.getWebappPath(projectOperations);
  String webXmlPath=projectOperations.getPathResolver().getIdentifier(webappPath,"String_Node_Str");
  Validate.isTrue(fileManager.exists(webXmlPath),"String_Node_Str");
  MutableFile webXmlMutableFile=null;
  Document webXml;
  try {
    webXmlMutableFile=fileManager.updateFile(webXmlPath);
    webXml=XmlUtils.getDocumentBuilder().parse(webXmlMutableFile.getInputStream());
  }
 catch (  Exception e) {
    throw new IllegalStateException(e);
  }
  Element root=webXml.getDocumentElement();
  boolean modified=false;
  Element filter=XmlUtils.findFirstElement("String_Node_Str",root);
  if (filter == null) {
    insertXmlElement(webXml,root,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
    modified=true;
  }
  Element filterMapping=XmlUtils.findFirstElement("String_Node_Str",root);
  if (filterMapping == null) {
    insertXmlElement(webXml,root,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
    modified=true;
  }
  Element servlet=XmlUtils.findFirstElement("String_Node_Str",root);
  if (servlet == null) {
    insertXmlElement(webXml,root,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
    modified=true;
  }
  Element servletMapping=XmlUtils.findFirstElement("String_Node_Str",root);
  if (servletMapping == null) {
    insertXmlElement(webXml,root,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
    modified=true;
  }
  if (modified) {
    XmlUtils.writeXml(webXmlMutableFile.getOutputStream(),webXml);
  }
}