Program: 74966
Project: 74966
Buggy source:
/** 
 * If this port is an output, return the remote receivers that can receive data from this port through the specified relation. The relation should be linked to the port from the inside, otherwise an exception is thrown. For an output port, the returned value is an array of arrays of the same form as that returned by getReceivers() with no arguments. <p> This method may have the effect of creating new receivers in the remote input ports, if they do not already have the right number of receivers.  In this case, previous receivers are lost, together with any data they may contain. <p> This method is read-synchronized on the workspace.
 * @param relation The specified relation from which the remotereceivers can receive data.
 * @return The receivers for output data, or an empty array if thereare none.
 * @exception IllegalActionException If the IORelation is not linkedto the port from the inside.
 */
public Receiver[][] getRemoteReceivers(IORelation relation) throws IllegalActionException {
  try {
    _workspace.getReadAccess();
    if (!isInsideLinked(relation)) {
      throw new IllegalActionException(this,relation,"String_Node_Str");
    }
    if (!isOutput()) {
      return _EMPTY_RECEIVER_ARRAY;
    }
    int width=relation.getWidth();
    if (width <= 0) {
      return _EMPTY_RECEIVER_ARRAY;
    }
    Receiver[][] outsideReceivers=getRemoteReceivers();
    if (outsideReceivers == null) {
      return _EMPTY_RECEIVER_ARRAY;
    }
    Receiver[][] result=new Receiver[width][];
    Iterator insideRelations=insideRelationList().iterator();
    int index=0;
    while (insideRelations.hasNext()) {
      IORelation insideRelation=(IORelation)insideRelations.next();
      if (insideRelation == relation) {
        int size=java.lang.Math.min(width,outsideReceivers.length - index);
        for (int i=0; i < size; i++) {
          result[i]=outsideReceivers[i + index];
        }
        break;
      }
      index+=insideRelation.getWidth();
    }
    return result;
  }
  finally {
    _workspace.doneReading();
  }
}

Fixed version (ground truth):
/** 
 * If this port is an output, return the remote receivers that can receive data from this port through the specified relation or any relation in its relation group. The relation or one in its relation group should be linked to the port from the inside, otherwise an exception is thrown. For an output port, the returned value is an array of arrays of the same form as that returned by getReceivers() with no arguments. <p> This method may have the effect of creating new receivers in the remote input ports, if they do not already have the right number of receivers.  In this case, previous receivers are lost, together with any data they may contain. <p> This method is read-synchronized on the workspace.
 * @param relation The specified relation from which the remotereceivers can receive data.
 * @return The receivers for output data, or an empty array if thereare none.
 * @exception IllegalActionException If the IORelation is not linkedto the port from the inside.
 */
public Receiver[][] getRemoteReceivers(IORelation relation) throws IllegalActionException {
  try {
    _workspace.getReadAccess();
    if (!isInsideGroupLinked(relation)) {
      throw new IllegalActionException(this,relation,"String_Node_Str");
    }
    if (!isOutput()) {
      return _EMPTY_RECEIVER_ARRAY;
    }
    int width=relation.getWidth();
    if (width <= 0) {
      return _EMPTY_RECEIVER_ARRAY;
    }
    Receiver[][] outsideReceivers=getRemoteReceivers();
    if (outsideReceivers == null) {
      return _EMPTY_RECEIVER_ARRAY;
    }
    Receiver[][] result=new Receiver[width][];
    Iterator insideRelations=insideRelationList().iterator();
    int index=0;
    while (insideRelations.hasNext()) {
      IORelation insideRelation=(IORelation)insideRelations.next();
      if (insideRelation.relationGroupList().contains(relation)) {
        int size=java.lang.Math.min(width,outsideReceivers.length - index);
        for (int i=0; i < size; i++) {
          result[i]=outsideReceivers[i + index];
        }
        break;
      }
      index+=insideRelation.getWidth();
    }
    return result;
  }
  finally {
    _workspace.doneReading();
  }
}