Program: 55541
Project: 55541
Buggy source:
/** 
 * Registers the given task with the byte buffered channel manager.
 * @param task the task to be registered
 * @param the set of output channels which are initially active
 */
public void register(final Task task,final Set<ChannelID> activeOutputChannels){
  final Environment environment=task.getEnvironment();
  final TaskContext taskContext=task.createTaskContext(this,this.localBufferPoolOwner.remove(task.getVertexID()));
  final Set<GateID> outputGateIDs=environment.getOutputGateIDs();
  for (final Iterator<GateID> gateIt=outputGateIDs.iterator(); gateIt.hasNext(); ) {
    final GateID gateID=gateIt.next();
    final OutputGateContext outputGateContext=taskContext.createOutputGateContext(gateID);
    final Set<ChannelID> outputChannelIDs=environment.getOutputChannelIDsOfGate(gateID);
    for (final Iterator<ChannelID> channelIt=outputChannelIDs.iterator(); channelIt.hasNext(); ) {
      final ChannelID channelID=channelIt.next();
      final OutputChannelContext previousContext=(OutputChannelContext)this.registeredChannels.get(channelID);
      final boolean isActive=activeOutputChannels.contains(channelID);
      final OutputChannelContext outputChannelContext=outputGateContext.createOutputChannelContext(channelID,previousContext,isActive,this.mergeSpilledBuffers);
      if (outputChannelContext.getType() == ChannelType.INMEMORY) {
        addReceiverListHint(outputChannelContext);
      }
      if (LOG.isDebugEnabled())       LOG.debug("String_Node_Str" + outputChannelContext.getChannelID() + "String_Node_Str"+ (isActive ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str");
      this.registeredChannels.put(outputChannelContext.getChannelID(),outputChannelContext);
    }
  }
  final Set<GateID> inputGateIDs=environment.getInputGateIDs();
  for (final Iterator<GateID> gateIt=inputGateIDs.iterator(); gateIt.hasNext(); ) {
    final GateID gateID=gateIt.next();
    final InputGateContext inputGateContext=taskContext.createInputGateContext(gateID);
    final Set<ChannelID> inputChannelIDs=environment.getInputChannelIDsOfGate(gateID);
    for (final Iterator<ChannelID> channelIt=inputChannelIDs.iterator(); channelIt.hasNext(); ) {
      final ChannelID channelID=channelIt.next();
      final InputChannelContext previousContext=(InputChannelContext)this.registeredChannels.get(channelID);
      final InputChannelContext inputChannelContext=inputGateContext.createInputChannelContext(channelID,previousContext);
      if (inputChannelContext.getType() == ChannelType.INMEMORY) {
        addReceiverListHint(inputChannelContext);
      }
      final boolean isActive=activeOutputChannels.contains(inputChannelContext.getChannelID());
      if (LOG.isDebugEnabled())       LOG.debug("String_Node_Str" + inputChannelContext.getChannelID() + "String_Node_Str"+ (isActive ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str");
      this.registeredChannels.put(inputChannelContext.getChannelID(),inputChannelContext);
    }
    final LocalBufferPoolOwner bufferPoolOwner=inputGateContext.getLocalBufferPoolOwner();
    if (bufferPoolOwner != null) {
      this.localBufferPoolOwner.put(inputGateContext.getGateID(),bufferPoolOwner);
    }
  }
  this.localBufferPoolOwner.put(task.getVertexID(),taskContext);
  redistributeGlobalBuffers();
}

Fixed version (ground truth):
/** 
 * Registers the given task with the byte buffered channel manager.
 * @param task the task to be registered
 * @param the set of output channels which are initially active
 */
public void register(final Task task,final Set<ChannelID> activeOutputChannels){
  final Environment environment=task.getEnvironment();
  final TaskContext taskContext=task.createTaskContext(this,this.localBufferPoolOwner.remove(task.getVertexID()));
  final Set<GateID> outputGateIDs=environment.getOutputGateIDs();
  for (final Iterator<GateID> gateIt=outputGateIDs.iterator(); gateIt.hasNext(); ) {
    final GateID gateID=gateIt.next();
    final OutputGateContext outputGateContext=taskContext.createOutputGateContext(gateID);
    final Set<ChannelID> outputChannelIDs=environment.getOutputChannelIDsOfGate(gateID);
    for (final Iterator<ChannelID> channelIt=outputChannelIDs.iterator(); channelIt.hasNext(); ) {
      final ChannelID channelID=channelIt.next();
      final OutputChannelContext previousContext=(OutputChannelContext)this.registeredChannels.get(channelID);
      final boolean isActive=activeOutputChannels.contains(channelID);
      final OutputChannelContext outputChannelContext=outputGateContext.createOutputChannelContext(channelID,previousContext,isActive,this.mergeSpilledBuffers);
      if (outputChannelContext.getType() == ChannelType.INMEMORY) {
        addReceiverListHint(outputChannelContext);
      }
      if (LOG.isDebugEnabled())       LOG.debug("String_Node_Str" + outputChannelContext.getChannelID() + "String_Node_Str"+ (isActive ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str");
      this.registeredChannels.put(outputChannelContext.getChannelID(),outputChannelContext);
    }
  }
  final Set<GateID> inputGateIDs=environment.getInputGateIDs();
  for (final Iterator<GateID> gateIt=inputGateIDs.iterator(); gateIt.hasNext(); ) {
    final GateID gateID=gateIt.next();
    final InputGateContext inputGateContext=taskContext.createInputGateContext(gateID);
    final Set<ChannelID> inputChannelIDs=environment.getInputChannelIDsOfGate(gateID);
    for (final Iterator<ChannelID> channelIt=inputChannelIDs.iterator(); channelIt.hasNext(); ) {
      final ChannelID channelID=channelIt.next();
      final InputChannelContext previousContext=(InputChannelContext)this.registeredChannels.get(channelID);
      final InputChannelContext inputChannelContext=inputGateContext.createInputChannelContext(channelID,previousContext);
      if (inputChannelContext.getType() == ChannelType.INMEMORY) {
        addReceiverListHint(inputChannelContext);
      }
      this.registeredChannels.put(inputChannelContext.getChannelID(),inputChannelContext);
    }
    final LocalBufferPoolOwner bufferPoolOwner=inputGateContext.getLocalBufferPoolOwner();
    if (bufferPoolOwner != null) {
      this.localBufferPoolOwner.put(inputGateContext.getGateID(),bufferPoolOwner);
    }
  }
  this.localBufferPoolOwner.put(task.getVertexID(),taskContext);
  redistributeGlobalBuffers();
}