Program: 129835
Project: 129835
Buggy source:
protected void createTable(){
  if (concept == null) {
    return;
  }
  if (metadataTable == null) {
    metadataTable=ConnectionFactory.eINSTANCE.createMetadataTable();
    IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
    metadataTable.setId(factory.getNextId());
  }
  metadataTable.setLabel(concept.getLabel());
  MappingTypeRetriever retriever=MetadataTalendType.getMappingTypeRetriever("String_Node_Str");
  List<ConceptTarget> targetList=concept.getConceptTargets();
  List<MetadataColumn> metadataColumns=new ArrayList<MetadataColumn>();
  metadataTable.getColumns().clear();
  for (  ConceptTarget target : targetList) {
    String relativeXpath=target.getRelativeLoopExpression();
    String fullPath=target.getSchema().getLoopExpression();
    if (fullPath.contains("String_Node_Str") && metadataTable.getSourceName() == null) {
      String source=fullPath.split("String_Node_Str")[1];
      metadataTable.setSourceName(source);
    }
    if (isContextMode()) {
      ContextType contextType=ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection(),true);
      fullPath=TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType,fullPath));
    }
    if (relativeXpath != null) {
      String[] relatedSplitedPaths=relativeXpath.split("String_Node_Str");
      if (relatedSplitedPaths.length > 1) {
        int pathsToRemove=relatedSplitedPaths.length - 1;
        String[] fullPathSplited=fullPath.split("String_Node_Str");
        fullPath="String_Node_Str";
        for (int i=1; i < (fullPathSplited.length - pathsToRemove); i++) {
          fullPath+="String_Node_Str" + fullPathSplited[i];
        }
        fullPath+="String_Node_Str" + relatedSplitedPaths[pathsToRemove];
      }
 else {
        fullPath+="String_Node_Str" + relativeXpath;
      }
    }
    TreeItem treeItem=treePopulator.getTreeItem(fullPath);
    if (treeItem != null) {
      ATreeNode curNode=(ATreeNode)treeItem.getData();
      MetadataColumn metadataColumn=ConnectionFactory.eINSTANCE.createMetadataColumn();
      metadataColumn.setLabel(target.getTargetName());
      if (curNode == null || retriever == null) {
        metadataColumn.setTalendType(MetadataTalendType.getDefaultTalendType());
      }
 else {
        metadataColumn.setTalendType(retriever.getDefaultSelectedTalendType("String_Node_Str" + curNode.getOriginalDataType()));
      }
      if (!metadataTable.getColumns().contains(metadataColumn)) {
        metadataTable.getColumns().add(metadataColumn);
      }
      metadataColumns.add(metadataColumn);
    }
  }
  if (!ConnectionHelper.getTables(getConnection()).contains(metadataTable)) {
    TdXmlSchema d=(TdXmlSchema)ConnectionHelper.getPackage(((MDMConnection)connectionItem.getConnection()).getDatacluster(),connectionItem.getConnection(),TdXmlSchema.class);
    if (d != null) {
      d.getOwnedElement().add(metadataTable);
    }
 else {
      TdXmlSchema newXmlDoc=XmlFactory.eINSTANCE.createTdXmlSchema();
      newXmlDoc.setName(((MDMConnection)connectionItem.getConnection()).getDatacluster());
      ConnectionHelper.addPackage(newXmlDoc,connectionItem.getConnection());
      PackageHelper.addMetadataTable(metadataTable,newXmlDoc);
    }
  }
}

Fixed version (ground truth):
protected void createTable(){
  if (concept == null) {
    return;
  }
  if (metadataTable == null) {
    metadataTable=ConnectionFactory.eINSTANCE.createMetadataTable();
    IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
    metadataTable.setId(factory.getNextId());
  }
  metadataTable.setLabel(concept.getLabel());
  MappingTypeRetriever retriever=MetadataTalendType.getMappingTypeRetriever("String_Node_Str");
  List<ConceptTarget> targetList=concept.getConceptTargets();
  List<MetadataColumn> metadataColumns=new ArrayList<MetadataColumn>();
  metadataTable.getColumns().clear();
  for (  ConceptTarget target : targetList) {
    String relativeXpath=target.getRelativeLoopExpression();
    String fullPath=target.getSchema().getLoopExpression();
    if (fullPath.contains("String_Node_Str") && metadataTable.getSourceName() == null) {
      String source=fullPath.split("String_Node_Str")[1];
      metadataTable.setSourceName(source);
    }
    if (isContextMode()) {
      ContextType contextType=ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection(),true);
      fullPath=TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType,fullPath));
    }
    if (relativeXpath != null) {
      if (!"String_Node_Str".equals(relativeXpath)) {
        String[] relatedSplitedPaths=relativeXpath.split("String_Node_Str");
        if (relatedSplitedPaths.length > 1) {
          int pathsToRemove=relatedSplitedPaths.length - 1;
          String[] fullPathSplited=fullPath.split("String_Node_Str");
          fullPath="String_Node_Str";
          for (int i=1; i < (fullPathSplited.length - pathsToRemove); i++) {
            fullPath+="String_Node_Str" + fullPathSplited[i];
          }
          fullPath+="String_Node_Str" + relatedSplitedPaths[pathsToRemove];
        }
 else {
          fullPath+="String_Node_Str" + relativeXpath;
        }
      }
    }
    TreeItem treeItem=treePopulator.getTreeItem(fullPath);
    if (treeItem != null) {
      ATreeNode curNode=(ATreeNode)treeItem.getData();
      MetadataColumn metadataColumn=ConnectionFactory.eINSTANCE.createMetadataColumn();
      metadataColumn.setLabel(target.getTargetName());
      if (curNode == null || retriever == null) {
        metadataColumn.setTalendType(MetadataTalendType.getDefaultTalendType());
      }
 else {
        metadataColumn.setTalendType(retriever.getDefaultSelectedTalendType("String_Node_Str" + curNode.getOriginalDataType()));
      }
      if (!metadataTable.getColumns().contains(metadataColumn)) {
        metadataTable.getColumns().add(metadataColumn);
      }
      metadataColumns.add(metadataColumn);
    }
  }
  if (!ConnectionHelper.getTables(getConnection()).contains(metadataTable)) {
    TdXmlSchema d=(TdXmlSchema)ConnectionHelper.getPackage(((MDMConnection)connectionItem.getConnection()).getDatacluster(),connectionItem.getConnection(),TdXmlSchema.class);
    if (d != null) {
      d.getOwnedElement().add(metadataTable);
    }
 else {
      TdXmlSchema newXmlDoc=XmlFactory.eINSTANCE.createTdXmlSchema();
      newXmlDoc.setName(((MDMConnection)connectionItem.getConnection()).getDatacluster());
      ConnectionHelper.addPackage(newXmlDoc,connectionItem.getConnection());
      PackageHelper.addMetadataTable(metadataTable,newXmlDoc);
    }
  }
}