Program: 167314
Project: 167314
Buggy source:
public FlowRuntime(String executionId,String userId,AgentProjectVersionFlowDeployment deployment,Agent agent,IComponentRuntimeFactory componentRuntimeFactory,IDefinitionFactory definitionFactory,ExecutorService threadService,IOperationsService operationsService,IConfigurationService configurationService,IExecutionService executionService,Map<String,IResourceRuntime> deployedResources,List<Notification> notifications,Map<String,String> globalSettings,Map<String,String> runtimeParameters){
  if (agent.isAutoRefresh() && configurationService != null && operationsService != null) {
    deployment.setFlow(configurationService.findFlow(deployment.getFlow().getId()));
    deployment.setAgentDeployment(operationsService.findAgentDeployment(deployment.getAgentDeployment().getId()));
    operationsService.refreshAgentParameters(agent);
  }
  this.executionId=executionId;
  this.agentProjectVersionFlowDeployment=deployment;
  this.agent=agent;
  this.notifications=notifications;
  this.componentRuntimeFactory=componentRuntimeFactory;
  this.definitionFactory=definitionFactory;
  this.threadService=threadService;
  this.configurationService=configurationService;
  this.executionService=executionService;
  this.mailSession=new MailSession(globalSettings);
  this.deployedResources=deployedResources;
  this.globalSettings=globalSettings;
  this.flowParameters=new LinkedHashMap<String,String>();
  if (runtimeParameters != null) {
    this.flowParameters.putAll(runtimeParameters);
  }
  getFlowParameters(this.flowParameters,agent,deployment);
  if (threadService != null && executionService != null) {
    this.executionTracker=new ExecutionTrackerRecorder(agent,deployment,threadService,executionService,userId,flowParameters.toString());
  }
 else {
    this.executionTracker=new ExecutionTrackerLogger(deployment);
  }
  this.stepRuntimes=new HashMap<String,StepRuntime>();
  manipulatedFlow=manipulateFlow(deployment.getFlow());
  for (  FlowStep flowStep : manipulatedFlow.getFlowSteps()) {
    boolean enabled=flowStep.getComponent().getBoolean(AbstractComponentRuntime.ENABLED,true);
    if (enabled) {
      ComponentContext context=new ComponentContext(deployment.getAgentDeployment(),flowStep,manipulatedFlow,executionTracker,deployedResources,flowParameters,globalSettings);
      StepRuntime stepRuntime=new StepRuntime(componentRuntimeFactory,definitionFactory,context,this);
      stepRuntimes.put(flowStep.getId(),stepRuntime);
    }
  }
  List<FlowStepLink> links=manipulatedFlow.getFlowStepLinks();
  for (  String stepId : stepRuntimes.keySet()) {
    List<StepRuntime> targetStepRuntimes=new ArrayList<StepRuntime>();
    List<StepRuntime> sourceStepRuntimes=new ArrayList<StepRuntime>();
    for (    FlowStepLink flowStepLink : links) {
      if (stepId.equals(flowStepLink.getSourceStepId())) {
        StepRuntime runtime=stepRuntimes.get(flowStepLink.getTargetStepId());
        if (runtime != null) {
          targetStepRuntimes.add(runtime);
        }
      }
      if (stepId.equals(flowStepLink.getTargetStepId())) {
        StepRuntime runtime=stepRuntimes.get(flowStepLink.getSourceStepId());
        if (runtime != null) {
          sourceStepRuntimes.add(runtime);
        }
      }
    }
    StepRuntime runtime=stepRuntimes.get(stepId);
    if (runtime != null) {
      runtime.setTargetStepRuntimes(targetStepRuntimes);
      runtime.setSourceStepRuntimes(sourceStepRuntimes);
    }
  }
  manipulatedFlow.calculateApproximateOrder();
}

Fixed version (ground truth):
public FlowRuntime(String executionId,String userId,AgentProjectVersionFlowDeployment deployment,Agent agent,IComponentRuntimeFactory componentRuntimeFactory,IDefinitionFactory definitionFactory,ExecutorService threadService,IOperationsService operationsService,IConfigurationService configurationService,IExecutionService executionService,Map<String,IResourceRuntime> deployedResources,List<Notification> notifications,Map<String,String> globalSettings,Map<String,String> runtimeParameters){
  if (agent.isAutoRefresh() && configurationService != null && operationsService != null) {
    deployment.setFlow(configurationService.findFlow(deployment.getFlow().getId()));
    deployment.setAgentDeployment(operationsService.findAgentDeployment(deployment.getAgentDeployment().getId()));
    operationsService.refreshAgentParameters(agent);
  }
  this.executionId=executionId;
  this.agentProjectVersionFlowDeployment=deployment;
  this.agent=agent;
  this.notifications=notifications;
  this.componentRuntimeFactory=componentRuntimeFactory;
  this.definitionFactory=definitionFactory;
  this.threadService=threadService;
  this.configurationService=configurationService;
  this.executionService=executionService;
  this.deployedResources=deployedResources;
  this.globalSettings=globalSettings;
  this.flowParameters=new LinkedHashMap<String,String>();
  if (runtimeParameters != null) {
    this.flowParameters.putAll(runtimeParameters);
  }
  getFlowParameters(this.flowParameters,agent,deployment);
  if (threadService != null && executionService != null) {
    this.executionTracker=new ExecutionTrackerRecorder(agent,deployment,threadService,executionService,userId,flowParameters.toString());
  }
 else {
    this.executionTracker=new ExecutionTrackerLogger(deployment);
  }
  this.stepRuntimes=new HashMap<String,StepRuntime>();
  manipulatedFlow=manipulateFlow(deployment.getFlow());
  for (  FlowStep flowStep : manipulatedFlow.getFlowSteps()) {
    boolean enabled=flowStep.getComponent().getBoolean(AbstractComponentRuntime.ENABLED,true);
    if (enabled) {
      ComponentContext context=new ComponentContext(deployment.getAgentDeployment(),flowStep,manipulatedFlow,executionTracker,deployedResources,flowParameters,globalSettings);
      StepRuntime stepRuntime=new StepRuntime(componentRuntimeFactory,definitionFactory,context,this);
      stepRuntimes.put(flowStep.getId(),stepRuntime);
    }
  }
  List<FlowStepLink> links=manipulatedFlow.getFlowStepLinks();
  for (  String stepId : stepRuntimes.keySet()) {
    List<StepRuntime> targetStepRuntimes=new ArrayList<StepRuntime>();
    List<StepRuntime> sourceStepRuntimes=new ArrayList<StepRuntime>();
    for (    FlowStepLink flowStepLink : links) {
      if (stepId.equals(flowStepLink.getSourceStepId())) {
        StepRuntime runtime=stepRuntimes.get(flowStepLink.getTargetStepId());
        if (runtime != null) {
          targetStepRuntimes.add(runtime);
        }
      }
      if (stepId.equals(flowStepLink.getTargetStepId())) {
        StepRuntime runtime=stepRuntimes.get(flowStepLink.getSourceStepId());
        if (runtime != null) {
          sourceStepRuntimes.add(runtime);
        }
      }
    }
    StepRuntime runtime=stepRuntimes.get(stepId);
    if (runtime != null) {
      runtime.setTargetStepRuntimes(targetStepRuntimes);
      runtime.setSourceStepRuntimes(sourceStepRuntimes);
    }
  }
  manipulatedFlow.calculateApproximateOrder();
}