Program: 117952
Project: 117952
Buggy source:
public Node cloneNode(Node node,IProcess process,Map<String,List<? extends IElementParameter>> paraMap,boolean lockByOther){
  NodePart nodePart=new NodePart();
  IJobletProviderService service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
  boolean isInOut=false;
  if (service != null) {
    isInOut=service.isJobletInOutComponent(node);
  }
  Node cloneNode=new Node(node.getComponent(),(IProcess2)process,node.getUniqueName());
  ;
  nodePart.setModel(cloneNode);
  if (lockByOther) {
    cloneNode.setReadOnly(true);
  }
 else {
    cloneNode.setReadOnly(false);
  }
  cloneNode.setDummy(node.isDummy());
  cloneNode.setActivate(node.isActivate());
  List<? extends IElementParameter> elementParas=null;
  if (paraMap.containsKey(node.getUniqueName())) {
    elementParas=paraMap.get(node.getUniqueName());
  }
 else {
    elementParas=node.getElementParameters();
  }
  for (  IElementParameter elementPara : elementParas) {
    if (elementPara.getName() != null && !elementPara.getName().equals("String_Node_Str")) {
      IElementParameter cloneElement=cloneNode.getElementParameter(elementPara.getName());
      Object paValue=elementPara.getValue();
      if (paValue instanceof List) {
        List list=new ArrayList();
        list.addAll((List)paValue);
        cloneElement.setValue(list);
      }
 else {
        cloneElement.setContextMode(elementPara.isContextMode());
        cloneElement.setValue(elementPara.getValue());
      }
      if (lockByOther) {
        cloneElement.setReadOnly(true);
      }
 else {
        cloneElement.setReadOnly(elementPara.isReadOnly());
      }
      if (elementPara.getChildParameters() != null) {
        Map<String,IElementParameter> elementParaChild=elementPara.getChildParameters();
        Map<String,IElementParameter> cloneElementChild=cloneElement.getChildParameters();
        Iterator<Entry<String,IElementParameter>> ite=elementParaChild.entrySet().iterator();
        while (ite.hasNext()) {
          Entry<String,IElementParameter> entry=ite.next();
          String key=entry.getKey();
          IElementParameter c=entry.getValue();
          if (key != null && c != null) {
            IElementParameter cloneC=cloneElementChild.get(key);
            if (cloneC != null) {
              cloneC.setValue(c.getValue());
              if (lockByOther) {
                cloneC.setReadOnly(true);
              }
 else {
                cloneC.setReadOnly(c.isReadOnly());
              }
            }
          }
        }
      }
    }
  }
  for (  IElementParameter param : cloneNode.getElementParameters()) {
    String repositoryValue=param.getRepositoryValue();
    if (param.isShow(cloneNode.getElementParameters()) && (repositoryValue != null) && (!param.getName().equals(EParameterName.PROPERTY_TYPE.getName()))&& param.getFieldType() != EParameterFieldType.MEMO_SQL) {
      param.setRepositoryValueUsed(true);
      param.setReadOnly(true);
    }
  }
  cloneNode.setMetadataList(node.getMetadataList());
  cloneNode.setListConnector(node.getListConnector());
  cloneNode.setConnectionName(node.getConnectionName());
  cloneNode.setLocation(node.getLocation());
  IExternalNode externalNode=cloneNode.getExternalNode();
  if (externalNode != null) {
    if (node.getExternalData() != null) {
      try {
        externalNode.setExternalData(node.getExternalData().clone());
      }
 catch (      CloneNotSupportedException e) {
        ExceptionHandler.process(e);
      }
      cloneNode.setExternalData(externalNode.getExternalData());
    }
    if (node.getExternalNode().getExternalEmfData() != null) {
      externalNode.setExternalEmfData(EcoreUtil.copy(node.getExternalNode().getExternalEmfData()));
    }
    if (node.getExternalNode() != null) {
      ImageDescriptor screenshot=node.getExternalNode().getScreenshot();
      if (screenshot != null) {
        externalNode.setScreenshot(screenshot);
      }
    }
  }
  if (node.getElementParameter(EParameterName.LABEL.getName()) != null) {
    cloneNode.setPropertyValue(EParameterName.LABEL.getName(),node.getElementParameter(EParameterName.LABEL.getName()).getValue());
  }
 else {
    cloneNode.setPropertyValue(EParameterName.LABEL.getName(),node.getLabel());
  }
  boolean found=false;
  for (  INode inode : process.getGraphicalNodes()) {
    if (inode.getUniqueName().equals(cloneNode.getUniqueName())) {
      found=true;
    }
  }
  if (!found) {
    ((IProcess2)process).removeUniqueNodeName(cloneNode.getUniqueName());
  }
  return cloneNode;
}

Fixed version (ground truth):
public Node cloneNode(Node node,IProcess process,Map<String,List<? extends IElementParameter>> paraMap,boolean lockByOther){
  NodePart nodePart=new NodePart();
  IJobletProviderService service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
  boolean isInOut=false;
  if (service != null) {
    isInOut=service.isJobletInOutComponent(node);
  }
  Node cloneNode=new Node(node.getComponent(),(IProcess2)process,node.getUniqueName());
  nodePart.setModel(cloneNode);
  if (lockByOther) {
    cloneNode.setReadOnly(true);
  }
 else {
    cloneNode.setReadOnly(false);
  }
  cloneNode.setDummy(node.isDummy());
  cloneNode.setActivate(node.isActivate());
  List<? extends IElementParameter> elementParas=null;
  if (paraMap.containsKey(node.getUniqueName())) {
    elementParas=paraMap.get(node.getUniqueName());
  }
 else {
    elementParas=node.getElementParameters();
  }
  for (  IElementParameter elementPara : elementParas) {
    if (elementPara.getName() != null && !elementPara.getName().equals("String_Node_Str")) {
      IElementParameter cloneElement=cloneNode.getElementParameter(elementPara.getName());
      Object paValue=elementPara.getValue();
      if (paValue instanceof List) {
        List list=new ArrayList();
        list.addAll((List)paValue);
        cloneElement.setValue(list);
      }
 else {
        cloneElement.setContextMode(elementPara.isContextMode());
        cloneElement.setValue(elementPara.getValue());
      }
      if (lockByOther) {
        cloneElement.setReadOnly(true);
      }
 else {
        cloneElement.setReadOnly(elementPara.isReadOnly());
      }
      if (elementPara.getChildParameters() != null) {
        Map<String,IElementParameter> elementParaChild=elementPara.getChildParameters();
        Map<String,IElementParameter> cloneElementChild=cloneElement.getChildParameters();
        Iterator<Entry<String,IElementParameter>> ite=elementParaChild.entrySet().iterator();
        while (ite.hasNext()) {
          Entry<String,IElementParameter> entry=ite.next();
          String key=entry.getKey();
          IElementParameter c=entry.getValue();
          if (key != null && c != null) {
            IElementParameter cloneC=cloneElementChild.get(key);
            if (cloneC != null) {
              cloneC.setValue(c.getValue());
              if (lockByOther) {
                cloneC.setReadOnly(true);
              }
 else {
                cloneC.setReadOnly(c.isReadOnly());
              }
            }
          }
        }
      }
    }
  }
  for (  IElementParameter param : cloneNode.getElementParameters()) {
    String repositoryValue=param.getRepositoryValue();
    if (param.isShow(cloneNode.getElementParameters()) && (repositoryValue != null) && (!param.getName().equals(EParameterName.PROPERTY_TYPE.getName()))&& param.getFieldType() != EParameterFieldType.MEMO_SQL) {
      param.setRepositoryValueUsed(true);
      param.setReadOnly(true);
    }
  }
  cloneNode.setMetadataList(node.getMetadataList());
  cloneNode.setListConnector(node.getListConnector());
  cloneNode.setConnectionName(node.getConnectionName());
  cloneNode.setLocation(node.getLocation());
  IExternalNode externalNode=cloneNode.getExternalNode();
  if (externalNode != null) {
    if (node.getExternalData() != null) {
      try {
        externalNode.setExternalData(node.getExternalData().clone());
      }
 catch (      CloneNotSupportedException e) {
        ExceptionHandler.process(e);
      }
      cloneNode.setExternalData(externalNode.getExternalData());
    }
    if (node.getExternalNode().getExternalEmfData() != null) {
      externalNode.setExternalEmfData(EcoreUtil.copy(node.getExternalNode().getExternalEmfData()));
    }
    if (node.getExternalNode() != null) {
      ImageDescriptor screenshot=node.getExternalNode().getScreenshot();
      if (screenshot != null) {
        externalNode.setScreenshot(screenshot);
      }
    }
  }
  if (node.getElementParameter(EParameterName.LABEL.getName()) != null) {
    cloneNode.setPropertyValue(EParameterName.LABEL.getName(),node.getElementParameter(EParameterName.LABEL.getName()).getValue());
  }
 else {
    cloneNode.setPropertyValue(EParameterName.LABEL.getName(),node.getLabel());
  }
  boolean found=false;
  for (  INode inode : process.getGraphicalNodes()) {
    if (inode.getUniqueName().equals(cloneNode.getUniqueName())) {
      found=true;
    }
  }
  if (!found) {
    ((IProcess2)process).removeUniqueNodeName(cloneNode.getUniqueName());
  }
  return cloneNode;
}