Program: 129588
Project: 129588
Buggy source:
public static FOXTreeNode cloneATreeNode(ATreeNode treeNode,String currentPath){
  FOXTreeNode node=null;
  if (treeNode.getType() == ATreeNode.ATTRIBUTE_TYPE) {
    node=new Attribute();
  }
 else {
    node=new Element();
  }
  if (treeNode.getType() == ATreeNode.NAMESPACE_TYPE) {
    node=new NameSpaceNode();
    node.setLabel(treeNode.getDataType());
    node.setDefaultValue((String)treeNode.getValue());
  }
 else {
    node.setLabel((String)treeNode.getValue());
    node.getUniqueNames().clear();
    node.getUniqueNames().addAll(treeNode.getUniqueNames());
  }
  MappingTypeRetriever retriever=MetadataTalendType.getMappingTypeRetriever("String_Node_Str");
  node.setDataType(retriever.getDefaultSelectedTalendType("String_Node_Str" + treeNode.getOriginalDataType()));
  Object[] children=treeNode.getChildren();
  if (children != null) {
    for (int i=0; i < children.length; i++) {
      if (children[i] instanceof ATreeNode) {
        ATreeNode child=(ATreeNode)children[i];
        String newPath=currentPath + "String_Node_Str";
        if (child.getValue() instanceof String) {
          String elementName=(String)child.getValue();
          if (currentPath.contains("String_Node_Str" + elementName + "String_Node_Str")) {
            continue;
          }
          newPath+=elementName;
        }
 else {
          newPath+="String_Node_Str";
        }
        FOXTreeNode foxChild=cloneATreeNode(child,newPath);
        node.addChild(foxChild);
      }
    }
  }
  return node;
}

Fixed version (ground truth):
public static FOXTreeNode cloneATreeNode(ATreeNode treeNode,String currentPath){
  FOXTreeNode node=null;
  if (treeNode.getType() == ATreeNode.ATTRIBUTE_TYPE) {
    node=new Attribute();
  }
 else {
    node=new Element();
  }
  if (treeNode.getType() == ATreeNode.NAMESPACE_TYPE) {
    node=new NameSpaceNode();
    node.setLabel(treeNode.getDataType());
    node.setDefaultValue((String)treeNode.getValue());
  }
 else {
    node.setLabel((String)treeNode.getValue());
    node.getUniqueNames().clear();
    node.getUniqueNames().addAll(treeNode.getUniqueNames());
  }
  MappingTypeRetriever retriever=MetadataTalendType.getMappingTypeRetriever("String_Node_Str");
  String originalDataType=treeNode.getOriginalDataType();
  if (originalDataType != null && !originalDataType.startsWith("String_Node_Str")) {
    originalDataType="String_Node_Str" + originalDataType;
  }
  node.setDataType(retriever.getDefaultSelectedTalendType(originalDataType));
  Object[] children=treeNode.getChildren();
  if (children != null) {
    for (int i=0; i < children.length; i++) {
      if (children[i] instanceof ATreeNode) {
        ATreeNode child=(ATreeNode)children[i];
        String newPath=currentPath + "String_Node_Str";
        if (child.getValue() instanceof String) {
          String elementName=(String)child.getValue();
          if (currentPath.contains("String_Node_Str" + elementName + "String_Node_Str")) {
            continue;
          }
          newPath+=elementName;
        }
 else {
          newPath+="String_Node_Str";
        }
        FOXTreeNode foxChild=cloneATreeNode(child,newPath);
        node.addChild(foxChild);
      }
    }
  }
  return node;
}