Program: 123788
Project: 123788
Buggy source:
private void prepareEmfTreeNode(List<FOXTreeNode> list,TreeNode parent){
  if (list == null || list.isEmpty()) {
    return;
  }
  String xPath=parent.getXpath();
  TreeNode realParentNode=parent;
  if (parent.isSubstitution() || parent.isChoice()) {
    realParentNode=XmlMapUtil.getRealParentNode(parent);
    if (realParentNode != null) {
      xPath=realParentNode.getXpath();
    }
  }
  for (  FOXTreeNode foxNode : list) {
    TreeNode createTreeNode=null;
    if (input) {
      createTreeNode=XmlmapFactory.eINSTANCE.createTreeNode();
    }
 else {
      createTreeNode=XmlmapFactory.eINSTANCE.createOutputTreeNode();
    }
    String label=foxNode.getLabel();
    createTreeNode.setName(label);
    if (foxNode instanceof Element) {
      createTreeNode.setNodeType(NodeType.ELEMENT);
      if (foxNode.isChoice()) {
        createTreeNode.setChoice(foxNode.isChoice());
      }
 else       if (foxNode.isSubstitution()) {
        createTreeNode.setSubstitution(foxNode.isSubstitution());
      }
    }
 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,label,createTreeNode.getNodeType()));
    if (foxNode.getDataType() != null && "String_Node_Str".equals(foxNode.getDataType())) {
      createTreeNode.setType(foxNode.getDataType());
    }
 else {
      createTreeNode.setType(XmlMapUtil.DEFAULT_DATA_TYPE);
    }
    parent.getChildren().add(createTreeNode);
    if (foxNode.getChildren() != null && !foxNode.getChildren().isEmpty()) {
      prepareEmfTreeNode(foxNode.getChildren(),createTreeNode);
    }
  }
}

Fixed version (ground truth):
private void prepareEmfTreeNode(List<FOXTreeNode> list,TreeNode parent){
  if (list == null || list.isEmpty()) {
    return;
  }
  String xPath=parent.getXpath();
  TreeNode realParentNode=parent;
  if (parent.isSubstitution() || parent.isChoice()) {
    realParentNode=XmlMapUtil.getRealParentNode(parent);
    if (realParentNode != null) {
      xPath=realParentNode.getXpath();
    }
  }
  for (  FOXTreeNode foxNode : list) {
    TreeNode createTreeNode=null;
    if (input) {
      createTreeNode=XmlmapFactory.eINSTANCE.createTreeNode();
    }
 else {
      createTreeNode=XmlmapFactory.eINSTANCE.createOutputTreeNode();
    }
    String label=foxNode.getLabel();
    createTreeNode.setName(label);
    createTreeNode.setOptional(foxNode.isOptional());
    if (foxNode instanceof Element) {
      createTreeNode.setNodeType(NodeType.ELEMENT);
      if (foxNode.isChoice()) {
        createTreeNode.setChoice(foxNode.isChoice());
      }
 else       if (foxNode.isSubstitution()) {
        createTreeNode.setSubstitution(foxNode.isSubstitution());
      }
    }
 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,label,createTreeNode.getNodeType()));
    if (foxNode.getDataType() != null && "String_Node_Str".equals(foxNode.getDataType())) {
      createTreeNode.setType(foxNode.getDataType());
    }
 else {
      createTreeNode.setType(XmlMapUtil.DEFAULT_DATA_TYPE);
    }
    parent.getChildren().add(createTreeNode);
    if (foxNode.getChildren() != null && !foxNode.getChildren().isEmpty()) {
      prepareEmfTreeNode(foxNode.getChildren(),createTreeNode);
    }
  }
}