Program: 121072
Project: 121072
Buggy source:
@SuppressWarnings("String_Node_Str") private void createNodeContainerList(){
  int firstIndex=0;
  int index=0;
  nodeContainerList=new ArrayList<NodeContainer>();
  connections=new ArrayList<IConnection>();
  createdNames=new ArrayList<String>();
  Map<String,String> oldNameTonewNameMap=new HashMap<String,String>();
  Map<String,String> oldMetaToNewMeta=new HashMap<String,String>();
  Map<INode,SubjobContainer> mapping=new HashMap<INode,SubjobContainer>();
  for (  NodePart copiedNodePart : nodeParts) {
    IGraphicalNode copiedNode=(IGraphicalNode)copiedNodePart.getModel();
    if (!containNodeInProcess(copiedNode)) {
      continue;
    }
    IComponent component=ComponentsFactoryProvider.getInstance().get(copiedNode.getComponent().getName(),process.getComponentsType());
    if (component == null) {
      if ((ComponentCategory.CATEGORY_4_MAPREDUCE.getName()).equals(process.getComponentsType())) {
        component=new DummyComponent(copiedNode.getComponent().getName());
      }
 else {
        component=copiedNode.getComponent();
      }
    }
    IGraphicalNode pastedNode=new Node(component,process);
    if (nodeMap != null) {
      nodeMap.put(copiedNode,pastedNode);
    }
    if (isJobletRefactor()) {
      process.removeUniqueNodeName(pastedNode.getUniqueName());
      pastedNode.setPropertyValue(EParameterName.UNIQUE_NAME.getName(),copiedNode.getUniqueName());
      process.addUniqueNodeName(copiedNode.getUniqueName());
    }
    makeCopyNodeAndSubjobMapping(copiedNode,pastedNode,mapping);
    Point location=null;
    if (getCursorLocation() == null) {
      location=copiedNode.getLocation();
    }
 else {
      location=getCursorLocation();
      index=nodeParts.indexOf(copiedNodePart);
    }
    if (process.isGridEnabled()) {
      int tempVar=location.x / TalendEditor.GRID_SIZE;
      location.x=tempVar * TalendEditor.GRID_SIZE;
      tempVar=location.y / TalendEditor.GRID_SIZE;
      location.y=tempVar * TalendEditor.GRID_SIZE;
    }
    pastedNode.setLocation(findLocationForNode(location,copiedNode.getSize(),index,firstIndex,copiedNodePart));
    pastedNode.setSize(copiedNode.getSize());
    INodeConnector mainConnector;
    if (pastedNode.isELTComponent()) {
      mainConnector=pastedNode.getConnectorFromType(EConnectionType.TABLE);
    }
 else {
      mainConnector=pastedNode.getConnectorFromType(EConnectionType.FLOW_MAIN);
    }
    if (!mainConnector.isMultiSchema()) {
      if (copiedNode.getMetadataList().size() != 0) {
        pastedNode.getMetadataList().clear();
        for (        IMetadataTable metaTable : copiedNode.getMetadataList()) {
          IMetadataTable newMetaTable=metaTable.clone();
          if (metaTable.getTableName().equals(copiedNode.getUniqueName())) {
            newMetaTable.setTableName(pastedNode.getUniqueName());
          }
          for (          IMetadataColumn column : metaTable.getListColumns()) {
            if (column.isCustom()) {
              IMetadataColumn newColumn=newMetaTable.getColumn(column.getLabel());
              newColumn.setReadOnly(column.isReadOnly());
              newColumn.setCustom(column.isCustom());
            }
          }
          pastedNode.getMetadataList().add(newMetaTable);
        }
      }
    }
 else {
      List<IMetadataTable> copyOfMetadataList=new ArrayList<IMetadataTable>();
      for (      IMetadataTable metaTable : copiedNode.getMetadataList()) {
        IMetadataTable newTable=metaTable.clone();
        if (copiedNode.isELTComponent()) {
          newTable.setTableName(createNewConnectionName(metaTable.getTableName(),IProcess.DEFAULT_TABLE_CONNECTION_NAME));
        }
 else {
          newTable.setTableName(createNewConnectionName(metaTable.getTableName(),null));
        }
        oldMetaToNewMeta.put(pastedNode.getUniqueName() + "String_Node_Str" + metaTable.getTableName(),newTable.getTableName());
        for (        IMetadataColumn column : metaTable.getListColumns()) {
          if (column.isCustom()) {
            IMetadataColumn newColumn=newTable.getColumn(column.getLabel());
            newColumn.setReadOnly(column.isReadOnly());
            newColumn.setCustom(column.isCustom());
          }
        }
        newTable.sortCustomColumns();
        copyOfMetadataList.add(newTable);
      }
      pastedNode.setMetadataList(copyOfMetadataList);
      IExternalNode externalNode=pastedNode.getExternalNode();
      if (externalNode != null) {
        if (copiedNode.getExternalData() != null) {
          try {
            externalNode.setExternalData(copiedNode.getExternalData().clone());
          }
 catch (          CloneNotSupportedException e) {
            ExceptionHandler.process(e);
          }
          ((Node)pastedNode).setExternalData(externalNode.getExternalData());
        }
        if (copiedNode.getExternalNode().getExternalEmfData() != null) {
          externalNode.setExternalEmfData(EcoreUtil.copy(copiedNode.getExternalNode().getExternalEmfData()));
        }
        for (        IMetadataTable metaTable : copiedNode.getMetadataList()) {
          String oldName=metaTable.getTableName();
          String newName=oldMetaToNewMeta.get(pastedNode.getUniqueName() + "String_Node_Str" + metaTable.getTableName());
          externalNode.renameOutputConnection(oldName,newName);
          CorePlugin.getDefault().getMapperService().renameJoinTable(process,externalNode.getExternalData(),createdNames);
        }
        if (copiedNode.getExternalNode() != null) {
          ImageDescriptor screenshot=copiedNode.getExternalNode().getScreenshot();
          if (screenshot != null) {
            externalNode.setScreenshot(screenshot);
          }
        }
      }
    }
    ((Node)pastedNode).getNodeLabel().setOffset(new Point(((Node)copiedNode).getNodeLabel().getOffset()));
    oldNameTonewNameMap.put(copiedNode.getUniqueName(),pastedNode.getUniqueName());
    if (copiedNode.getElementParametersWithChildrens() != null) {
      for (      ElementParameter param : (List<ElementParameter>)copiedNode.getElementParametersWithChildrens()) {
        if (!EParameterName.UNIQUE_NAME.getName().equals(param.getName())) {
          IElementParameter elementParameter=pastedNode.getElementParameter(param.getName());
          if (elementParameter != null) {
            if (param.getFieldType() == EParameterFieldType.TABLE) {
              List<Map<String,Object>> tableValues=(List<Map<String,Object>>)param.getValue();
              ArrayList newValues=new ArrayList();
              for (              Map<String,Object> map : tableValues) {
                Map<String,Object> newMap=new HashMap<String,Object>();
                newMap.putAll(map);
                if (EParameterName.SCHEMAS.name().equals(param.getName()) && !oldMetaToNewMeta.isEmpty()) {
                  String newSchemaName=oldMetaToNewMeta.get(pastedNode.getUniqueName() + "String_Node_Str" + map.get(EParameterName.SCHEMA.getName()));
                  if (newSchemaName != null) {
                    newMap.put(EParameterName.SCHEMA.getName(),newSchemaName);
                  }
                }
                newValues.add(newMap);
              }
              elementParameter.setValue(newValues);
            }
 else {
              if (param.getParentParameter() != null) {
                String parentName=param.getParentParameter().getName();
                pastedNode.setPropertyValue(parentName + "String_Node_Str" + param.getName(),param.getValue());
              }
 else {
                pastedNode.setPropertyValue(param.getName(),param.getValue());
                elementParameter.setReadOnly(param.getOriginalityReadOnly());
                elementParameter.setRepositoryValueUsed(param.isRepositoryValueUsed());
              }
            }
          }
        }
      }
    }
    NodeContainer nc=null;
    if (((Node)pastedNode).isJoblet()) {
      nc=new JobletContainer((Node)pastedNode);
    }
 else {
      nc=new NodeContainer((Node)pastedNode);
    }
    nodeContainerList.add(nc);
  }
  ((Process)process).setCopyPasteSubjobMappings(mapping);
  Map<String,String> oldToNewConnVarMap=new HashMap<String,String>();
  for (  NodePart copiedNodePart : nodeParts) {
    INode copiedNode=(INode)copiedNodePart.getModel();
    for (    IConnection connection : (List<IConnection>)copiedNode.getOutgoingConnections()) {
      INode pastedTargetNode=null, pastedSourceNode=null;
      String nodeSource=oldNameTonewNameMap.get(copiedNode.getUniqueName());
      for (      NodeContainer nodeContainer : nodeContainerList) {
        INode node=nodeContainer.getNode();
        if (node.getUniqueName().equals(nodeSource)) {
          pastedSourceNode=node;
        }
      }
      INode targetNode=connection.getTarget();
      String nodeToConnect=oldNameTonewNameMap.get(targetNode.getUniqueName());
      if (nodeToConnect != null) {
        for (        NodeContainer nodeContainer : nodeContainerList) {
          INode node=nodeContainer.getNode();
          if (node.getUniqueName().equals(nodeToConnect)) {
            pastedTargetNode=node;
          }
        }
      }
      if ((pastedSourceNode != null) && (pastedTargetNode != null)) {
        String newConnectionName;
        String metaTableName;
        if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.UNIQUE_NAME) && connection.getLineStyle().hasConnectionCategory(IConnectionCategory.FLOW)) {
          String newNameBuiltIn=oldMetaToNewMeta.get(pastedSourceNode.getUniqueName() + "String_Node_Str" + connection.getMetaName());
          if (newNameBuiltIn == null) {
            IElementParameter formatParam=pastedSourceNode.getElementParameter(EParameterName.CONNECTION_FORMAT.getName());
            String baseName=IProcess.DEFAULT_ROW_CONNECTION_NAME;
            if (formatParam != null) {
              String value=(String)formatParam.getValue();
              if (value != null && !"String_Node_Str".equals(value)) {
                baseName=value;
              }
            }
            if (process.checkValidConnectionName(connection.getName(),true)) {
              baseName=null;
            }
            newConnectionName=createNewConnectionName(connection.getName(),baseName);
          }
 else {
            newConnectionName=newNameBuiltIn;
          }
        }
 else {
          newConnectionName=connection.getName();
        }
        String meta=oldMetaToNewMeta.get(pastedSourceNode.getUniqueName() + "String_Node_Str" + connection.getMetaName());
        if (meta != null) {
          if (pastedSourceNode.getConnectorFromType(connection.getLineStyle()).isMultiSchema() && !connection.getLineStyle().equals(EConnectionType.TABLE)) {
            newConnectionName=meta;
          }
          metaTableName=meta;
        }
 else {
          if (pastedSourceNode.getConnectorFromType(connection.getLineStyle()).isMultiSchema()) {
            metaTableName=pastedSourceNode.getMetadataList().get(0).getTableName();
          }
 else {
            metaTableName=pastedSourceNode.getUniqueName();
          }
        }
        IConnection pastedConnection;
        if (!pastedTargetNode.isELTComponent()) {
          pastedConnection=new Connection(pastedSourceNode,pastedTargetNode,connection.getLineStyle(),connection.getConnectorName(),metaTableName,newConnectionName,connection.isMonitorConnection());
        }
 else {
          pastedConnection=new Connection(pastedSourceNode,pastedTargetNode,connection.getLineStyle(),connection.getConnectorName(),metaTableName,newConnectionName,metaTableName,connection.isMonitorConnection());
        }
        connections.add(pastedConnection);
        oldNameTonewNameMap.put(connection.getUniqueName(),pastedConnection.getUniqueName());
        for (        ElementParameter param : (List<ElementParameter>)connection.getElementParameters()) {
          pastedConnection.setPropertyValue(param.getName(),param.getValue());
        }
        IElementParameter uniqueNameParam=pastedConnection.getElementParameter(EParameterName.UNIQUE_NAME.getName());
        String newName=oldNameTonewNameMap.get(connection.getUniqueName());
        if (uniqueNameParam != null && newName != null) {
          if (!newName.equals(uniqueNameParam.getValue())) {
            pastedConnection.setPropertyValue(EParameterName.UNIQUE_NAME.getName(),newName);
          }
        }
        ((Connection)pastedConnection).getConnectionLabel().setOffset(new Point(((Connection)connection).getConnectionLabel().getOffset()));
        INodeConnector connector=pastedConnection.getSourceNodeConnector();
        connector.setCurLinkNbOutput(connector.getCurLinkNbOutput() + 1);
        connector=pastedConnection.getTargetNodeConnector();
        connector.setCurLinkNbInput(connector.getCurLinkNbInput() + 1);
        IExternalNode externalNode=pastedTargetNode.getExternalNode();
        if (externalNode != null) {
          externalNode.renameInputConnection(connection.getName(),newConnectionName);
        }
        if (pastedConnection.getMetadataTable() == null) {
          continue;
        }
        for (        IMetadataColumn column : pastedConnection.getMetadataTable().getListColumns()) {
          String oldConnVar=connection.getName() + "String_Node_Str" + column.getLabel();
          String newConnVar=newConnectionName + "String_Node_Str" + column.getLabel();
          if (!oldToNewConnVarMap.containsKey(oldConnVar)) {
            oldToNewConnVarMap.put(oldConnVar,newConnVar);
          }
        }
      }
    }
  }
  for (  NodeContainer nodeContainer : nodeContainerList) {
    Node node=nodeContainer.getNode();
    for (    String oldConnVar : oldToNewConnVarMap.keySet()) {
      String newConnVar=oldToNewConnVarMap.get(oldConnVar);
      if (newConnVar != null) {
        node.renameData(oldConnVar,newConnVar);
      }
    }
  }
  Map<String,Set<String>> usedDataMap=new HashMap<String,Set<String>>();
  for (  NodeContainer nodeContainer : nodeContainerList) {
    Node currentNode=nodeContainer.getNode();
    String uniqueName=currentNode.getUniqueName();
    for (    String oldName : oldNameTonewNameMap.keySet()) {
      if (!oldName.equals(oldNameTonewNameMap.get(oldName)) && currentNode.useData(oldName)) {
        Set<String> oldNameSet=usedDataMap.get(uniqueName);
        if (oldNameSet == null) {
          oldNameSet=new HashSet<String>();
          usedDataMap.put(uniqueName,oldNameSet);
        }
        oldNameSet.add(oldName);
      }
    }
  }
  Map<String,Set<String>> usedDataMapForConnections=new HashMap<String,Set<String>>();
  for (  IConnection connection : connections) {
    String uniqueName=connection.getUniqueName();
    for (    String oldName : oldNameTonewNameMap.keySet()) {
      if (oldName != null && !oldName.equals(oldNameTonewNameMap.get(oldName)) && UpgradeElementHelper.isUseData(connection,oldName)) {
        Set<String> oldNameSet=usedDataMapForConnections.get(uniqueName);
        if (oldNameSet == null) {
          oldNameSet=new HashSet<String>();
          usedDataMapForConnections.put(uniqueName,oldNameSet);
        }
        oldNameSet.add(oldName);
      }
    }
  }
  if (!usedDataMap.isEmpty() || !usedDataMapForConnections.isEmpty()) {
    MessageBox msgBox=new MessageBox(PlatformUI.getWorkbench().getDisplay().getActiveShell(),SWT.YES | SWT.NO | SWT.ICON_WARNING);
    msgBox.setMessage(Messages.getString("String_Node_Str"));
    if (msgBox.open() == SWT.YES) {
      for (      NodeContainer nodeContainer : nodeContainerList) {
        Node currentNode=nodeContainer.getNode();
        Set<String> oldNameSet=usedDataMap.get(currentNode.getUniqueName());
        if (oldNameSet != null && !oldNameSet.isEmpty()) {
          for (          String oldName : oldNameSet) {
            currentNode.renameData(oldName,oldNameTonewNameMap.get(oldName));
          }
        }
      }
      for (      IConnection connection : connections) {
        Set<String> oldNameSet=usedDataMapForConnections.get(connection.getUniqueName());
        if (oldNameSet != null && !oldNameSet.isEmpty()) {
          for (          String oldName : oldNameSet) {
            UpgradeElementHelper.renameData(connection,oldName,oldNameTonewNameMap.get(oldName));
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void createNodeContainerList(){
  int firstIndex=0;
  int index=0;
  nodeContainerList=new ArrayList<NodeContainer>();
  connections=new ArrayList<IConnection>();
  createdNames=new ArrayList<String>();
  Map<String,String> oldNameTonewNameMap=new HashMap<String,String>();
  Map<String,String> oldMetaToNewMeta=new HashMap<String,String>();
  Map<INode,SubjobContainer> mapping=new HashMap<INode,SubjobContainer>();
  for (  NodePart copiedNodePart : nodeParts) {
    IGraphicalNode copiedNode=(IGraphicalNode)copiedNodePart.getModel();
    if (!containNodeInProcess(copiedNode)) {
      continue;
    }
    IComponent component=ComponentsFactoryProvider.getInstance().get(copiedNode.getComponent().getName(),process.getComponentsType());
    if (component == null) {
      if ((ComponentCategory.CATEGORY_4_MAPREDUCE.getName()).equals(process.getComponentsType())) {
        component=new DummyComponent(copiedNode.getComponent().getName());
      }
 else {
        component=copiedNode.getComponent();
      }
    }
    IGraphicalNode pastedNode=new Node(component,process);
    if (nodeMap != null) {
      nodeMap.put(copiedNode,pastedNode);
    }
    if (isJobletRefactor()) {
      process.removeUniqueNodeName(pastedNode.getUniqueName());
      pastedNode.setPropertyValue(EParameterName.UNIQUE_NAME.getName(),copiedNode.getUniqueName());
      process.addUniqueNodeName(copiedNode.getUniqueName());
    }
    makeCopyNodeAndSubjobMapping(copiedNode,pastedNode,mapping);
    Point location=null;
    if (getCursorLocation() == null) {
      location=copiedNode.getLocation();
    }
 else {
      location=getCursorLocation();
      index=nodeParts.indexOf(copiedNodePart);
    }
    if (process.isGridEnabled()) {
      int tempVar=location.x / TalendEditor.GRID_SIZE;
      location.x=tempVar * TalendEditor.GRID_SIZE;
      tempVar=location.y / TalendEditor.GRID_SIZE;
      location.y=tempVar * TalendEditor.GRID_SIZE;
    }
    pastedNode.setLocation(findLocationForNode(location,copiedNode.getSize(),index,firstIndex,copiedNodePart));
    pastedNode.setSize(copiedNode.getSize());
    INodeConnector mainConnector;
    if (pastedNode.isELTComponent()) {
      mainConnector=pastedNode.getConnectorFromType(EConnectionType.TABLE);
    }
 else {
      mainConnector=pastedNode.getConnectorFromType(EConnectionType.FLOW_MAIN);
    }
    if (!mainConnector.isMultiSchema()) {
      if (copiedNode.getMetadataList().size() != 0) {
        pastedNode.getMetadataList().clear();
        for (        IMetadataTable metaTable : copiedNode.getMetadataList()) {
          IMetadataTable newMetaTable=metaTable.clone();
          if (metaTable.getTableName().equals(copiedNode.getUniqueName())) {
            newMetaTable.setTableName(pastedNode.getUniqueName());
          }
          for (          IMetadataColumn column : metaTable.getListColumns()) {
            if (column.isCustom()) {
              IMetadataColumn newColumn=newMetaTable.getColumn(column.getLabel());
              newColumn.setReadOnly(column.isReadOnly());
              newColumn.setCustom(column.isCustom());
            }
          }
          pastedNode.getMetadataList().add(newMetaTable);
        }
      }
    }
 else {
      List<IMetadataTable> copyOfMetadataList=new ArrayList<IMetadataTable>();
      for (      IMetadataTable metaTable : copiedNode.getMetadataList()) {
        IMetadataTable newTable=metaTable.clone();
        if (copiedNode.isELTComponent()) {
          newTable.setTableName(createNewConnectionName(metaTable.getTableName(),IProcess.DEFAULT_TABLE_CONNECTION_NAME));
        }
 else {
          newTable.setTableName(createNewConnectionName(metaTable.getTableName(),null));
        }
        oldMetaToNewMeta.put(pastedNode.getUniqueName() + "String_Node_Str" + metaTable.getTableName(),newTable.getTableName());
        for (        IMetadataColumn column : metaTable.getListColumns()) {
          if (column.isCustom()) {
            IMetadataColumn newColumn=newTable.getColumn(column.getLabel());
            newColumn.setReadOnly(column.isReadOnly());
            newColumn.setCustom(column.isCustom());
          }
        }
        newTable.sortCustomColumns();
        copyOfMetadataList.add(newTable);
      }
      pastedNode.setMetadataList(copyOfMetadataList);
      IExternalNode externalNode=pastedNode.getExternalNode();
      if (externalNode != null) {
        if (copiedNode.getExternalData() != null) {
          try {
            externalNode.setExternalData(copiedNode.getExternalData().clone());
          }
 catch (          CloneNotSupportedException e) {
            ExceptionHandler.process(e);
          }
          ((Node)pastedNode).setExternalData(externalNode.getExternalData());
        }
        if (copiedNode.getExternalNode().getExternalEmfData() != null) {
          externalNode.setExternalEmfData(EcoreUtil.copy(copiedNode.getExternalNode().getExternalEmfData()));
        }
        for (        IMetadataTable metaTable : copiedNode.getMetadataList()) {
          String oldName=metaTable.getTableName();
          String newName=oldMetaToNewMeta.get(pastedNode.getUniqueName() + "String_Node_Str" + metaTable.getTableName());
          externalNode.renameOutputConnection(oldName,newName);
          CorePlugin.getDefault().getMapperService().renameJoinTable(process,externalNode.getExternalData(),createdNames);
        }
        if (copiedNode.getExternalNode() != null) {
          ImageDescriptor screenshot=copiedNode.getExternalNode().getScreenshot();
          if (screenshot != null) {
            externalNode.setScreenshot(screenshot);
          }
        }
      }
    }
    ((Node)pastedNode).getNodeLabel().setOffset(new Point(((Node)copiedNode).getNodeLabel().getOffset()));
    oldNameTonewNameMap.put(copiedNode.getUniqueName(),pastedNode.getUniqueName());
    if (copiedNode.getElementParametersWithChildrens() != null) {
      for (      ElementParameter param : (List<ElementParameter>)copiedNode.getElementParametersWithChildrens()) {
        if (!EParameterName.UNIQUE_NAME.getName().equals(param.getName())) {
          IElementParameter elementParameter=pastedNode.getElementParameter(param.getName());
          if (elementParameter != null) {
            if (param.getFieldType() == EParameterFieldType.TABLE) {
              List<Map<String,Object>> tableValues=(List<Map<String,Object>>)param.getValue();
              ArrayList newValues=new ArrayList();
              for (              Map<String,Object> map : tableValues) {
                Map<String,Object> newMap=new HashMap<String,Object>();
                newMap.putAll(map);
                if (EParameterName.SCHEMAS.name().equals(param.getName()) && !oldMetaToNewMeta.isEmpty()) {
                  String newSchemaName=oldMetaToNewMeta.get(pastedNode.getUniqueName() + "String_Node_Str" + map.get(EParameterName.SCHEMA.getName()));
                  if (newSchemaName != null) {
                    newMap.put(EParameterName.SCHEMA.getName(),newSchemaName);
                  }
                }
                newValues.add(newMap);
              }
              elementParameter.setValue(newValues);
            }
 else {
              if (param.getParentParameter() != null) {
                String parentName=param.getParentParameter().getName();
                pastedNode.setPropertyValue(parentName + "String_Node_Str" + param.getName(),param.getValue());
              }
 else {
                pastedNode.setPropertyValue(param.getName(),param.getValue());
                elementParameter.setReadOnly(param.getOriginalityReadOnly());
                elementParameter.setRepositoryValueUsed(param.isRepositoryValueUsed());
              }
            }
          }
        }
      }
    }
    NodeContainer nc=null;
    if (((Node)pastedNode).isJoblet()) {
      nc=new JobletContainer((Node)pastedNode);
    }
 else {
      nc=new NodeContainer((Node)pastedNode);
    }
    nodeContainerList.add(nc);
  }
  ((Process)process).setCopyPasteSubjobMappings(mapping);
  Map<String,String> oldToNewConnVarMap=new HashMap<String,String>();
  for (  NodePart copiedNodePart : nodeParts) {
    INode copiedNode=(INode)copiedNodePart.getModel();
    for (    IConnection connection : (List<IConnection>)copiedNode.getOutgoingConnections()) {
      INode pastedTargetNode=null, pastedSourceNode=null;
      String nodeSource=oldNameTonewNameMap.get(copiedNode.getUniqueName());
      for (      NodeContainer nodeContainer : nodeContainerList) {
        INode node=nodeContainer.getNode();
        if (node.getUniqueName().equals(nodeSource)) {
          pastedSourceNode=node;
        }
      }
      INode targetNode=connection.getTarget();
      String nodeToConnect=oldNameTonewNameMap.get(targetNode.getUniqueName());
      if (nodeToConnect != null) {
        for (        NodeContainer nodeContainer : nodeContainerList) {
          INode node=nodeContainer.getNode();
          if (node.getUniqueName().equals(nodeToConnect)) {
            pastedTargetNode=node;
          }
        }
      }
      if ((pastedSourceNode != null) && (pastedTargetNode != null)) {
        String newConnectionName;
        String metaTableName;
        if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.UNIQUE_NAME) && connection.getLineStyle().hasConnectionCategory(IConnectionCategory.FLOW)) {
          String newNameBuiltIn=oldMetaToNewMeta.get(pastedSourceNode.getUniqueName() + "String_Node_Str" + connection.getMetaName());
          if (newNameBuiltIn == null) {
            IElementParameter formatParam=pastedSourceNode.getElementParameter(EParameterName.CONNECTION_FORMAT.getName());
            String baseName=IProcess.DEFAULT_ROW_CONNECTION_NAME;
            if (formatParam != null) {
              String value=(String)formatParam.getValue();
              if (value != null && !"String_Node_Str".equals(value)) {
                baseName=value;
              }
            }
            if (process.checkValidConnectionName(connection.getName(),true)) {
              baseName=null;
            }
            newConnectionName=createNewConnectionName(connection.getName(),baseName);
          }
 else {
            newConnectionName=newNameBuiltIn;
          }
        }
 else {
          newConnectionName=connection.getName();
        }
        String meta=oldMetaToNewMeta.get(pastedSourceNode.getUniqueName() + "String_Node_Str" + connection.getMetaName());
        if (meta != null) {
          if (pastedSourceNode.getConnectorFromType(connection.getLineStyle()).isMultiSchema() && !connection.getLineStyle().equals(EConnectionType.TABLE)) {
            newConnectionName=meta;
          }
          metaTableName=meta;
        }
 else {
          if (pastedSourceNode.getConnectorFromType(connection.getLineStyle()).isMultiSchema()) {
            metaTableName=pastedSourceNode.getMetadataList().get(0).getTableName();
          }
 else {
            metaTableName=pastedSourceNode.getUniqueName();
          }
        }
        IConnection pastedConnection;
        if (!pastedTargetNode.isELTComponent()) {
          pastedConnection=new Connection(pastedSourceNode,pastedTargetNode,connection.getLineStyle(),connection.getConnectorName(),metaTableName,newConnectionName,connection.isMonitorConnection());
        }
 else {
          pastedConnection=new Connection(pastedSourceNode,pastedTargetNode,connection.getLineStyle(),connection.getConnectorName(),metaTableName,newConnectionName,metaTableName,connection.isMonitorConnection());
        }
        connections.add(pastedConnection);
        oldNameTonewNameMap.put(connection.getUniqueName(),pastedConnection.getUniqueName());
        for (        ElementParameter param : (List<ElementParameter>)connection.getElementParameters()) {
          pastedConnection.setPropertyValue(param.getName(),param.getValue());
        }
        IElementParameter uniqueNameParam=pastedConnection.getElementParameter(EParameterName.UNIQUE_NAME.getName());
        String newName=oldNameTonewNameMap.get(connection.getUniqueName());
        if (uniqueNameParam != null && newName != null) {
          if (!newName.equals(uniqueNameParam.getValue())) {
            pastedConnection.setPropertyValue(EParameterName.UNIQUE_NAME.getName(),newName);
          }
        }
        ((Connection)pastedConnection).getConnectionLabel().setOffset(new Point(((Connection)connection).getConnectionLabel().getOffset()));
        INodeConnector connector=pastedConnection.getSourceNodeConnector();
        connector.setCurLinkNbOutput(connector.getCurLinkNbOutput() + 1);
        connector=pastedConnection.getTargetNodeConnector();
        connector.setCurLinkNbInput(connector.getCurLinkNbInput() + 1);
        IExternalNode externalNode=pastedTargetNode.getExternalNode();
        if (externalNode != null) {
          externalNode.renameInputConnection(connection.getName(),newConnectionName);
        }
        if (pastedConnection.getMetadataTable() == null) {
          continue;
        }
        for (        IMetadataColumn column : pastedConnection.getMetadataTable().getListColumns()) {
          String oldConnVar=connection.getName() + "String_Node_Str" + column.getLabel();
          String newConnVar=newConnectionName + "String_Node_Str" + column.getLabel();
          if (!oldToNewConnVarMap.containsKey(oldConnVar)) {
            oldToNewConnVarMap.put(oldConnVar,newConnVar);
          }
        }
      }
    }
  }
  for (  NodeContainer nodeContainer : nodeContainerList) {
    Node node=nodeContainer.getNode();
    for (    String oldConnVar : oldToNewConnVarMap.keySet()) {
      String newConnVar=oldToNewConnVarMap.get(oldConnVar);
      if (newConnVar != null) {
        node.renameData(oldConnVar,newConnVar);
      }
    }
  }
  Map<String,Set<String>> usedDataMap=new HashMap<String,Set<String>>();
  for (  NodeContainer nodeContainer : nodeContainerList) {
    Node currentNode=nodeContainer.getNode();
    String uniqueName=currentNode.getUniqueName();
    for (    String oldName : oldNameTonewNameMap.keySet()) {
      if (oldName.equals(oldNameTonewNameMap.get(oldName))) {
        Set<String> oldNameSet=usedDataMap.get(uniqueName);
        if (oldNameSet == null) {
          oldNameSet=new HashSet<String>();
          usedDataMap.put(uniqueName,oldNameSet);
        }
        oldNameSet.add(oldName);
      }
    }
  }
  Map<String,Set<String>> usedDataMapForConnections=new HashMap<String,Set<String>>();
  for (  IConnection connection : connections) {
    String uniqueName=connection.getUniqueName();
    for (    String oldName : oldNameTonewNameMap.keySet()) {
      if (oldName != null && !oldName.equals(oldNameTonewNameMap.get(oldName)) && UpgradeElementHelper.isUseData(connection,oldName)) {
        Set<String> oldNameSet=usedDataMapForConnections.get(uniqueName);
        if (oldNameSet == null) {
          oldNameSet=new HashSet<String>();
          usedDataMapForConnections.put(uniqueName,oldNameSet);
        }
        oldNameSet.add(oldName);
      }
    }
  }
  if (!usedDataMap.isEmpty() || !usedDataMapForConnections.isEmpty()) {
    MessageBox msgBox=new MessageBox(PlatformUI.getWorkbench().getDisplay().getActiveShell(),SWT.YES | SWT.NO | SWT.ICON_WARNING);
    msgBox.setMessage(Messages.getString("String_Node_Str"));
    if (msgBox.open() == SWT.YES) {
      for (      NodeContainer nodeContainer : nodeContainerList) {
        Node currentNode=nodeContainer.getNode();
        Set<String> oldNameSet=usedDataMap.get(currentNode.getUniqueName());
        if (oldNameSet != null && !oldNameSet.isEmpty()) {
          for (          String oldName : oldNameSet) {
            currentNode.renameData(oldName,oldNameTonewNameMap.get(oldName));
          }
        }
      }
      for (      IConnection connection : connections) {
        Set<String> oldNameSet=usedDataMapForConnections.get(connection.getUniqueName());
        if (oldNameSet != null && !oldNameSet.isEmpty()) {
          for (          String oldName : oldNameSet) {
            UpgradeElementHelper.renameData(connection,oldName,oldNameTonewNameMap.get(oldName));
          }
        }
      }
    }
  }
}