Program: 128361
Project: 128361
Buggy source:
/** 
 * populate tree items.
 * @param tree
 * @param node
 */
private void populateTreeItems(Object tree,Object[] node,int level,String parentPathForTreeLink,String parentPathToAvoidLoop){
  level++;
  for (int i=0; i < node.length; i++) {
    TreeItem treeItem;
    if (tree instanceof Tree) {
      treeItem=new TreeItem((Tree)tree,0);
    }
 else {
      treeItem=new TreeItem((TreeItem)tree,0);
    }
    ATreeNode treeNode=(ATreeNode)node[i];
    treeItem.setData(treeNode);
    int type=treeNode.getType();
    if (type == ATreeNode.NAMESPACE_TYPE) {
      if ("String_Node_Str".equals(treeNode.getDataType())) {
        treeItem.setText("String_Node_Str" + treeNode.getLabel());
      }
 else {
        treeItem.setText("String_Node_Str" + treeNode.getDataType() + "String_Node_Str"+ treeNode.getLabel());
      }
      treeItem.setForeground(new Color(Display.getDefault(),new RGB(0,130,0)));
    }
 else     if (type == ATreeNode.ATTRIBUTE_TYPE) {
      treeItem.setText("String_Node_Str" + treeNode.getLabel());
    }
 else {
      treeItem.setText(treeNode.getLabel());
    }
    if (parentPathToAvoidLoop.contains("String_Node_Str" + treeItem.getText() + "String_Node_Str")) {
      treeItem.setForeground(new Color(Display.getDefault(),new RGB(255,102,102)));
      continue;
    }
    String currentXPathForTreeLink=parentPathForTreeLink + "String_Node_Str" + treeItem.getText();
    xPathToTreeItem.put(currentXPathForTreeLink,treeItem);
    String currentXPathToAvoidLoop=parentPathForTreeLink + treeItem.getText() + "String_Node_Str";
    if (treeNode.getChildren() != null && treeNode.getChildren().length > 0) {
      populateTreeItems(treeItem,treeNode.getChildren(),level,currentXPathForTreeLink,currentXPathToAvoidLoop);
    }
    setExpanded(treeItem);
  }
}

Fixed version (ground truth):
/** 
 * populate tree items.
 * @param tree
 * @param node
 */
private void populateTreeItems(Object tree,Object[] node,int level,String parentPathForTreeLink,String parentPathToAvoidLoop){
  level++;
  for (  Object element : node) {
    TreeItem treeItem;
    if (tree instanceof Tree) {
      treeItem=new TreeItem((Tree)tree,0);
    }
 else {
      treeItem=new TreeItem((TreeItem)tree,0);
    }
    ATreeNode treeNode=(ATreeNode)element;
    treeItem.setData(treeNode);
    int type=treeNode.getType();
    if (type == ATreeNode.NAMESPACE_TYPE) {
      if ("String_Node_Str".equals(treeNode.getDataType())) {
        treeItem.setText("String_Node_Str" + treeNode.getLabel());
      }
 else {
        treeItem.setText("String_Node_Str" + treeNode.getDataType() + "String_Node_Str"+ treeNode.getLabel());
      }
      treeItem.setForeground(new Color(Display.getDefault(),new RGB(0,130,0)));
    }
 else     if (type == ATreeNode.ATTRIBUTE_TYPE) {
      treeItem.setText("String_Node_Str" + treeNode.getLabel());
    }
 else {
      treeItem.setText(treeNode.getLabel());
    }
    if (parentPathToAvoidLoop.contains("String_Node_Str" + treeItem.getText() + "String_Node_Str")) {
      treeItem.setForeground(new Color(Display.getDefault(),new RGB(255,102,102)));
      continue;
    }
    String currentXPathForTreeLink=parentPathForTreeLink + "String_Node_Str" + treeItem.getText();
    xPathToTreeItem.put(currentXPathForTreeLink,treeItem);
    String currentXPathToAvoidLoop=parentPathForTreeLink + treeItem.getText() + "String_Node_Str";
    if (treeNode.getChildren() != null && treeNode.getChildren().length > 0) {
      populateTreeItems(treeItem,treeNode.getChildren(),level,currentXPathForTreeLink,currentXPathToAvoidLoop);
    }
    setExpanded(treeItem);
  }
}