Program: 118188
Project: 118188
Buggy source:
/** 
 * nrousseau Comment method "prepareAllMultipleComponentNodes".
 * @param itemsMap
 * @param multipleComponentManager
 * @param graphicalNode
 */
private void prepareAllMultipleComponentNodes(Map<IMultipleComponentItem,AbstractNode> itemsMap,IMultipleComponentManager multipleComponentManager,INode graphicalNode){
  List<IMultipleComponentItem> itemList=multipleComponentManager.getItemList();
  for (  IMultipleComponentItem curItem : itemList) {
    String uniqueName=graphicalNode.getUniqueName() + "String_Node_Str" + curItem.getName();
    IComponent component=ComponentsFactoryProvider.getInstance().get(curItem.getComponent(),ComponentCategory.CATEGORY_4_DI.getName());
    if (component == null) {
      continue;
    }
    AbstractNode curNode;
    if (component.getPluginExtension() == null) {
      curNode=new DataNode(component,uniqueName);
    }
 else {
      curNode=(AbstractNode)ExternalNodesFactory.getInstance(component.getPluginExtension());
      IExternalData externalData=graphicalNode.getExternalData();
      IExternalNode externalNode=graphicalNode.getExternalNode();
      if (externalData != null) {
        ((IExternalNode)curNode).setExternalData(externalData);
      }
      if (externalNode != null) {
        ((IExternalNode)curNode).setExternalEmfData(externalNode.getExternalEmfData());
      }
      curNode.setStart(graphicalNode.isStart());
      curNode.setElementParameters(graphicalNode.getComponent().createElementParameters(curNode));
      curNode.setListConnector(graphicalNode.getListConnector());
      copyElementParametersValue(graphicalNode,curNode);
      curNode.setUniqueName(uniqueName);
      curNode.setSubProcessStart(graphicalNode.isSubProcessStart());
      curNode.setThereLinkWithHash(graphicalNode.isThereLinkWithHash());
      curNode.setHasConditionalOutputs(graphicalNode.hasConditionalOutputs());
      curNode.setIsMultiplyingOutputs(graphicalNode.isMultiplyingOutputs());
      curNode.setComponent(component);
      List<IMetadataTable> metaList=new ArrayList<IMetadataTable>();
      IMetadataTable metaTable=new MetadataTable();
      metaTable.setTableName(uniqueName);
      metaList.add(metaTable);
      curNode.setMetadataList(metaList);
    }
    updateVirtualComponentProperties(graphicalNode.getComponentProperties(),curItem,curNode);
    curNode.setActivate(graphicalNode.isActivate());
    IMetadataTable newMetadata=null;
    if (multipleComponentManager.isSetConnector()) {
      newMetadata=graphicalNode.getMetadataFromConnector(multipleComponentManager.getConnector()).clone();
    }
 else {
      String sourceConnector=null;
      for (      IMultipleComponentParameter param : multipleComponentManager.getParamList()) {
        if (curItem.getName().equals(param.getTargetComponent())) {
          for (          IElementParameter paramComp : graphicalNode.getElementParameters()) {
            if (param.getSourceValue().equals(paramComp.getName())) {
              sourceConnector=paramComp.getContext();
            }
          }
        }
      }
      if (sourceConnector == null) {
        sourceConnector=EConnectionType.FLOW_MAIN.getName();
      }
      IMetadataTable metadataTable=graphicalNode.getMetadataFromConnector(sourceConnector);
      if (metadataTable != null) {
        newMetadata=metadataTable.clone();
      }
 else       if (!graphicalNode.getMetadataList().isEmpty()) {
        newMetadata=graphicalNode.getMetadataList().get(0).clone();
      }
    }
    if (newMetadata != null) {
      newMetadata.setTableName(uniqueName);
    }
    if (graphicalNode.isDesignSubjobStartNode()) {
      curNode.setDesignSubjobStartNode(null);
    }
 else {
      curNode.setDesignSubjobStartNode(graphicalNode.getDesignSubjobStartNode());
    }
    boolean isSAPBapi=graphicalNode.getComponent() != null && "String_Node_Str".equals(graphicalNode.getComponent().getName());
    if (multipleComponentManager.isSetConnector() && (multipleComponentManager.getOutputName().equals(curItem.getName()) || isSAPBapi)) {
      if (curNode.getComponentName().equals("String_Node_Str")) {
        curNode.setActivate(false);
      }
 else {
        List<IMetadataTable> newMetadataList=new ArrayList<IMetadataTable>();
        if (graphicalNode.getMetadataList() != null) {
          for (          IMetadataTable metadataTable : graphicalNode.getMetadataList()) {
            newMetadataList.add(metadataTable.clone());
          }
        }
        curNode.setMetadataList(newMetadataList);
      }
    }
 else {
      if (curNode.getMetadataList() != null && newMetadata != null) {
        curNode.getMetadataList().remove(0);
        curNode.getMetadataList().add(newMetadata);
      }
    }
    List<IConnection> outgoingConnections=new ArrayList<IConnection>();
    List<IConnection> incomingConnections=new ArrayList<IConnection>();
    curNode.setIncomingConnections(incomingConnections);
    curNode.setOutgoingConnections(outgoingConnections);
    curNode.setProcess(graphicalNode.getProcess());
    curNode.setVirtualGenerateNode(true);
    addDataNode(curNode);
    itemsMap.put(curItem,curNode);
  }
}

Fixed version (ground truth):
/** 
 * nrousseau Comment method "prepareAllMultipleComponentNodes".
 * @param itemsMap
 * @param multipleComponentManager
 * @param graphicalNode
 */
private void prepareAllMultipleComponentNodes(Map<IMultipleComponentItem,AbstractNode> itemsMap,IMultipleComponentManager multipleComponentManager,INode graphicalNode){
  List<IMultipleComponentItem> itemList=multipleComponentManager.getItemList();
  for (  IMultipleComponentItem curItem : itemList) {
    String uniqueName=graphicalNode.getUniqueName() + "String_Node_Str" + curItem.getName();
    IComponentsFactory componentsFactory=ComponentsFactoryProvider.getInstance();
    String currentComponent=curItem.getComponent();
    IComponent component=componentsFactory.get(currentComponent,process.getComponentsType());
    if (component == null) {
      component=componentsFactory.get(currentComponent,ComponentCategory.CATEGORY_4_DI.getName());
    }
    if (component == null) {
      continue;
    }
    AbstractNode curNode;
    if (component.getPluginExtension() == null) {
      curNode=new DataNode(component,uniqueName);
    }
 else {
      curNode=(AbstractNode)ExternalNodesFactory.getInstance(component.getPluginExtension());
      IExternalData externalData=graphicalNode.getExternalData();
      IExternalNode externalNode=graphicalNode.getExternalNode();
      if (externalData != null) {
        ((IExternalNode)curNode).setExternalData(externalData);
      }
      if (externalNode != null) {
        ((IExternalNode)curNode).setExternalEmfData(externalNode.getExternalEmfData());
      }
      curNode.setStart(graphicalNode.isStart());
      curNode.setElementParameters(graphicalNode.getComponent().createElementParameters(curNode));
      curNode.setListConnector(graphicalNode.getListConnector());
      copyElementParametersValue(graphicalNode,curNode);
      curNode.setUniqueName(uniqueName);
      curNode.setSubProcessStart(graphicalNode.isSubProcessStart());
      curNode.setThereLinkWithHash(graphicalNode.isThereLinkWithHash());
      curNode.setHasConditionalOutputs(graphicalNode.hasConditionalOutputs());
      curNode.setIsMultiplyingOutputs(graphicalNode.isMultiplyingOutputs());
      curNode.setComponent(component);
      List<IMetadataTable> metaList=new ArrayList<IMetadataTable>();
      IMetadataTable metaTable=new MetadataTable();
      metaTable.setTableName(uniqueName);
      metaList.add(metaTable);
      curNode.setMetadataList(metaList);
    }
    updateVirtualComponentProperties(graphicalNode.getComponentProperties(),curItem,curNode);
    curNode.setActivate(graphicalNode.isActivate());
    IMetadataTable newMetadata=null;
    if (multipleComponentManager.isSetConnector()) {
      newMetadata=graphicalNode.getMetadataFromConnector(multipleComponentManager.getConnector()).clone();
    }
 else {
      String sourceConnector=null;
      for (      IMultipleComponentParameter param : multipleComponentManager.getParamList()) {
        if (curItem.getName().equals(param.getTargetComponent())) {
          for (          IElementParameter paramComp : graphicalNode.getElementParameters()) {
            if (param.getSourceValue().equals(paramComp.getName())) {
              sourceConnector=paramComp.getContext();
            }
          }
        }
      }
      if (sourceConnector == null) {
        sourceConnector=EConnectionType.FLOW_MAIN.getName();
      }
      IMetadataTable metadataTable=graphicalNode.getMetadataFromConnector(sourceConnector);
      if (metadataTable != null) {
        newMetadata=metadataTable.clone();
      }
 else       if (!graphicalNode.getMetadataList().isEmpty()) {
        newMetadata=graphicalNode.getMetadataList().get(0).clone();
      }
    }
    if (newMetadata != null) {
      newMetadata.setTableName(uniqueName);
    }
    if (graphicalNode.isDesignSubjobStartNode()) {
      curNode.setDesignSubjobStartNode(null);
    }
 else {
      curNode.setDesignSubjobStartNode(graphicalNode.getDesignSubjobStartNode());
    }
    boolean isSAPBapi=graphicalNode.getComponent() != null && "String_Node_Str".equals(graphicalNode.getComponent().getName());
    if (multipleComponentManager.isSetConnector() && (multipleComponentManager.getOutputName().equals(curItem.getName()) || isSAPBapi)) {
      if (curNode.getComponentName().equals("String_Node_Str")) {
        curNode.setActivate(false);
      }
 else {
        List<IMetadataTable> newMetadataList=new ArrayList<IMetadataTable>();
        if (graphicalNode.getMetadataList() != null) {
          for (          IMetadataTable metadataTable : graphicalNode.getMetadataList()) {
            newMetadataList.add(metadataTable.clone());
          }
        }
        curNode.setMetadataList(newMetadataList);
      }
    }
 else {
      if (curNode.getMetadataList() != null && newMetadata != null) {
        curNode.getMetadataList().remove(0);
        curNode.getMetadataList().add(newMetadata);
      }
    }
    List<IConnection> outgoingConnections=new ArrayList<IConnection>();
    List<IConnection> incomingConnections=new ArrayList<IConnection>();
    curNode.setIncomingConnections(incomingConnections);
    curNode.setOutgoingConnections(outgoingConnections);
    curNode.setProcess(graphicalNode.getProcess());
    curNode.setVirtualGenerateNode(true);
    addDataNode(curNode);
    itemsMap.put(curItem,curNode);
  }
}