Program: 87806
Project: 87806
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public ConnectionInfoLookupResponse lookupConnectionInfo(final InstanceConnectionInfo caller,final JobID jobID,final ChannelID sourceChannelID){
  final ExecutionGraph eg=this.scheduler.getExecutionGraphByID(jobID);
  if (eg == null) {
    LOG.error("String_Node_Str" + jobID);
    return ConnectionInfoLookupResponse.createReceiverNotFound();
  }
  final AbstractOutputChannel<? extends Record> outputChannel=eg.getOutputChannelByID(sourceChannelID);
  if (outputChannel == null) {
    AbstractInputChannel<? extends Record> inputChannel=eg.getInputChannelByID(sourceChannelID);
    final ChannelID connectedChannelID=inputChannel.getConnectedChannelID();
    final ExecutionVertex connectedVertex=eg.getVertexByChannelID(connectedChannelID);
    final AbstractInstance assignedInstance=connectedVertex.getAllocatedResource().getInstance();
    if (assignedInstance == null) {
      LOG.error("String_Node_Str" + connectedChannelID + "String_Node_Str");
      return ConnectionInfoLookupResponse.createReceiverNotReady();
    }
    final ExecutionState executionState=connectedVertex.getExecutionState();
    if (executionState == ExecutionState.FINISHED) {
      return ConnectionInfoLookupResponse.createReceiverFoundAndReady();
    }
    if (executionState != ExecutionState.RUNNING && executionState != ExecutionState.REPLAYING && executionState != ExecutionState.FINISHING) {
      return ConnectionInfoLookupResponse.createReceiverNotReady();
    }
    if (assignedInstance.getInstanceConnectionInfo().equals(caller)) {
      return ConnectionInfoLookupResponse.createReceiverFoundAndReady(connectedChannelID);
    }
 else {
      return ConnectionInfoLookupResponse.createReceiverFoundAndReady(assignedInstance.getInstanceConnectionInfo());
    }
  }
  if (outputChannel.isBroadcastChannel()) {
    return multicastManager.lookupConnectionInfo(caller,jobID,sourceChannelID);
  }
 else {
    final ExecutionVertex targetVertex=eg.getVertexByChannelID(outputChannel.getConnectedChannelID());
    if (targetVertex == null) {
      LOG.error("String_Node_Str" + outputChannel.getConnectedChannelID());
      return ConnectionInfoLookupResponse.createReceiverNotFound();
    }
    final ExecutionState executionState=targetVertex.getExecutionState();
    if (executionState == ExecutionState.FINISHED) {
      return ConnectionInfoLookupResponse.createReceiverFinished();
    }
    if (executionState != ExecutionState.RUNNING && executionState != ExecutionState.REPLAYING && executionState != ExecutionState.FINISHING) {
      return ConnectionInfoLookupResponse.createReceiverNotReady();
    }
    final AbstractInstance assignedInstance=targetVertex.getAllocatedResource().getInstance();
    if (assignedInstance == null) {
      LOG.error("String_Node_Str" + outputChannel.getConnectedChannelID() + "String_Node_Str");
      return ConnectionInfoLookupResponse.createReceiverNotReady();
    }
    if (assignedInstance.getInstanceConnectionInfo().equals(caller)) {
      return ConnectionInfoLookupResponse.createReceiverFoundAndReady(outputChannel.getConnectedChannelID());
    }
 else {
      return ConnectionInfoLookupResponse.createReceiverFoundAndReady(assignedInstance.getInstanceConnectionInfo());
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public ConnectionInfoLookupResponse lookupConnectionInfo(final InstanceConnectionInfo caller,final JobID jobID,final ChannelID sourceChannelID){
  final ExecutionGraph eg=this.scheduler.getExecutionGraphByID(jobID);
  if (eg == null) {
    LOG.error("String_Node_Str" + jobID);
    return ConnectionInfoLookupResponse.createReceiverNotFound();
  }
  final AbstractOutputChannel<? extends Record> outputChannel=eg.getOutputChannelByID(sourceChannelID);
  if (outputChannel == null) {
    AbstractInputChannel<? extends Record> inputChannel=eg.getInputChannelByID(sourceChannelID);
    final ChannelID connectedChannelID=inputChannel.getConnectedChannelID();
    final ExecutionVertex connectedVertex=eg.getVertexByChannelID(connectedChannelID);
    final AbstractInstance assignedInstance=connectedVertex.getAllocatedResource().getInstance();
    if (assignedInstance == null) {
      LOG.error("String_Node_Str" + connectedChannelID + "String_Node_Str");
      return ConnectionInfoLookupResponse.createReceiverNotReady();
    }
    final ExecutionState executionState=connectedVertex.getExecutionState();
    if (executionState == ExecutionState.FINISHED) {
      return ConnectionInfoLookupResponse.createReceiverFoundAndReady();
    }
    if (executionState != ExecutionState.RUNNING && executionState != ExecutionState.REPLAYING && executionState != ExecutionState.FINISHING) {
      return ConnectionInfoLookupResponse.createReceiverNotReady();
    }
    if (assignedInstance.getInstanceConnectionInfo().equals(caller)) {
      return ConnectionInfoLookupResponse.createReceiverFoundAndReady(connectedChannelID);
    }
 else {
      return ConnectionInfoLookupResponse.createReceiverFoundAndReady(assignedInstance.getInstanceConnectionInfo());
    }
  }
  if (outputChannel.isBroadcastChannel()) {
    return multicastManager.lookupConnectionInfo(caller,jobID,sourceChannelID);
  }
 else {
    final ExecutionVertex targetVertex=eg.getVertexByChannelID(outputChannel.getConnectedChannelID());
    if (targetVertex == null) {
      LOG.error("String_Node_Str" + outputChannel.getConnectedChannelID());
      return ConnectionInfoLookupResponse.createReceiverNotFound();
    }
    final ExecutionState executionState=targetVertex.getExecutionState();
    if (executionState != ExecutionState.RUNNING && executionState != ExecutionState.REPLAYING && executionState != ExecutionState.FINISHING && executionState != ExecutionState.FINISHED) {
      return ConnectionInfoLookupResponse.createReceiverNotReady();
    }
    final AbstractInstance assignedInstance=targetVertex.getAllocatedResource().getInstance();
    if (assignedInstance == null) {
      LOG.error("String_Node_Str" + outputChannel.getConnectedChannelID() + "String_Node_Str");
      return ConnectionInfoLookupResponse.createReceiverNotReady();
    }
    if (assignedInstance.getInstanceConnectionInfo().equals(caller)) {
      return ConnectionInfoLookupResponse.createReceiverFoundAndReady(outputChannel.getConnectedChannelID());
    }
 else {
      return ConnectionInfoLookupResponse.createReceiverFoundAndReady(assignedInstance.getInstanceConnectionInfo());
    }
  }
}