Program: 123816
Project: 123816
Buggy source:
private void prepareEmfTreeFromXml(XmlFileConnection connection){
  if (!connection.isInputModel()) {
    String file=connection.getXmlFilePath();
    List<FOXTreeNode> list=new ArrayList<FOXTreeNode>();
    File xmlFile=new File(file);
    if (xmlFile.exists()) {
      list=TreeUtil.getFoxTreeNodesForXmlMap(xmlFile.getAbsolutePath(),connection.getRoot().get(0).getXMLPath());
    }
 else     if (connection.getFileContent() != null && connection.getFileContent().length > 0) {
      String xsdFile=initFileContent(connection);
      if (xsdFile != null && new File(xsdFile).exists()) {
        list=TreeUtil.getFoxTreeNodesForXmlMap(xsdFile,connection.getRoot().get(0).getXMLPath());
      }
    }
    root=connection.getRoot();
    loop=connection.getLoop();
    group=connection.getGroup();
    groupElements=new ArrayList<TreeNode>();
    prepareModelFromOutput(list,schemaNode);
    if (outputLoop != null) {
      fillGroup(outputLoop,groupElements);
    }
 else {
      if (!schemaNode.getChildren().isEmpty()) {
        schemaNode.getChildren().get(0).setLoop(true);
      }
    }
  }
 else {
    List<SchemaTarget> schemaTargets=null;
    if (!connection.getSchema().isEmpty() && connection.getSchema().get(0) instanceof XmlXPathLoopDescriptorImpl) {
      absoluteXPathQuery=((XmlXPathLoopDescriptorImpl)connection.getSchema().get(0)).getAbsoluteXPathQuery();
      schemaTargets=((XmlXPathLoopDescriptorImpl)connection.getSchema().get(0)).getSchemaTargets();
    }
    if (schemaTargets == null || schemaTargets.isEmpty()) {
      return;
    }
    this.schemaTargets=schemaTargets;
    String file=connection.getXmlFilePath();
    List<FOXTreeNode> list=new ArrayList<FOXTreeNode>();
    File xmlFile=new File(file);
    if (xmlFile.exists()) {
      list=TreeUtil.getFoxTreeNodesForXmlMap(xmlFile.getAbsolutePath(),absoluteXPathQuery);
    }
 else     if (connection.getFileContent() != null && connection.getFileContent().length > 0) {
      String xsdFile=initFileContent(connection);
      if (xsdFile != null && new File(xsdFile).exists()) {
        list=TreeUtil.getFoxTreeNodesForXmlMap(xsdFile,absoluteXPathQuery);
      }
    }
    prepareEmfTree(list,schemaNode);
  }
}

Fixed version (ground truth):
private void prepareEmfTreeFromXml(XmlFileConnection connection){
  if (!connection.isInputModel()) {
    String file=connection.getXmlFilePath();
    List<FOXTreeNode> list=new ArrayList<FOXTreeNode>();
    File xmlFile=new File(file);
    if (xmlFile.exists()) {
      list=TreeUtil.getFoxTreeNodesForXmlMap(xmlFile.getAbsolutePath(),connection.getRoot().get(0).getXMLPath());
    }
 else     if (connection.getFileContent() != null && connection.getFileContent().length > 0) {
      String xsdFile=initFileContent(connection);
      if (xsdFile != null && new File(xsdFile).exists()) {
        list=TreeUtil.getFoxTreeNodesForXmlMap(xsdFile,connection.getRoot().get(0).getXMLPath());
      }
    }
    root=connection.getRoot();
    loop=connection.getLoop();
    group=connection.getGroup();
    groupElements=new ArrayList<TreeNode>();
    prepareModelFromOutput(list,schemaNode);
    if (loopNode != null) {
      fillGroup(loopNode,groupElements);
    }
 else {
      if (!schemaNode.getChildren().isEmpty()) {
        schemaNode.getChildren().get(0).setLoop(true);
      }
    }
  }
 else {
    List<SchemaTarget> schemaTargets=null;
    if (!connection.getSchema().isEmpty() && connection.getSchema().get(0) instanceof XmlXPathLoopDescriptorImpl) {
      absoluteXPathQuery=((XmlXPathLoopDescriptorImpl)connection.getSchema().get(0)).getAbsoluteXPathQuery();
      schemaTargets=((XmlXPathLoopDescriptorImpl)connection.getSchema().get(0)).getSchemaTargets();
    }
    if (schemaTargets == null || schemaTargets.isEmpty()) {
      return;
    }
    this.schemaTargets=schemaTargets;
    String file=connection.getXmlFilePath();
    List<FOXTreeNode> list=new ArrayList<FOXTreeNode>();
    File xmlFile=new File(file);
    if (xmlFile.exists()) {
      list=TreeUtil.getFoxTreeNodesForXmlMap(xmlFile.getAbsolutePath(),absoluteXPathQuery);
    }
 else     if (connection.getFileContent() != null && connection.getFileContent().length > 0) {
      String xsdFile=initFileContent(connection);
      if (xsdFile != null && new File(xsdFile).exists()) {
        list=TreeUtil.getFoxTreeNodesForXmlMap(xsdFile,absoluteXPathQuery);
      }
    }
    prepareEmfTree(list,schemaNode);
  }
}