Program: 109557
Project: 109557
Buggy source:
@Override public boolean evaluate(final GraphRewrite event,final EvaluationContext context){
  List<WindupVertexFrame> resultLocations=new ArrayList<WindupVertexFrame>();
  GraphContext graphContext=event.getGraphContext();
  GraphService<XmlFileModel> xmlResourceService=new GraphService<XmlFileModel>(graphContext,XmlFileModel.class);
  Iterable<? extends WindupVertexFrame> allXmls;
  if (fromVariables == null || fromVariables.equals("String_Node_Str")) {
    allXmls=xmlResourceService.findAll();
  }
 else {
    allXmls=Variables.instance(event).findVariable(fromVariables);
  }
  for (  WindupVertexFrame iterated : allXmls) {
    XmlFileModel xml=null;
    if (iterated instanceof FileReferenceModel) {
      xml=(XmlFileModel)((FileReferenceModel)iterated).getFile();
    }
 else     if (iterated instanceof XmlFileModel) {
      xml=(XmlFileModel)iterated;
    }
 else {
      throw new WindupException("String_Node_Str" + iterated.toPrettyString() + "String_Node_Str");
    }
    if (fileName != null && !fileName.equals("String_Node_Str")) {
      if (!xml.getFileName().equals(fileName)) {
        continue;
      }
    }
    if (publicId != null && !publicId.equals("String_Node_Str")) {
      if (xml.getDoctype() == null || xml.getDoctype().getPublicId() == null || !xml.getDoctype().getPublicId().matches(publicId)) {
        continue;
      }
    }
    if (xpath != null) {
      try {
        Document document=xml.asDocument();
        NodeList result=XmlUtil.xpathNodeList(document,xpath,namespaces);
        List<String> lines=Files.readAllLines(Paths.get(xml.getFilePath()),Charset.defaultCharset());
        if (result != null && (result.getLength() != 0)) {
          for (int i=0; i < result.getLength(); i++) {
            Node node=result.item(i);
            if (xpathResultMatch != null) {
              if (!node.toString().matches(xpathResultMatch)) {
                continue;
              }
            }
            int lineNumber=(int)node.getUserData(LocationAwareContentHandler.LINE_NUMBER_KEY_NAME);
            int columnNumber=(int)node.getUserData(LocationAwareContentHandler.COLUMN_NUMBER_KEY_NAME);
            int lineLength=lines.get(lineNumber - 1).length();
            graphContext=event.getGraphContext();
            GraphService<XmlTypeReferenceModel> fileLocationService=new GraphService<XmlTypeReferenceModel>(graphContext,XmlTypeReferenceModel.class);
            XmlTypeReferenceModel fileLocation=fileLocationService.create();
            fileLocation.setLineNumber(lineNumber);
            fileLocation.setColumnNumber(columnNumber);
            fileLocation.setLength(lineLength);
            fileLocation.setFile(xml);
            fileLocation.setXpath(xpath);
            GraphService<NamespaceMetaModel> metaModelService=new GraphService<NamespaceMetaModel>(graphContext,NamespaceMetaModel.class);
            for (            Map.Entry<String,String> namespace : namespaces.entrySet()) {
              NamespaceMetaModel metaModel=metaModelService.create();
              metaModel.setSchemaLocation(namespace.getKey());
              metaModel.setSchemaLocation(namespace.getValue());
              metaModel.addXmlResource(xml);
              fileLocation.addNamespace(metaModel);
            }
            resultLocations.add(fileLocation);
          }
        }
      }
 catch (      MarshallingException e) {
        GraphService<ClassificationModel> classificationService=new GraphService<>(event.getGraphContext(),ClassificationModel.class);
        ClassificationModel classification=classificationService.getUniqueByProperty(ClassificationModel.PROPERTY_CLASSIFICATION,XmlFile.UNPARSEABLE_XML_CLASSIFICATION);
        if (classification == null) {
          classification=classificationService.create();
          classification.setDescription(XmlFile.UNPARSEABLE_XML_DESCRIPTION);
          classification.setClassifiation(XmlFile.UNPARSEABLE_XML_CLASSIFICATION);
          classification.setRuleID(((Rule)context.get(Rule.class)).getId());
        }
        classification.addFileModel(xml);
      }
catch (      IOException e) {
        throw new WindupException("String_Node_Str",e);
      }
    }
  }
  Variables.instance(event).setVariable(variable,resultLocations);
  return !resultLocations.isEmpty();
}

Fixed version (ground truth):
@Override public boolean evaluate(final GraphRewrite event,final EvaluationContext context){
  List<WindupVertexFrame> resultLocations=new ArrayList<WindupVertexFrame>();
  GraphContext graphContext=event.getGraphContext();
  GraphService<XmlFileModel> xmlResourceService=new GraphService<XmlFileModel>(graphContext,XmlFileModel.class);
  Iterable<? extends WindupVertexFrame> allXmls;
  if (fromVariable == null || fromVariable.equals("String_Node_Str")) {
    allXmls=xmlResourceService.findAll();
  }
 else {
    allXmls=Variables.instance(event).findVariable(fromVariable);
  }
  for (  WindupVertexFrame iterated : allXmls) {
    XmlFileModel xml=null;
    if (iterated instanceof FileReferenceModel) {
      xml=(XmlFileModel)((FileReferenceModel)iterated).getFile();
    }
 else     if (iterated instanceof XmlFileModel) {
      xml=(XmlFileModel)iterated;
    }
 else {
      throw new WindupException("String_Node_Str" + iterated.toPrettyString() + "String_Node_Str");
    }
    if (fileName != null && !fileName.equals("String_Node_Str")) {
      if (!xml.getFileName().equals(fileName)) {
        continue;
      }
    }
    if (publicId != null && !publicId.equals("String_Node_Str")) {
      if (xml.getDoctype() == null || xml.getDoctype().getPublicId() == null || !xml.getDoctype().getPublicId().matches(publicId)) {
        continue;
      }
    }
    if (xpath != null) {
      try {
        Document document=xml.asDocument();
        NodeList result=XmlUtil.xpathNodeList(document,xpath,namespaces);
        List<String> lines=Files.readAllLines(Paths.get(xml.getFilePath()),Charset.defaultCharset());
        if (result != null && (result.getLength() != 0)) {
          for (int i=0; i < result.getLength(); i++) {
            Node node=result.item(i);
            if (xpathResultMatch != null) {
              if (!node.toString().matches(xpathResultMatch)) {
                continue;
              }
            }
            int lineNumber=(int)node.getUserData(LocationAwareContentHandler.LINE_NUMBER_KEY_NAME);
            int columnNumber=(int)node.getUserData(LocationAwareContentHandler.COLUMN_NUMBER_KEY_NAME);
            int lineLength=lines.get(lineNumber - 1).length();
            graphContext=event.getGraphContext();
            GraphService<XmlTypeReferenceModel> fileLocationService=new GraphService<XmlTypeReferenceModel>(graphContext,XmlTypeReferenceModel.class);
            XmlTypeReferenceModel fileLocation=fileLocationService.create();
            fileLocation.setLineNumber(lineNumber);
            fileLocation.setColumnNumber(columnNumber);
            fileLocation.setLength(lineLength);
            fileLocation.setFile(xml);
            fileLocation.setXpath(xpath);
            GraphService<NamespaceMetaModel> metaModelService=new GraphService<NamespaceMetaModel>(graphContext,NamespaceMetaModel.class);
            for (            Map.Entry<String,String> namespace : namespaces.entrySet()) {
              NamespaceMetaModel metaModel=metaModelService.create();
              metaModel.setSchemaLocation(namespace.getKey());
              metaModel.setSchemaLocation(namespace.getValue());
              metaModel.addXmlResource(xml);
              fileLocation.addNamespace(metaModel);
            }
            resultLocations.add(fileLocation);
          }
        }
      }
 catch (      MarshallingException e) {
        GraphService<ClassificationModel> classificationService=new GraphService<>(event.getGraphContext(),ClassificationModel.class);
        ClassificationModel classification=classificationService.getUniqueByProperty(ClassificationModel.PROPERTY_CLASSIFICATION,XmlFile.UNPARSEABLE_XML_CLASSIFICATION);
        if (classification == null) {
          classification=classificationService.create();
          classification.setDescription(XmlFile.UNPARSEABLE_XML_DESCRIPTION);
          classification.setClassifiation(XmlFile.UNPARSEABLE_XML_CLASSIFICATION);
          classification.setRuleID(((Rule)context.get(Rule.class)).getId());
        }
        classification.addFileModel(xml);
      }
catch (      IOException e) {
        throw new WindupException("String_Node_Str",e);
      }
    }
  }
  Variables.instance(event).setVariable(variable,resultLocations);
  return !resultLocations.isEmpty();
}