Program: 62377
Project: 62377
Buggy source:
/** 
 */
@Override public void addRelationship(Workflow wf,String nodeId,NodeTemplate nodeTemplate,RelationshipTemplate relationshipTemplate,TopologyContext toscaTypeFinder){
  if (WorkflowUtils.isNativeNode(nodeId,toscaTypeFinder)) {
    return;
  }
  IndexedRelationshipType indexedRelationshipType=toscaTypeFinder.findElement(IndexedRelationshipType.class,relationshipTemplate.getType());
  String targetId=relationshipTemplate.getTarget();
  boolean targetIsNative=WorkflowUtils.isNativeNode(targetId,toscaTypeFinder);
  if (targetIsNative || WorkflowUtils.isOfType(indexedRelationshipType,NormativeRelationshipConstants.HOSTED_ON)) {
    AbstractStep lastStep=null;
    if (targetIsNative) {
      lastStep=WorkflowUtils.getDelegateWorkflowStepByNode(wf,targetId);
    }
 else {
      lastStep=WorkflowUtils.getStateStepByNode(wf,targetId,ToscaNodeLifecycleConstants.STARTED);
    }
    NodeActivityStep initSourceStep=WorkflowUtils.getStateStepByNode(wf,nodeId,ToscaNodeLifecycleConstants.INITIAL);
    WorkflowUtils.linkSteps(lastStep,initSourceStep);
  }
 else {
    NodeActivityStep configuringTargetStep=WorkflowUtils.getStateStepByNode(wf,targetId,ToscaNodeLifecycleConstants.CONFIGURING);
    NodeActivityStep createdSourceStep=WorkflowUtils.getStateStepByNode(wf,nodeId,ToscaNodeLifecycleConstants.CREATED);
    WorkflowUtils.linkSteps(createdSourceStep,configuringTargetStep);
    NodeActivityStep startedTargetStep=WorkflowUtils.getStateStepByNode(wf,targetId,ToscaNodeLifecycleConstants.STARTED);
    NodeActivityStep configuringSourceStep=WorkflowUtils.getStateStepByNode(wf,nodeId,ToscaNodeLifecycleConstants.CONFIGURING);
    WorkflowUtils.linkSteps(startedTargetStep,configuringSourceStep);
  }
}

Fixed version (ground truth):
/** 
 */
@Override public void addRelationship(Workflow wf,String nodeId,NodeTemplate nodeTemplate,RelationshipTemplate relationshipTemplate,TopologyContext toscaTypeFinder){
  if (WorkflowUtils.isNativeOrSubstitutionNode(nodeId,toscaTypeFinder)) {
    return;
  }
  IndexedRelationshipType indexedRelationshipType=toscaTypeFinder.findElement(IndexedRelationshipType.class,relationshipTemplate.getType());
  String targetId=relationshipTemplate.getTarget();
  boolean targetIsNative=WorkflowUtils.isNativeOrSubstitutionNode(targetId,toscaTypeFinder);
  if (targetIsNative || WorkflowUtils.isOfType(indexedRelationshipType,NormativeRelationshipConstants.HOSTED_ON)) {
    AbstractStep lastStep=null;
    if (targetIsNative) {
      lastStep=WorkflowUtils.getDelegateWorkflowStepByNode(wf,targetId);
    }
 else {
      lastStep=WorkflowUtils.getStateStepByNode(wf,targetId,ToscaNodeLifecycleConstants.STARTED);
    }
    NodeActivityStep initSourceStep=WorkflowUtils.getStateStepByNode(wf,nodeId,ToscaNodeLifecycleConstants.INITIAL);
    WorkflowUtils.linkSteps(lastStep,initSourceStep);
  }
 else {
    NodeActivityStep configuringTargetStep=WorkflowUtils.getStateStepByNode(wf,targetId,ToscaNodeLifecycleConstants.CONFIGURING);
    NodeActivityStep createdSourceStep=WorkflowUtils.getStateStepByNode(wf,nodeId,ToscaNodeLifecycleConstants.CREATED);
    WorkflowUtils.linkSteps(createdSourceStep,configuringTargetStep);
    NodeActivityStep startedTargetStep=WorkflowUtils.getStateStepByNode(wf,targetId,ToscaNodeLifecycleConstants.STARTED);
    NodeActivityStep configuringSourceStep=WorkflowUtils.getStateStepByNode(wf,nodeId,ToscaNodeLifecycleConstants.CONFIGURING);
    WorkflowUtils.linkSteps(startedTargetStep,configuringSourceStep);
  }
}