Program: 124276
Project: 124276
Buggy source:
private void prepareEmfTree(List<FOXTreeNode> list,TreeNode parent,String xmlPath,String absoluteXPathQuery){
  if (list == null || list.isEmpty()) {
    return;
  }
  String xPath=parent.getXpath();
  for (  FOXTreeNode foxNode : list) {
    TreeNode createTreeNode=createModel();
    createTreeNode.setName(foxNode.getLabel());
    if (foxNode instanceof Element) {
      createTreeNode.setNodeType(NodeType.ELEMENT);
    }
 else     if (foxNode instanceof Attribute) {
      createTreeNode.setNodeType(NodeType.ATTRIBUT);
    }
 else     if (foxNode instanceof NameSpaceNode) {
      createTreeNode.setNodeType(NodeType.NAME_SPACE);
      createTreeNode.setDefaultValue(foxNode.getDefaultValue());
      if (createTreeNode.getName() == null || createTreeNode.getName().equals("String_Node_Str")) {
        createTreeNode.setName(XmlMapUtil.DEFAULT_NAME_SPACE_PREFIX);
      }
    }
    createTreeNode.setXpath(XmlMapUtil.getXPath(xPath,createTreeNode.getName(),createTreeNode.getNodeType()));
    if (foxNode.getDataType() != null && "String_Node_Str".equals(foxNode.getDataType())) {
      createTreeNode.setType(foxNode.getDataType());
    }
 else {
      createTreeNode.setType(XmlMapUtil.DEFAULT_DATA_TYPE);
    }
    String tempXpath=null;
    if (xmlPath == null) {
      if (foxNode instanceof Attribute) {
        tempXpath=XmlMapUtil.XPATH_SEPARATOR + XmlMapUtil.XPATH_ATTRIBUTE + foxNode.getLabel();
      }
 else {
        tempXpath=XmlMapUtil.XPATH_SEPARATOR + foxNode.getLabel();
      }
    }
 else {
      if (foxNode instanceof Attribute) {
        tempXpath=xmlPath + XmlMapUtil.XPATH_SEPARATOR + XmlMapUtil.XPATH_ATTRIBUTE+ foxNode.getLabel();
      }
 else {
        tempXpath=xmlPath + XmlMapUtil.XPATH_SEPARATOR + foxNode.getLabel();
      }
    }
    if (tempXpath.equals(absoluteXPathQuery)) {
      if (!(parent.eContainer() instanceof AbstractInOutTree)) {
        createTreeNode.setLoop(true);
      }
    }
 else     if (!isMappedChild(tempXpath,absoluteXPathQuery)) {
      continue;
    }
    parent.getChildren().add(createTreeNode);
    if (foxNode.getChildren() != null && !foxNode.getChildren().isEmpty()) {
      prepareEmfTree(foxNode.getChildren(),createTreeNode,tempXpath,absoluteXPathQuery);
    }
  }
}

Fixed version (ground truth):
private void prepareEmfTree(List<FOXTreeNode> list,TreeNode parent,String xmlPath,String absoluteXPathQuery){
  if (list == null || list.isEmpty()) {
    return;
  }
  String xPath=parent.getXpath();
  for (  FOXTreeNode foxNode : list) {
    TreeNode createTreeNode=createModel();
    createTreeNode.setName(foxNode.getLabel());
    if (foxNode instanceof Element) {
      createTreeNode.setNodeType(NodeType.ELEMENT);
    }
 else     if (foxNode instanceof Attribute) {
      createTreeNode.setNodeType(NodeType.ATTRIBUT);
    }
 else     if (foxNode instanceof NameSpaceNode) {
      createTreeNode.setNodeType(NodeType.NAME_SPACE);
      createTreeNode.setDefaultValue(foxNode.getDefaultValue());
      if (createTreeNode.getName() == null || createTreeNode.getName().equals("String_Node_Str")) {
        createTreeNode.setName(XmlMapUtil.DEFAULT_NAME_SPACE_PREFIX);
      }
    }
    createTreeNode.setXpath(XmlMapUtil.getXPath(xPath,createTreeNode.getName(),createTreeNode.getNodeType()));
    if (foxNode.getDataType() != null && "String_Node_Str".equals(foxNode.getDataType())) {
      createTreeNode.setType(foxNode.getDataType());
    }
 else {
      createTreeNode.setType(XmlMapUtil.DEFAULT_DATA_TYPE);
    }
    String tempXpath=null;
    if (xmlPath == null) {
      if (foxNode instanceof Attribute) {
        tempXpath=XmlMapUtil.XPATH_SEPARATOR + XmlMapUtil.XPATH_ATTRIBUTE + foxNode.getLabel();
      }
 else {
        tempXpath=XmlMapUtil.XPATH_SEPARATOR + foxNode.getLabel();
      }
    }
 else {
      if (foxNode instanceof Attribute) {
        tempXpath=xmlPath + XmlMapUtil.XPATH_SEPARATOR + XmlMapUtil.XPATH_ATTRIBUTE+ foxNode.getLabel();
      }
 else {
        tempXpath=xmlPath + XmlMapUtil.XPATH_SEPARATOR + foxNode.getLabel();
      }
    }
    if (tempXpath.equals(absoluteXPathQuery)) {
      if (!(parent.eContainer() instanceof AbstractInOutTree)) {
        createTreeNode.setLoop(true);
      }
    }
 else     if (!isMappedChild(tempXpath,absoluteXPathQuery)) {
      continue;
    }
    parent.getChildren().add(createTreeNode);
    if (createTreeNode.isLoop()) {
      XmlMapUtil.upsetMainNode(createTreeNode);
    }
    if (foxNode.getChildren() != null && !foxNode.getChildren().isEmpty()) {
      prepareEmfTree(foxNode.getChildren(),createTreeNode,tempXpath,absoluteXPathQuery);
    }
  }
}