Program: 129239
Project: 129239
Buggy source:
public static void getTableXMLMappingValue(Connection connection,List<Map<String,Object>> tableInfo,INode node){
  List<IMetadataTable> metaTables=node.getMetadataList();
  if (connection instanceof XmlFileConnection || connection instanceof MDMConnection) {
    getTableXMLMappingValue(connection,tableInfo,metaTables.get(0));
  }
 else   if (connection instanceof HL7Connection) {
    List<IMetadataTable> newMetaTables=new ArrayList<IMetadataTable>(metaTables);
    HL7Connection hl7Connection=(HL7Connection)connection;
    tableInfo.clear();
    for (    MetadataTable repTable : (Set<MetadataTable>)ConnectionHelper.getTables(connection)) {
      IMetadataTable metaTable=null;
      Iterator<IMetadataTable> iterator=newMetaTables.iterator();
      while (iterator.hasNext()) {
        IMetadataTable nodeTable=iterator.next();
        if (repTable.getLabel() != null && repTable.getLabel().equals(nodeTable.getLabel())) {
          metaTable=nodeTable;
          iterator.remove();
          break;
        }
      }
      String xpathValue="String_Node_Str";
      for (      MetadataColumn col : (List<MetadataColumn>)repTable.getColumns()) {
        String original=col.getOriginalField();
        if (original != null && !"String_Node_Str".equals(original)) {
          if (original.indexOf(TalendQuoteUtils.LBRACKET) != -1) {
            original=original.substring(0,original.indexOf(TalendQuoteUtils.LBRACKET));
          }
          original=TalendQuoteUtils.addQuotes(original);
          xpathValue+=original;
        }
        if (repTable.getColumns().indexOf(col) < repTable.getColumns().size() - 1) {
          xpathValue+="String_Node_Str";
        }
      }
      Map<String,Object> map=new HashMap<String,Object>();
      if (metaTable != null) {
        map.put("String_Node_Str",metaTable.getTableName());
      }
 else {
        if (GlobalServiceRegister.getDefault().isServiceRegistered(IMetadataManagmentService.class)) {
          IMetadataManagmentService mmService=(IMetadataManagmentService)GlobalServiceRegister.getDefault().getService(IMetadataManagmentService.class);
          IMetadataTable convert=mmService.convertMetadataTable(repTable);
          String uinqueTableName=node.getProcess().generateUniqueConnectionName(MultiSchemasUtil.getConnectionBaseName((String)repTable.getLabel()));
          convert.setTableName(uinqueTableName);
          node.getProcess().addUniqueConnectionName(uinqueTableName);
          node.getMetadataList().add(convert);
          map.put("String_Node_Str",uinqueTableName);
        }
      }
      map.put("String_Node_Str",xpathValue);
      tableInfo.add(map);
    }
    if (!newMetaTables.isEmpty()) {
      metaTables.removeAll(newMetaTables);
      for (      IMetadataTable table : newMetaTables) {
        node.getProcess().removeUniqueConnectionName(table.getTableName());
      }
    }
  }
}

Fixed version (ground truth):
public static void getTableXMLMappingValue(Connection connection,List<Map<String,Object>> tableInfo,INode node){
  List<IMetadataTable> metaTables=node.getMetadataList();
  if (connection instanceof XmlFileConnection || connection instanceof MDMConnection) {
    getTableXMLMappingValue(connection,tableInfo,metaTables.get(0));
  }
 else   if (connection instanceof HL7Connection) {
    List<IMetadataTable> newMetaTables=new ArrayList<IMetadataTable>(metaTables);
    HL7Connection hl7Connection=(HL7Connection)connection;
    tableInfo.clear();
    for (    MetadataTable repTable : ConnectionHelper.getTables(connection)) {
      IMetadataTable metaTable=null;
      Iterator<IMetadataTable> iterator=newMetaTables.iterator();
      while (iterator.hasNext()) {
        IMetadataTable nodeTable=iterator.next();
        if (repTable.getLabel() != null && repTable.getLabel().equals(nodeTable.getLabel())) {
          metaTable=nodeTable;
          iterator.remove();
          break;
        }
      }
      String xpathValue="String_Node_Str";
      for (      MetadataColumn col : repTable.getColumns()) {
        String original=col.getOriginalField();
        if (original != null && !"String_Node_Str".equals(original)) {
          if (original.indexOf(TalendQuoteUtils.LBRACKET) != -1) {
            original=original.substring(0,original.indexOf(TalendQuoteUtils.LBRACKET));
          }
          original=TalendQuoteUtils.addQuotes(original);
          xpathValue+=original;
        }
        if (repTable.getColumns().indexOf(col) < repTable.getColumns().size() - 1) {
          xpathValue+="String_Node_Str";
        }
      }
      Map<String,Object> map=new HashMap<String,Object>();
      if (metaTable != null) {
        map.put("String_Node_Str",metaTable.getTableName());
      }
 else {
        if (GlobalServiceRegister.getDefault().isServiceRegistered(IMetadataManagmentService.class)) {
          IMetadataManagmentService mmService=(IMetadataManagmentService)GlobalServiceRegister.getDefault().getService(IMetadataManagmentService.class);
          IMetadataTable convert=mmService.convertMetadataTable(repTable);
          String uinqueTableName=node.getProcess().generateUniqueConnectionName(MultiSchemasUtil.getConnectionBaseName(repTable.getLabel()));
          convert.setTableName(uinqueTableName);
          node.getProcess().addUniqueConnectionName(uinqueTableName);
          node.getMetadataList().add(convert);
          map.put("String_Node_Str",uinqueTableName);
        }
      }
      map.put("String_Node_Str",xpathValue);
      tableInfo.add(map);
    }
    if (!newMetaTables.isEmpty()) {
      metaTables.removeAll(newMetaTables);
      for (      IMetadataTable table : newMetaTables) {
        node.getProcess().removeUniqueConnectionName(table.getTableName());
      }
    }
  }
}