Program: 130034
Project: 130034
Buggy source:
private void prepareColumnsFromXSD(String file,List<MetadataColumn> columns,List<SchemaTarget> schemaTarget){
  Composite composite=Form.startNewGridLayout(this,2,false,SWT.CENTER,SWT.CENTER);
  composite.setVisible(false);
  TreePopulator treePopulator=new TreePopulator(new Tree(composite,SWT.None));
  XmlFileWizard wizard=((XmlFileWizard)getPage().getWizard());
  XSDSchema xsdSchema=updateXSDSchema(file);
  ATreeNode treeRootNode=wizard.getTreeRootNode();
  if (treeRootNode == null)   return;
  treePopulator.populateTree(xsdSchema,treeRootNode,null);
  MappingTypeRetriever retriever=MetadataTalendType.getMappingTypeRetriever("String_Node_Str");
  for (  SchemaTarget schema : schemaTarget) {
    String relativeXpath=schema.getRelativeXPathQuery();
    String fullPath=schema.getSchema().getAbsoluteXPathQuery();
    if (isContextMode()) {
      ContextType contextType=ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection(),true);
      fullPath=TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType,fullPath));
    }
    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(tableEditorView.getMetadataEditor().getNextGeneratedColumnName(schema.getTagName()));
      if (curNode == null || retriever == null) {
        metadataColumn.setTalendType(MetadataTalendType.getDefaultTalendType());
      }
 else {
        metadataColumn.setTalendType(retriever.getDefaultSelectedTalendType("String_Node_Str" + curNode.getOriginalDataType()));
      }
      columns.add(metadataColumn);
    }
  }
}

Fixed version (ground truth):
private void prepareColumnsFromXSD(String file,List<MetadataColumn> columns,List<SchemaTarget> schemaTarget){
  Composite composite=Form.startNewGridLayout(this,2,false,SWT.CENTER,SWT.CENTER);
  composite.setVisible(false);
  TreePopulator treePopulator=new TreePopulator(new Tree(composite,SWT.None));
  XmlFileWizard wizard=((XmlFileWizard)getPage().getWizard());
  XSDSchema xsdSchema=updateXSDSchema(file);
  ATreeNode treeRootNode=wizard.getTreeRootNode();
  if (treeRootNode == null)   return;
  treePopulator.populateTree(xsdSchema,treeRootNode,null);
  MappingTypeRetriever retriever=MetadataTalendType.getMappingTypeRetriever("String_Node_Str");
  for (  SchemaTarget schema : schemaTarget) {
    String relativeXpath=schema.getRelativeXPathQuery();
    if (relativeXpath != null && relativeXpath.endsWith("String_Node_Str")) {
      relativeXpath=relativeXpath.substring(0,relativeXpath.lastIndexOf("String_Node_Str"));
    }
    String fullPath=schema.getSchema().getAbsoluteXPathQuery();
    if (isContextMode()) {
      ContextType contextType=ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection(),true);
      fullPath=TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType,fullPath));
    }
    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(tableEditorView.getMetadataEditor().getNextGeneratedColumnName(schema.getTagName()));
      if (curNode == null || retriever == null) {
        metadataColumn.setTalendType(MetadataTalendType.getDefaultTalendType());
      }
 else {
        metadataColumn.setTalendType(retriever.getDefaultSelectedTalendType("String_Node_Str" + curNode.getOriginalDataType()));
      }
      columns.add(metadataColumn);
    }
  }
}