Program: 74671
Project: 74671
Buggy source:
/** 
 * Return a list of channel objects that are the sink input ports given a port and channel. Note the returned channels are newly created objects and therefore not associated with the helper class.
 * @param port The given output port.
 * @param channelNumber The given channel number.
 * @return The list of channel objects that are the sink channelsof the given output channel.
 */
public List getSinkChannels(IOPort port,int channelNumber){
  List sinkChannels=new LinkedList();
  Receiver[][] remoteReceivers;
  if (port.isOutput()) {
    remoteReceivers=port.getRemoteReceivers();
  }
 else {
    remoteReceivers=port.deepGetReceivers();
  }
  if (remoteReceivers.length <= channelNumber || channelNumber < 0) {
    return sinkChannels;
  }
  if (remoteReceivers[channelNumber] == null) {
    throw new InternalErrorException("String_Node_Str" + channelNumber + "String_Node_Str"+ port+ "String_Node_Str");
  }
  for (int i=0; i < remoteReceivers[channelNumber].length; i++) {
    IOPort sinkPort=remoteReceivers[channelNumber][i].getContainer();
    Receiver[][] portReceivers;
    if (sinkPort.isInput()) {
      portReceivers=sinkPort.getReceivers();
    }
 else {
      portReceivers=sinkPort.getInsideReceivers();
    }
    for (int j=0; j < portReceivers.length; j++) {
      for (int k=0; k < portReceivers[j].length; k++) {
        if (remoteReceivers[channelNumber][i] == portReceivers[j][k]) {
          Channel sinkChannel=new Channel(sinkPort,j);
          sinkChannels.add(sinkChannel);
          break;
        }
      }
    }
  }
  return sinkChannels;
}

Fixed version (ground truth):
/** 
 * Return a list of channel objects that are the sink input ports given a port and channel. Note the returned channels are newly created objects and therefore not associated with the helper class.
 * @param port The given output port.
 * @param channelNumber The given channel number.
 * @return The list of channel objects that are the sink channelsof the given output channel.
 */
public List getSinkChannels(IOPort port,int channelNumber){
  List sinkChannels=new LinkedList();
  Receiver[][] remoteReceivers;
  if (port.isOutput()) {
    remoteReceivers=port.getRemoteReceivers();
  }
 else {
    remoteReceivers=port.deepGetReceivers();
  }
  if (remoteReceivers.length <= channelNumber || channelNumber < 0) {
    return sinkChannels;
  }
  if (remoteReceivers[channelNumber] == null) {
    throw new InternalErrorException("String_Node_Str" + channelNumber + "String_Node_Str"+ port+ "String_Node_Str");
  }
  if (remoteReceivers[channelNumber] == null) {
    throw new InternalErrorException("String_Node_Str" + channelNumber + "String_Node_Str"+ port+ "String_Node_Str");
  }
  for (int i=0; i < remoteReceivers[channelNumber].length; i++) {
    IOPort sinkPort=remoteReceivers[channelNumber][i].getContainer();
    Receiver[][] portReceivers;
    if (sinkPort.isInput()) {
      portReceivers=sinkPort.getReceivers();
    }
 else {
      portReceivers=sinkPort.getInsideReceivers();
    }
    for (int j=0; j < portReceivers.length; j++) {
      for (int k=0; k < portReceivers[j].length; k++) {
        if (remoteReceivers[channelNumber][i] == portReceivers[j][k]) {
          Channel sinkChannel=new Channel(sinkPort,j);
          sinkChannels.add(sinkChannel);
          break;
        }
      }
    }
  }
  return sinkChannels;
}