Program: 62292
Project: 62292
Buggy source:
@Override protected void processNodeOperation(AddRelationshipOperation operation,NodeTemplate sourceNode){
  if (operation.getRelationshipName() == null || operation.getRelationshipName().isEmpty()) {
    throw new InvalidNameException("String_Node_Str",operation.getRelationshipName(),"String_Node_Str");
  }
  if (sourceNode.getRequirements() == null || sourceNode.getRequirements().get(operation.getRequirementName()) == null) {
    throw new NotFoundException("String_Node_Str" + operation.getRequirementName() + "String_Node_Str"+ operation.getNodeName());
  }
  Topology topology=EditionContextManager.getTopology();
  Map<String,NodeTemplate> nodeTemplates=TopologyServiceCore.getNodeTemplates(topology);
  TopologyServiceCore.getNodeTemplate(topology.getId(),operation.getTarget(),nodeTemplates);
  String relationshipId=operation.getRelationshipType() + "String_Node_Str" + operation.getRelationshipVersion();
  IndexedRelationshipType indexedRelationshipType=alienDAO.findById(IndexedRelationshipType.class,relationshipId);
  if (indexedRelationshipType == null) {
    throw new NotFoundException(IndexedRelationshipType.class.getName(),relationshipId,"String_Node_Str");
  }
  boolean upperBoundReachedSource=topologyRequirementBoundsValidationServices.isRequirementUpperBoundReachedForSource(sourceNode,operation.getRequirementName(),topology.getDependencies());
  if (upperBoundReachedSource) {
    throw new RequirementBoundException(operation.getNodeName(),operation.getRequirementName());
  }
  boolean upperBoundReachedTarget=topologyCapabilityBoundsValidationServices.isCapabilityUpperBoundReachedForTarget(operation.getTarget(),nodeTemplates,operation.getTargetedCapabilityName(),topology.getDependencies());
  if (upperBoundReachedTarget) {
    throw new CapabilityBoundException(operation.getTarget(),operation.getTargetedCapabilityName());
  }
  topologyService.loadType(topology,indexedRelationshipType);
  Map<String,RelationshipTemplate> relationships=sourceNode.getRelationships();
  if (relationships == null) {
    relationships=Maps.newHashMap();
    sourceNode.setRelationships(relationships);
  }
  if (relationships.containsKey(operation.getRelationshipName())) {
    throw new AlreadyExistException("String_Node_Str" + operation.getRelationshipName() + "String_Node_Str"+ operation.getNodeName());
  }
  RelationshipTemplate relationshipTemplate=new RelationshipTemplate();
  relationshipTemplate.setName(operation.getRelationshipName());
  relationshipTemplate.setTarget(operation.getTarget());
  relationshipTemplate.setTargetedCapabilityName(operation.getTargetedCapabilityName());
  relationshipTemplate.setRequirementName(operation.getRequirementName());
  relationshipTemplate.setRequirementType(sourceNode.getRequirements().get(operation.getRequirementName()).getType());
  relationshipTemplate.setType(indexedRelationshipType.getElementId());
  relationshipTemplate.setArtifacts(newLinkedHashMap(indexedRelationshipType.getArtifacts()));
  relationshipTemplate.setAttributes(newLinkedHashMap(indexedRelationshipType.getAttributes()));
  Map<String,AbstractPropertyValue> properties=new LinkedHashMap<String,AbstractPropertyValue>();
  NodeTemplateBuilder.fillProperties(properties,indexedRelationshipType.getProperties(),null);
  relationshipTemplate.setProperties(properties);
  relationshipTemplate.setInterfaces(indexedRelationshipType.getInterfaces());
  relationships.put(operation.getRelationshipName(),relationshipTemplate);
  WorkflowsBuilderService.TopologyContext topologyContext=workflowBuilderService.buildTopologyContext(topology);
  workflowBuilderService.addRelationship(topologyContext,operation.getNodeName(),operation.getRelationshipName());
  log.debug("String_Node_Str" + topology.getId() + "String_Node_Str"+ operation.getNodeName()+ "String_Node_Str"+ operation.getRelationshipName()+ "String_Node_Str");
}

Fixed version (ground truth):
@Override protected void processNodeOperation(AddRelationshipOperation operation,NodeTemplate sourceNode){
  if (operation.getRelationshipName() == null || operation.getRelationshipName().isEmpty()) {
    throw new InvalidNameException("String_Node_Str",operation.getRelationshipName(),"String_Node_Str");
  }
  if (sourceNode.getRequirements() == null || sourceNode.getRequirements().get(operation.getRequirementName()) == null) {
    throw new NotFoundException("String_Node_Str" + operation.getRequirementName() + "String_Node_Str"+ operation.getNodeName());
  }
  Topology topology=EditionContextManager.getTopology();
  Map<String,NodeTemplate> nodeTemplates=TopologyServiceCore.getNodeTemplates(topology);
  TopologyServiceCore.getNodeTemplate(topology.getId(),operation.getTarget(),nodeTemplates);
  IndexedRelationshipType indexedRelationshipType=searchService.find(IndexedRelationshipType.class,operation.getRelationshipType(),operation.getRelationshipVersion());
  if (indexedRelationshipType == null) {
    throw new NotFoundException(IndexedRelationshipType.class.getName(),operation.getRelationshipType() + "String_Node_Str" + operation.getRelationshipVersion(),"String_Node_Str");
  }
  boolean upperBoundReachedSource=topologyRequirementBoundsValidationServices.isRequirementUpperBoundReachedForSource(sourceNode,operation.getRequirementName(),topology.getDependencies());
  if (upperBoundReachedSource) {
    throw new RequirementBoundException(operation.getNodeName(),operation.getRequirementName());
  }
  boolean upperBoundReachedTarget=topologyCapabilityBoundsValidationServices.isCapabilityUpperBoundReachedForTarget(operation.getTarget(),nodeTemplates,operation.getTargetedCapabilityName(),topology.getDependencies());
  if (upperBoundReachedTarget) {
    throw new CapabilityBoundException(operation.getTarget(),operation.getTargetedCapabilityName());
  }
  topologyService.loadType(topology,indexedRelationshipType);
  Map<String,RelationshipTemplate> relationships=sourceNode.getRelationships();
  if (relationships == null) {
    relationships=Maps.newHashMap();
    sourceNode.setRelationships(relationships);
  }
  if (relationships.containsKey(operation.getRelationshipName())) {
    throw new AlreadyExistException("String_Node_Str" + operation.getRelationshipName() + "String_Node_Str"+ operation.getNodeName());
  }
  RelationshipTemplate relationshipTemplate=new RelationshipTemplate();
  relationshipTemplate.setName(operation.getRelationshipName());
  relationshipTemplate.setTarget(operation.getTarget());
  relationshipTemplate.setTargetedCapabilityName(operation.getTargetedCapabilityName());
  relationshipTemplate.setRequirementName(operation.getRequirementName());
  relationshipTemplate.setRequirementType(sourceNode.getRequirements().get(operation.getRequirementName()).getType());
  relationshipTemplate.setType(indexedRelationshipType.getElementId());
  relationshipTemplate.setArtifacts(newLinkedHashMap(indexedRelationshipType.getArtifacts()));
  relationshipTemplate.setAttributes(newLinkedHashMap(indexedRelationshipType.getAttributes()));
  Map<String,AbstractPropertyValue> properties=new LinkedHashMap<String,AbstractPropertyValue>();
  NodeTemplateBuilder.fillProperties(properties,indexedRelationshipType.getProperties(),null);
  relationshipTemplate.setProperties(properties);
  relationshipTemplate.setInterfaces(indexedRelationshipType.getInterfaces());
  relationships.put(operation.getRelationshipName(),relationshipTemplate);
  WorkflowsBuilderService.TopologyContext topologyContext=workflowBuilderService.buildTopologyContext(topology);
  workflowBuilderService.addRelationship(topologyContext,operation.getNodeName(),operation.getRelationshipName());
  log.debug("String_Node_Str" + topology.getId() + "String_Node_Str"+ operation.getNodeName()+ "String_Node_Str"+ operation.getRelationshipName()+ "String_Node_Str");
}