Program: 119329
Project: 119329
Buggy source:
/** 
 * nrousseau Comment method "buildCopyOfGraphicalNodeList".
 * @param graphicalNodeList
 * @return
 */
private List<INode> buildCopyOfGraphicalNodeList(List<INode> graphicalNodeList){
  if (graphicalNodeList.size() == 0) {
    return Collections.emptyList();
  }
  buildGraphicalMap.clear();
  Property property=null;
  if (process instanceof IProcess2) {
    property=((IProcess2)process).getProperty();
  }
 else {
    property=PropertiesFactory.eINSTANCE.createProperty();
    property.setId(graphicalNodeList.get(0).getProcess().getId() + "String_Node_Str");
  }
  duplicatedProcess=new Process(property);
  ((Process)duplicatedProcess).setComponentsType(process.getComponentsType());
  duplicatedProcess.setDuplicate(true);
  duplicatedProcess.setActivate(false);
  ((Process)duplicatedProcess).setGeneratingProcess(this);
  ((Process)duplicatedProcess).setProcessModified(false);
  ((Process)duplicatedProcess).setNeededRoutines(process.getNeededRoutines());
  ((Process)duplicatedProcess).setNeededPigudf(process.getNeededPigudf());
  List<RoutinesParameterType> routines=null;
  if (process instanceof Process) {
    routines=((Process)process).getRoutineDependencies();
  }
  ((Process)duplicatedProcess).setRoutineDependencies(routines);
  copyElementParametersValue(graphicalNodeList.get(0).getProcess(),duplicatedProcess);
  duplicatedProcess.setContextManager(process.getContextManager());
  for (  INode node : graphicalNodeList) {
    if (node.isSubProcessStart() && node.isActivate()) {
      buildNodeFromNode(node,duplicatedProcess);
    }
  }
  for (  INode oldNode : graphicalNodeList) {
    if (oldNode.getComponent().useMerge()) {
      INode newNode=(INode)buildGraphicalMap.get(oldNode);
      adjustMergeOrderForDuplicateNode(oldNode,newNode);
    }
  }
  List<INode> newBuildNodeList=new ArrayList<INode>();
  for (  INode gnode : graphicalNodeList) {
    INode newNode=(INode)buildGraphicalMap.get(gnode);
    if (newNode != null) {
      newBuildNodeList.add(newNode);
    }
  }
  for (  INode node : newBuildNodeList) {
    if (node.isExternalNode()) {
      node.getExternalNode().initialize();
    }
  }
  duplicatedProcess.setActivate(true);
  duplicatedProcess.checkStartNodes();
  return newBuildNodeList;
}

Fixed version (ground truth):
/** 
 * nrousseau Comment method "buildCopyOfGraphicalNodeList".
 * @param graphicalNodeList
 * @return
 */
private List<INode> buildCopyOfGraphicalNodeList(List<INode> graphicalNodeList){
  if (graphicalNodeList.size() == 0) {
    return Collections.emptyList();
  }
  buildGraphicalMap.clear();
  Property property=null;
  if (process instanceof IProcess2) {
    property=((IProcess2)process).getProperty();
  }
 else {
    property=PropertiesFactory.eINSTANCE.createProperty();
    property.setId(graphicalNodeList.get(0).getProcess().getId() + "String_Node_Str");
  }
  duplicatedProcess=new Process(property);
  ((Process)duplicatedProcess).setComponentsType(process.getComponentsType());
  duplicatedProcess.setDuplicate(true);
  duplicatedProcess.setActivate(false);
  ((Process)duplicatedProcess).setProcessModified(false);
  ((Process)duplicatedProcess).setNeededRoutines(process.getNeededRoutines());
  ((Process)duplicatedProcess).setNeededPigudf(process.getNeededPigudf());
  List<RoutinesParameterType> routines=null;
  if (process instanceof Process) {
    routines=((Process)process).getRoutineDependencies();
  }
  ((Process)duplicatedProcess).setRoutineDependencies(routines);
  copyElementParametersValue(graphicalNodeList.get(0).getProcess(),duplicatedProcess);
  duplicatedProcess.setContextManager(process.getContextManager());
  for (  INode node : graphicalNodeList) {
    if (node.isSubProcessStart() && node.isActivate()) {
      buildNodeFromNode(node,duplicatedProcess);
    }
  }
  for (  INode oldNode : graphicalNodeList) {
    if (oldNode.getComponent().useMerge()) {
      INode newNode=(INode)buildGraphicalMap.get(oldNode);
      adjustMergeOrderForDuplicateNode(oldNode,newNode);
    }
  }
  List<INode> newBuildNodeList=new ArrayList<INode>();
  for (  INode gnode : graphicalNodeList) {
    INode newNode=(INode)buildGraphicalMap.get(gnode);
    if (newNode != null) {
      newBuildNodeList.add(newNode);
    }
  }
  for (  INode node : newBuildNodeList) {
    if (node.isExternalNode()) {
      node.getExternalNode().initialize();
    }
  }
  duplicatedProcess.setActivate(true);
  duplicatedProcess.checkStartNodes();
  return newBuildNodeList;
}