Program: 141843
Project: 141843
Buggy source:
private void fillRootInfo(XmlFileConnection connection,ATreeNode node,String path,boolean inLoop) throws OdaException {
  XMLFileNode xmlNode=ConnectionFactory.eINSTANCE.createXMLFileNode();
  xmlNode.setXMLPath(path + "String_Node_Str" + node.getValue());
  xmlNode.setOrder(orderId);
  orderId++;
  MappingTypeRetriever retriever;
  String nameWithoutPrefixForColumn;
  String curName=(String)node.getValue();
  if (curName.contains("String_Node_Str")) {
    nameWithoutPrefixForColumn=curName.split("String_Node_Str")[1];
  }
 else {
    nameWithoutPrefixForColumn=curName;
  }
  retriever=MetadataTalendType.getMappingTypeRetriever("String_Node_Str");
  xmlNode.setAttribute("String_Node_Str");
  xmlNode.setType(retriever.getDefaultSelectedTalendType(node.getDataType()));
  MetadataColumn column=null;
switch (node.getType()) {
case ATreeNode.ATTRIBUTE_TYPE:
    xmlNode.setXMLPath("String_Node_Str" + node.getValue());
  xmlNode.setRelatedColumn(nameWithoutPrefixForColumn);
column=ConnectionFactory.eINSTANCE.createMetadataColumn();
column.setTalendType(xmlNode.getType());
column.setLabel(nameWithoutPrefixForColumn);
ConnectionHelper.getTables(connection).toArray(new MetadataTable[0])[0].getColumns().add(column);
break;
case ATreeNode.ELEMENT_TYPE:
boolean haveElementOrAttributes=false;
for (Object curNode : node.getChildren()) {
if (((ATreeNode)curNode).getType() != ATreeNode.NAMESPACE_TYPE) {
haveElementOrAttributes=true;
break;
}
}
if (!haveElementOrAttributes) {
xmlNode.setAttribute("String_Node_Str");
xmlNode.setRelatedColumn(nameWithoutPrefixForColumn);
column=ConnectionFactory.eINSTANCE.createMetadataColumn();
column.setTalendType(xmlNode.getType());
column.setLabel(nameWithoutPrefixForColumn);
ConnectionHelper.getTables(connection).toArray(new MetadataTable[0])[0].getColumns().add(column);
}
 else {
xmlNode.setAttribute("String_Node_Str");
}
break;
case ATreeNode.NAMESPACE_TYPE:
xmlNode.setAttribute("String_Node_Str");
xmlNode.setXMLPath(node.getDataType());
xmlNode.setDefaultValue((String)node.getValue());
break;
case ATreeNode.OTHER_TYPE:
break;
}
boolean subElementsInLoop=inLoop;
if ((!loopElementFound && path.split("String_Node_Str").length == 2 && node.getType() == ATreeNode.ELEMENT_TYPE) || subElementsInLoop) {
connection.getLoop().add(xmlNode);
loopElementFound=true;
subElementsInLoop=true;
}
 else {
connection.getRoot().add(xmlNode);
}
if (node.getChildren().length > 0) {
for (Object curNode : node.getChildren()) {
fillRootInfo(connection,(ATreeNode)curNode,path + "String_Node_Str" + node.getValue(),subElementsInLoop);
}
}
}

Fixed version (ground truth):
private void fillRootInfo(XmlFileConnection connection,ATreeNode node,String path,boolean inLoop) throws OdaException {
  XMLFileNode xmlNode=ConnectionFactory.eINSTANCE.createXMLFileNode();
  xmlNode.setXMLPath(path + "String_Node_Str" + node.getValue());
  xmlNode.setOrder(orderId);
  orderId++;
  MappingTypeRetriever retriever;
  String nameWithoutPrefixForColumn;
  String curName=(String)node.getValue();
  if (curName.contains("String_Node_Str")) {
    nameWithoutPrefixForColumn=curName.split("String_Node_Str")[1];
  }
 else {
    nameWithoutPrefixForColumn=curName;
  }
  retriever=MetadataTalendType.getMappingTypeRetriever("String_Node_Str");
  xmlNode.setAttribute("String_Node_Str");
  xmlNode.setType(retriever.getDefaultSelectedTalendType(node.getDataType()));
  MetadataColumn column=null;
  MetadataTable metadataTable=ConnectionHelper.getTables(connection).toArray(new MetadataTable[0])[0];
switch (node.getType()) {
case ATreeNode.ATTRIBUTE_TYPE:
    xmlNode.setXMLPath("String_Node_Str" + node.getValue());
  column=ConnectionFactory.eINSTANCE.createMetadataColumn();
column.setTalendType(xmlNode.getType());
String uniqueName=extractColumnName(nameWithoutPrefixForColumn,metadataTable.getColumns());
column.setLabel(uniqueName);
xmlNode.setRelatedColumn(uniqueName);
metadataTable.getColumns().add(column);
break;
case ATreeNode.ELEMENT_TYPE:
boolean haveElementOrAttributes=false;
for (Object curNode : node.getChildren()) {
if (((ATreeNode)curNode).getType() != ATreeNode.NAMESPACE_TYPE) {
haveElementOrAttributes=true;
break;
}
}
if (!haveElementOrAttributes) {
xmlNode.setAttribute("String_Node_Str");
column=ConnectionFactory.eINSTANCE.createMetadataColumn();
column.setTalendType(xmlNode.getType());
uniqueName=extractColumnName(nameWithoutPrefixForColumn,metadataTable.getColumns());
column.setLabel(uniqueName);
xmlNode.setRelatedColumn(uniqueName);
metadataTable.getColumns().add(column);
}
 else {
xmlNode.setAttribute("String_Node_Str");
}
break;
case ATreeNode.NAMESPACE_TYPE:
xmlNode.setAttribute("String_Node_Str");
xmlNode.setXMLPath(node.getDataType());
xmlNode.setDefaultValue((String)node.getValue());
break;
case ATreeNode.OTHER_TYPE:
break;
}
boolean subElementsInLoop=inLoop;
if ((!loopElementFound && path.split("String_Node_Str").length == 2 && node.getType() == ATreeNode.ELEMENT_TYPE) || subElementsInLoop) {
connection.getLoop().add(xmlNode);
loopElementFound=true;
subElementsInLoop=true;
}
 else {
connection.getRoot().add(xmlNode);
}
if (node.getChildren().length > 0) {
for (Object curNode : node.getChildren()) {
fillRootInfo(connection,(ATreeNode)curNode,path + "String_Node_Str" + node.getValue(),subElementsInLoop);
}
}
}