Program: 125495
Project: 125495
Buggy source:
public static List<FOXTreeNode> getFoxTreeNodes(String filePath,String selectedEntity,boolean forMDM){
  List<String> attList=new ArrayList<String>();
  attList.add(selectedEntity);
  List<FOXTreeNode> list=new ArrayList<FOXTreeNode>();
  try {
    XSDSchema xsdSchema=TreeUtil.getXSDSchema(filePath);
    List<ATreeNode> rootNodes=new XSDPopulationUtil2().getAllRootNodes(xsdSchema);
    ATreeNode selectedNode=null;
    if (!rootNodes.isEmpty()) {
      for (      Object obj : rootNodes) {
        ATreeNode node=(ATreeNode)obj;
        if (node.getValue() != null && node.getValue().equals(selectedEntity)) {
          selectedNode=node;
          break;
        }
      }
      if (selectedNode != null) {
        return TreeUtil.getFoxTreeNodesByRootNode(xsdSchema,selectedNode,false);
      }
    }
    if (filePath == null) {
      return list;
    }
    if (selectedEntity == null || "String_Node_Str".equals(selectedEntity)) {
      return getFoxTreeNodes(filePath);
    }
 else {
      ATreeNode treeNode=SchemaPopulationUtil.getSchemaTree(filePath,true,forMDM,0,attList);
      if (treeNode != null) {
        if (forMDM) {
          if (selectedEntity.equals(treeNode.getValue())) {
            selectedNode=treeNode;
          }
        }
        for (        Object obj : treeNode.getChildren()) {
          if (obj instanceof ATreeNode) {
            ATreeNode node=(ATreeNode)obj;
            if (selectedEntity.equals(node.getValue())) {
              selectedNode=node;
              break;
            }
          }
        }
        if (selectedNode != null) {
          String rootName="String_Node_Str";
          if (treeNode.getValue() instanceof String) {
            rootName+="String_Node_Str" + treeNode.getValue();
          }
          FOXTreeNode root=cloneATreeNode(treeNode,rootName,XmlUtil.isXSDFile(filePath));
          if (root instanceof Element) {
            root.setParent(null);
            list.add(root);
          }
        }
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  return list;
}

Fixed version (ground truth):
public static List<FOXTreeNode> getFoxTreeNodes(String filePath,String selectedEntity,boolean forMDM){
  List<String> attList=new ArrayList<String>();
  attList.add(selectedEntity);
  List<FOXTreeNode> list=new ArrayList<FOXTreeNode>();
  try {
    XSDSchema xsdSchema=TreeUtil.getXSDSchema(filePath);
    List<ATreeNode> rootNodes=new XSDPopulationUtil2().getAllRootNodes(xsdSchema);
    ATreeNode selectedNode=null;
    if (!rootNodes.isEmpty()) {
      for (      Object obj : rootNodes) {
        ATreeNode node=(ATreeNode)obj;
        if (node.getValue() != null && node.getValue().equals(selectedEntity)) {
          selectedNode=node;
          break;
        }
      }
      if (selectedNode != null) {
        return TreeUtil.getFoxTreeNodesByRootNode(xsdSchema,selectedNode,false);
      }
    }
    if (filePath == null) {
      return list;
    }
    if (selectedEntity == null || "String_Node_Str".equals(selectedEntity)) {
      return getFoxTreeNodes(filePath);
    }
 else {
      ATreeNode treeNode=SchemaPopulationUtil.getSchemaTree(filePath,true,forMDM,0,attList);
      if (treeNode != null) {
        if (forMDM) {
          if (selectedEntity.equals(treeNode.getValue())) {
            selectedNode=treeNode;
          }
        }
        for (        Object obj : treeNode.getChildren()) {
          if (obj instanceof ATreeNode) {
            ATreeNode node=(ATreeNode)obj;
            if (selectedEntity.equals(node.getValue())) {
              selectedNode=node;
              break;
            }
          }
        }
        if (selectedNode != null) {
          FOXTreeNode root=cloneATreeNode(treeNode,XmlUtil.isXSDFile(filePath));
          if (root instanceof Element) {
            root.setParent(null);
            list.add(root);
          }
        }
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  return list;
}