Program: 76481
Project: 76481
Buggy source:
/** 
 * If the port is an input, return the receivers that handle incoming channels from the specified relation. If the port is an opaque output and the relation is inside linked, return the receivers that handle incoming channels from the inside. Otherwise return null. The returned value is an array of arrays of the same form as that returned by getReceivers() with no arguments.  Note that a single relation may represent multiple channels because it may be a bus. <p> This method is read-synchronized on the workspace.
 * @param relation A relation that is linked on the outside or inside.
 * @return The local receivers.
 * @exception IllegalActionException If the relation is not linkedfrom the outside, or if there is no director.
 */
public Receiver[][] getReceivers(IORelation relation) throws IllegalActionException {
  try {
    workspace().getReadAccess();
    boolean insidelink=isInsideLinked(relation);
    if (!isLinked(relation) && !insidelink) {
      throw new IllegalActionException(this,relation,"String_Node_Str" + "String_Node_Str");
    }
    boolean opaque=isOpaque();
    if (!isInput() && !(opaque && insidelink && isOutput())) {
      return null;
    }
    int width=relation.getWidth();
    if (width <= 0)     return null;
    Receiver[][] result=null;
    if (opaque) {
      if (_localReceiversTable.containsKey(relation)) {
        result=(Receiver[][])_localReceiversTable.get(relation);
        if (result.length != width) {
          String s="String_Node_Str";
          s+="String_Node_Str";
          throw new InvalidStateException(this,s);
        }
      }
      return result;
    }
 else {
      Receiver[][] insideRecvrs=getReceivers();
      if (insideRecvrs == null) {
        return null;
      }
      int insideWidth=insideRecvrs.length;
      int index=0;
      result=new Receiver[width][];
      Enumeration outsideRels=linkedRelations();
      while (outsideRels.hasMoreElements()) {
        IORelation r=(IORelation)outsideRels.nextElement();
        if (r == relation) {
          result=new Receiver[width][];
          int rstSize=java.lang.Math.min(width,insideWidth - index);
          for (int i=0; i < rstSize; i++) {
            result[i]=insideRecvrs[index++];
          }
          break;
        }
 else {
          index+=r.getWidth();
          if (index > insideWidth)           break;
        }
      }
      return result;
    }
  }
  finally {
    workspace().doneReading();
  }
}

Fixed version (ground truth):
/** 
 * If the port is an input, return the receivers that handle incoming channels from the specified relation. If the port is an opaque output and the relation is inside linked, return the receivers that handle incoming channels from the inside. Otherwise return null. The returned value is an array of arrays of the same form as that returned by getReceivers() with no arguments.  Note that a single relation may represent multiple channels because it may be a bus. If the receivers have not yet been created by createReceivers(), then return null. <p> This method is read-synchronized on the workspace.
 * @param relation A relation that is linked on the outside or inside.
 * @return The local receivers.
 * @exception IllegalActionException If the relation is not linkedfrom the outside, or if there is no director.
 */
public Receiver[][] getReceivers(IORelation relation) throws IllegalActionException {
  try {
    workspace().getReadAccess();
    boolean insidelink=isInsideLinked(relation);
    if (!isLinked(relation) && !insidelink) {
      throw new IllegalActionException(this,relation,"String_Node_Str" + "String_Node_Str");
    }
    boolean opaque=isOpaque();
    if (!isInput() && !(opaque && insidelink && isOutput())) {
      return null;
    }
    int width=relation.getWidth();
    if (width <= 0)     return null;
    Receiver[][] result=null;
    if (opaque) {
      if (_localReceiversTable == null)       return null;
      if (_localReceiversTable.containsKey(relation)) {
        result=(Receiver[][])_localReceiversTable.get(relation);
        if (result.length != width) {
          String s="String_Node_Str";
          s+="String_Node_Str";
          throw new InvalidStateException(this,s);
        }
      }
      return result;
    }
 else {
      Receiver[][] insideRecvrs=getReceivers();
      if (insideRecvrs == null) {
        return null;
      }
      int insideWidth=insideRecvrs.length;
      int index=0;
      result=new Receiver[width][];
      Enumeration outsideRels=linkedRelations();
      while (outsideRels.hasMoreElements()) {
        IORelation r=(IORelation)outsideRels.nextElement();
        if (r == relation) {
          result=new Receiver[width][];
          int rstSize=java.lang.Math.min(width,insideWidth - index);
          for (int i=0; i < rstSize; i++) {
            result[i]=insideRecvrs[index++];
          }
          break;
        }
 else {
          index+=r.getWidth();
          if (index > insideWidth)           break;
        }
      }
      return result;
    }
  }
  finally {
    workspace().doneReading();
  }
}