Program: 62240
Project: 62240
Buggy source:
@Override public void process(ReplaceNodeOperation operation){
  Topology topology=EditionContextManager.getTopology();
  Map<String,NodeTemplate> nodeTemplates=TopologyServiceCore.getNodeTemplates(topology);
  NodeTemplate oldNodeTemplate=TopologyServiceCore.getNodeTemplate(topology.getId(),operation.getNodeName(),nodeTemplates);
  String[] splittedId=operation.getNewTypeId().split("String_Node_Str");
  NodeType newType=toscaTypeSearchService.find(NodeType.class,splittedId[0],splittedId[1]);
  newType=topologyService.loadType(topology,newType);
  NodeTemplate newNodeTemplate=topologyService.buildNodeTemplate(topology.getDependencies(),newType,null);
  newNodeTemplate.setName(oldNodeTemplate.getName());
  newNodeTemplate.setRelationships(oldNodeTemplate.getRelationships());
  nodeTemplates.put(oldNodeTemplate.getName(),newNodeTemplate);
  topologyService.unloadType(topology,oldNodeTemplate.getType());
  workflowBuilderService.removeNode(topology,oldNodeTemplate.getName(),oldNodeTemplate);
  if (topology.getSubstitutionMapping() != null) {
    removeNodeTemplateSubstitutionTargetMapEntry(oldNodeTemplate.getName(),topology.getSubstitutionMapping().getCapabilities());
    removeNodeTemplateSubstitutionTargetMapEntry(oldNodeTemplate.getName(),topology.getSubstitutionMapping().getRequirements());
  }
  log.debug("String_Node_Str",oldNodeTemplate.getName(),oldNodeTemplate.getName(),operation.getNewTypeId(),topology.getId());
  workflowBuilderService.addNode(workflowBuilderService.buildTopologyContext(topology),oldNodeTemplate.getName(),newNodeTemplate);
}

Fixed version (ground truth):
@Override public void process(ReplaceNodeOperation operation){
  Topology topology=EditionContextManager.getTopology();
  Map<String,NodeTemplate> nodeTemplates=TopologyServiceCore.getNodeTemplates(topology);
  NodeTemplate oldNodeTemplate=TopologyServiceCore.getNodeTemplate(topology.getId(),operation.getNodeName(),nodeTemplates);
  String[] splittedId=operation.getNewTypeId().split("String_Node_Str");
  NodeType newType=toscaTypeSearchService.find(NodeType.class,splittedId[0],splittedId[1]);
  newType=topologyService.loadType(topology,newType);
  NodeTemplate newNodeTemplate=NodeTemplateBuilder.buildNodeTemplate(newType,oldNodeTemplate,false);
  newNodeTemplate.setName(operation.getNodeName());
  newNodeTemplate.setName(oldNodeTemplate.getName());
  newNodeTemplate.setRelationships(oldNodeTemplate.getRelationships());
  nodeTemplates.put(oldNodeTemplate.getName(),newNodeTemplate);
  topologyService.unloadType(topology,oldNodeTemplate.getType());
  workflowBuilderService.removeNode(topology,oldNodeTemplate.getName(),oldNodeTemplate);
  if (topology.getSubstitutionMapping() != null) {
    removeNodeTemplateSubstitutionTargetMapEntry(oldNodeTemplate.getName(),topology.getSubstitutionMapping().getCapabilities());
    removeNodeTemplateSubstitutionTargetMapEntry(oldNodeTemplate.getName(),topology.getSubstitutionMapping().getRequirements());
  }
  log.debug("String_Node_Str",oldNodeTemplate.getName(),oldNodeTemplate.getName(),operation.getNewTypeId(),topology.getId());
  workflowBuilderService.addNode(workflowBuilderService.buildTopologyContext(topology),oldNodeTemplate.getName(),newNodeTemplate);
}