Program: 62246
Project: 62246
Buggy source:
@Override public void process(ReplaceNodeOperation operation){
  Topology topology=EditionContextManager.getTopology();
  Set<CSARDependency> oldDependencies=topology.getDependencies();
  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=searchService.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);
  if (!Objects.equals(topology.getDependencies(),oldDependencies)) {
    csarService.setDependencies(topology.getId(),topology.getDependencies());
  }
}

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=searchService.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);
}