Program: 127623
Project: 127623
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));
  XSDSchema xsdSchema=null;
  ATreeNode treeRootNode=null;
  if (getPage() == null) {
    try {
      xsdSchema=getXSDSchema(file);
      List<ATreeNode> rootNodes=new XSDPopulationUtil2().getAllRootNodes(xsdSchema);
      if (rootNodes.size() > 0) {
        treeRootNode=getDefaultRootNode(rootNodes);
      }
    }
 catch (    Exception e) {
      ExceptionHandler.process(e);
    }
  }
 else {
    XmlFileWizard wizard=((XmlFileWizard)getPage().getWizard());
    xsdSchema=updateXSDSchema(file);
    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);
    }
  }
}

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));
  XSDSchema xsdSchema=null;
  ATreeNode treeRootNode=null;
  if (getPage() == null) {
    try {
      xsdSchema=getXSDSchema(file);
      List<ATreeNode> rootNodes=new XSDPopulationUtil2().getAllRootNodes(xsdSchema);
      if (rootNodes.size() > 0) {
        treeRootNode=getDefaultRootNode(rootNodes);
      }
    }
 catch (    Exception e) {
      ExceptionHandler.process(e);
    }
  }
 else {
    XmlFileWizard wizard=((XmlFileWizard)getPage().getWizard());
    xsdSchema=updateXSDSchema(file);
    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 {
        String originalDataType=curNode.getOriginalDataType();
        if (originalDataType != null && !originalDataType.startsWith("String_Node_Str")) {
          originalDataType="String_Node_Str" + originalDataType;
        }
        metadataColumn.setTalendType(retriever.getDefaultSelectedTalendType(originalDataType));
      }
      columns.add(metadataColumn);
    }
  }
}