Program: 4897
Project: 4897
Buggy source:
@Override protected void configure(){
  setName(NAME);
  setDescription(DESCRIPTION);
  Map<String,String> properties=new HashMap<>();
  properties.put(Constants.PIPELINE_SPEC_KEY,GSON.toJson(spec));
  setProperties(properties);
  stageSpecs=new HashMap<>();
  useSpark=engine == Engine.SPARK;
  if (!useSpark) {
    for (    StageSpec stageSpec : spec.getStages()) {
      stageSpecs.put(stageSpec.getName(),stageSpec);
      String pluginType=stageSpec.getPlugin().getType();
      if (SparkCompute.PLUGIN_TYPE.equals(pluginType) || SparkSink.PLUGIN_TYPE.equals(pluginType)) {
        useSpark=true;
        break;
      }
    }
  }
  PipelinePlanner planner;
  Set<String> actionTypes=ImmutableSet.of(Action.PLUGIN_TYPE,Constants.SPARK_PROGRAM_PLUGIN_TYPE);
  if (useSpark) {
    planner=new PipelinePlanner(supportedPluginTypes,ImmutableSet.<String>of(),ImmutableSet.<String>of(),actionTypes);
  }
 else {
    planner=new PipelinePlanner(supportedPluginTypes,ImmutableSet.of(BatchAggregator.PLUGIN_TYPE,BatchJoiner.PLUGIN_TYPE),ImmutableSet.of(SparkCompute.PLUGIN_TYPE,SparkSink.PLUGIN_TYPE),actionTypes);
  }
  plan=planner.plan(spec);
  if (plan.getPhases().size() == 1) {
    addProgram(plan.getPhases().keySet().iterator().next(),new TrunkProgramAdder(getConfigurer()));
    return;
  }
  if (plan.getPhaseConnections().isEmpty()) {
    WorkflowProgramAdder programAdder;
    WorkflowForkConfigurer forkConfigurer=getConfigurer().fork();
    programAdder=new BranchProgramAdder(forkConfigurer);
    for (    String phaseName : plan.getPhases().keySet()) {
      addProgram(phaseName,programAdder);
    }
    if (forkConfigurer != null) {
      forkConfigurer.join();
    }
    return;
  }
  dag=new ControlDag(plan.getPhaseConnections());
  dag.flatten();
  String start=dag.getSources().iterator().next();
  addPrograms(start,getConfigurer());
}

Fixed version (ground truth):
@Override protected void configure(){
  setName(NAME);
  setDescription(DESCRIPTION);
  Map<String,String> properties=new HashMap<>();
  properties.put(Constants.PIPELINE_SPEC_KEY,GSON.toJson(spec));
  setProperties(properties);
  stageSpecs=new HashMap<>();
  useSpark=engine == Engine.SPARK;
  for (  StageSpec stageSpec : spec.getStages()) {
    stageSpecs.put(stageSpec.getName(),stageSpec);
    String pluginType=stageSpec.getPlugin().getType();
    if (SparkCompute.PLUGIN_TYPE.equals(pluginType) || SparkSink.PLUGIN_TYPE.equals(pluginType)) {
      useSpark=true;
    }
  }
  PipelinePlanner planner;
  Set<String> actionTypes=ImmutableSet.of(Action.PLUGIN_TYPE,Constants.SPARK_PROGRAM_PLUGIN_TYPE);
  if (useSpark) {
    planner=new PipelinePlanner(supportedPluginTypes,ImmutableSet.<String>of(),ImmutableSet.<String>of(),actionTypes);
  }
 else {
    planner=new PipelinePlanner(supportedPluginTypes,ImmutableSet.of(BatchAggregator.PLUGIN_TYPE,BatchJoiner.PLUGIN_TYPE),ImmutableSet.of(SparkCompute.PLUGIN_TYPE,SparkSink.PLUGIN_TYPE),actionTypes);
  }
  plan=planner.plan(spec);
  if (plan.getPhases().size() == 1) {
    addProgram(plan.getPhases().keySet().iterator().next(),new TrunkProgramAdder(getConfigurer()));
    return;
  }
  if (plan.getPhaseConnections().isEmpty()) {
    WorkflowProgramAdder programAdder;
    WorkflowForkConfigurer forkConfigurer=getConfigurer().fork();
    programAdder=new BranchProgramAdder(forkConfigurer);
    for (    String phaseName : plan.getPhases().keySet()) {
      addProgram(phaseName,programAdder);
    }
    if (forkConfigurer != null) {
      forkConfigurer.join();
    }
    return;
  }
  dag=new ControlDag(plan.getPhaseConnections());
  dag.flatten();
  String start=dag.getSources().iterator().next();
  addPrograms(start,getConfigurer());
}