Program: 55172
Project: 55172
Buggy source:
private void translateChannel(Channel input,int inputIndex,AbstractJobVertex targetVertex,TaskConfig targetVertexConfig) throws Exception {
  final PlanNode inputPlanNode=input.getSource();
  final Iterator<Channel> allInChannels;
  if (inputPlanNode instanceof UnionPlanNode) {
    allInChannels=((UnionPlanNode)inputPlanNode).getListOfInputs().iterator();
  }
 else   if (inputPlanNode instanceof BulkPartialSolutionPlanNode) {
    if (this.vertices.get(inputPlanNode) == null) {
      final BulkPartialSolutionPlanNode pspn=(BulkPartialSolutionPlanNode)inputPlanNode;
      final BulkIterationPlanNode iterationNode=pspn.getContainingIterationNode();
      if (iterationNode.getInput().getSource() instanceof UnionPlanNode) {
        allInChannels=((UnionPlanNode)iterationNode.getInput().getSource()).getInputs();
      }
 else {
        allInChannels=Collections.singletonList(iterationNode.getInput()).iterator();
      }
      targetVertexConfig.setIterationHeadPartialSolutionOrWorksetInputIndex(inputIndex);
    }
 else {
      allInChannels=Collections.singletonList(input).iterator();
    }
  }
 else   if (inputPlanNode instanceof WorksetPlanNode) {
    if (this.vertices.get(inputPlanNode) == null) {
      final WorksetPlanNode wspn=(WorksetPlanNode)inputPlanNode;
      final WorksetIterationPlanNode iterationNode=wspn.getContainingIterationNode();
      if (iterationNode.getInput2().getSource() instanceof UnionPlanNode) {
        allInChannels=((UnionPlanNode)iterationNode.getInput2().getSource()).getInputs();
      }
 else {
        allInChannels=Collections.singletonList(iterationNode.getInput2()).iterator();
      }
      targetVertexConfig.setIterationHeadPartialSolutionOrWorksetInputIndex(inputIndex);
    }
 else {
      allInChannels=Collections.singletonList(input).iterator();
    }
  }
 else   if (inputPlanNode instanceof SolutionSetPlanNode) {
    return;
  }
 else {
    allInChannels=Collections.singletonList(input).iterator();
  }
  TypeSerializerFactory<?> typeSerFact=null;
  int numChannelsTotal=0;
  int numChannelsDynamicPath=0;
  int numDynamicSenderTasksTotal=0;
  while (allInChannels.hasNext()) {
    final Channel inConn=allInChannels.next();
    if (typeSerFact == null) {
      typeSerFact=inConn.getSerializer();
    }
 else     if (!typeSerFact.equals(inConn.getSerializer())) {
      throw new CompilerException("String_Node_Str");
    }
    final PlanNode sourceNode=inConn.getSource();
    AbstractJobVertex sourceVertex=this.vertices.get(sourceNode);
    TaskConfig sourceVertexConfig;
    if (sourceVertex == null) {
      final TaskInChain chainedTask;
      final IterationDescriptor iteration;
      if ((chainedTask=this.chainedTasks.get(sourceNode)) != null) {
        if (chainedTask.getContainingVertex() == null)         throw new IllegalStateException("String_Node_Str");
        sourceVertex=chainedTask.getContainingVertex();
        sourceVertexConfig=chainedTask.getTaskConfig();
      }
 else       if ((iteration=this.iterations.get(sourceNode)) != null) {
        sourceVertex=iteration.getHeadTask();
        sourceVertexConfig=iteration.getHeadFinalResultConfig();
      }
 else {
        throw new CompilerException("String_Node_Str");
      }
    }
 else {
      sourceVertexConfig=new TaskConfig(sourceVertex.getConfiguration());
    }
    DistributionPattern pattern=connectJobVertices(inConn,inputIndex,sourceVertex,sourceVertexConfig,targetVertex,targetVertexConfig);
    numChannelsTotal++;
    if (inConn.isOnDynamicPath()) {
      numChannelsDynamicPath++;
      numDynamicSenderTasksTotal+=getNumberOfSendersPerReceiver(pattern,sourceVertex.getNumberOfSubtasks(),targetVertex.getNumberOfSubtasks());
    }
  }
  if (numChannelsDynamicPath > 0 && numChannelsTotal != numChannelsDynamicPath) {
    throw new CompilerException("String_Node_Str");
  }
  if (numDynamicSenderTasksTotal > 0) {
    targetVertexConfig.setGateIterativeWithNumberOfEventsUntilInterrupt(inputIndex,numDynamicSenderTasksTotal);
  }
  addLocalInfoFromChannelToConfig(input,targetVertexConfig,inputIndex);
}

Fixed version (ground truth):
private int translateChannel(Channel input,int inputIndex,AbstractJobVertex targetVertex,TaskConfig targetVertexConfig) throws Exception {
  final PlanNode inputPlanNode=input.getSource();
  final Iterator<Channel> allInChannels;
  if (inputPlanNode instanceof UnionPlanNode) {
    allInChannels=((UnionPlanNode)inputPlanNode).getListOfInputs().iterator();
  }
 else   if (inputPlanNode instanceof BulkPartialSolutionPlanNode) {
    if (this.vertices.get(inputPlanNode) == null) {
      final BulkPartialSolutionPlanNode pspn=(BulkPartialSolutionPlanNode)inputPlanNode;
      final BulkIterationPlanNode iterationNode=pspn.getContainingIterationNode();
      if (iterationNode.getInput().getSource() instanceof UnionPlanNode) {
        allInChannels=((UnionPlanNode)iterationNode.getInput().getSource()).getInputs();
      }
 else {
        allInChannels=Collections.singletonList(iterationNode.getInput()).iterator();
      }
      targetVertexConfig.setIterationHeadPartialSolutionOrWorksetInputIndex(inputIndex);
    }
 else {
      allInChannels=Collections.singletonList(input).iterator();
    }
  }
 else   if (inputPlanNode instanceof WorksetPlanNode) {
    if (this.vertices.get(inputPlanNode) == null) {
      final WorksetPlanNode wspn=(WorksetPlanNode)inputPlanNode;
      final WorksetIterationPlanNode iterationNode=wspn.getContainingIterationNode();
      if (iterationNode.getInput2().getSource() instanceof UnionPlanNode) {
        allInChannels=((UnionPlanNode)iterationNode.getInput2().getSource()).getInputs();
      }
 else {
        allInChannels=Collections.singletonList(iterationNode.getInput2()).iterator();
      }
      targetVertexConfig.setIterationHeadPartialSolutionOrWorksetInputIndex(inputIndex);
    }
 else {
      allInChannels=Collections.singletonList(input).iterator();
    }
  }
 else   if (inputPlanNode instanceof SolutionSetPlanNode) {
    return 0;
  }
 else {
    allInChannels=Collections.singletonList(input).iterator();
  }
  TypeSerializerFactory<?> typeSerFact=null;
  int numChannelsTotal=0;
  int numChannelsDynamicPath=0;
  int numDynamicSenderTasksTotal=0;
  while (allInChannels.hasNext()) {
    final Channel inConn=allInChannels.next();
    if (typeSerFact == null) {
      typeSerFact=inConn.getSerializer();
    }
 else     if (!typeSerFact.equals(inConn.getSerializer())) {
      throw new CompilerException("String_Node_Str");
    }
    final PlanNode sourceNode=inConn.getSource();
    AbstractJobVertex sourceVertex=this.vertices.get(sourceNode);
    TaskConfig sourceVertexConfig;
    if (sourceVertex == null) {
      final TaskInChain chainedTask;
      final IterationDescriptor iteration;
      if ((chainedTask=this.chainedTasks.get(sourceNode)) != null) {
        if (chainedTask.getContainingVertex() == null)         throw new IllegalStateException("String_Node_Str");
        sourceVertex=chainedTask.getContainingVertex();
        sourceVertexConfig=chainedTask.getTaskConfig();
      }
 else       if ((iteration=this.iterations.get(sourceNode)) != null) {
        sourceVertex=iteration.getHeadTask();
        sourceVertexConfig=iteration.getHeadFinalResultConfig();
      }
 else {
        throw new CompilerException("String_Node_Str");
      }
    }
 else {
      sourceVertexConfig=new TaskConfig(sourceVertex.getConfiguration());
    }
    DistributionPattern pattern=connectJobVertices(inConn,inputIndex,sourceVertex,sourceVertexConfig,targetVertex,targetVertexConfig);
    numChannelsTotal++;
    if (inConn.isOnDynamicPath()) {
      numChannelsDynamicPath++;
      numDynamicSenderTasksTotal+=getNumberOfSendersPerReceiver(pattern,sourceVertex.getNumberOfSubtasks(),targetVertex.getNumberOfSubtasks());
    }
  }
  if (numChannelsDynamicPath > 0 && numChannelsTotal != numChannelsDynamicPath) {
    throw new CompilerException("String_Node_Str");
  }
  if (numDynamicSenderTasksTotal > 0) {
    targetVertexConfig.setGateIterativeWithNumberOfEventsUntilInterrupt(inputIndex,numDynamicSenderTasksTotal);
  }
  addLocalInfoFromChannelToConfig(input,targetVertexConfig,inputIndex);
  return 1;
}