Program: 76376
Project: 76376
Buggy source:
/** 
 * Send an array of tokens to all receivers connected to the specified channel.  Operation is similar to IOPort.send(), except that it sends a sequence of tokens in an array.   The token in the first position in the array is interpreted as the oldest token in the sequence, and the token in the last position of the array in interpreted as the newest token in the sequence. This method is provided for efficiency only, and is semantically equivalent to calling IOPort.put() consecutively for each element in the array.
 * @param channelindex The index of the channel, from 0 to width-1
 * @param tokens The tokens to send
 * @exception NoRoomException If there is no room in the receiver.
 * @exception IllegalActionException If the port is not an output, ifthe index is out of range, or if the array is null.
 */
public void sendArray(int channelindex,ptolemy.data.Token tokens[]) throws IllegalActionException, NoRoomException {
  Receiver[][] farRec;
  if (tokens == null)   throw new IllegalActionException("String_Node_Str");
  try {
    workspace().getReadAccess();
    if (!isOutput()) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str");
    }
    if (channelindex >= getWidth() || channelindex < 0) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
    farRec=getRemoteReceivers();
    if (farRec == null || farRec[channelindex] == null)     return;
  }
  finally {
    workspace().doneReading();
  }
  for (int j=0; j < farRec[channelindex].length; j++) {
    if (farRec[channelindex][j] instanceof SDFReceiver)     ((SDFReceiver)farRec[channelindex][j]).putArray(tokens);
 else     for (int i=0; i < tokens.length; i++) {
      farRec[channelindex][j].put(tokens[i]);
    }
  }
}

Fixed version (ground truth):
/** 
 * Send an array of tokens to all receivers connected to the specified channel.  Operation is similar to IOPort.send(), except that it sends a sequence of tokens in an array.    The token in the first position in the array is interpreted  as the oldest token in the sequence, and the token in the last position of the array is interpreted as the newest token in the sequence. This method is provided for efficiency only, and is semantically equivalent to calling IOPort.put() consecutively for each element in the array.  
 * @param channelindex The index of the channel, from 0 to width-1
 * @param tokens The tokens to send
 * @exception NoRoomException If there is no room in the receiver.
 * @exception IllegalActionException If the port is not an output, ifthe index is out of range, or if the array is null.
 */
public void sendArray(int channelindex,ptolemy.data.Token tokens[]) throws IllegalActionException, NoRoomException {
  Receiver[][] farRec;
  if (tokens == null)   throw new IllegalActionException("String_Node_Str");
  if (tokens.length == 0)   return;
  ptolemy.data.Token firstToken=firstToken=tokens[0];
  try {
    workspace().getReadAccess();
    if (!isOutput()) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str");
    }
    if (channelindex >= getWidth() || channelindex < 0) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
    Class _resolvedType=getType();
    int compare=TypeLattice.compare(firstToken.getClass(),_resolvedType);
    if (compare == CPO.HIGHER || compare == CPO.INCOMPARABLE) {
      throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str" + firstToken.getClass().getName() + "String_Node_Str"+ getFullName()+ "String_Node_Str"+ getType().getName());
    }
    for (int i=1; i < tokens.length; i++) {
      if (tokens[i].getClass() != firstToken.getClass())       throw new IllegalArgumentException("String_Node_Str" + i + "String_Node_Str"+ tokens[i].getClass().getName()+ "String_Node_Str"+ getFullName()+ "String_Node_Str"+ getType().getName());
    }
    farRec=getRemoteReceivers();
    if (farRec == null || farRec[channelindex] == null)     return;
  }
  finally {
    workspace().doneReading();
  }
  try {
    for (int j=0; j < farRec[channelindex].length; j++) {
      TypedIOPort port=(TypedIOPort)farRec[channelindex][j].getContainer();
      Class farType=port.getType();
      if ((farRec[channelindex][j] instanceof SDFReceiver) && (farType.isInstance(firstToken))) {
        ((SDFReceiver)farRec[channelindex][j]).putArray(tokens);
      }
 else {
        Object[] arg=new Object[1];
        Method convert=_getConvertMethod(farType);
        for (int i=0; i < tokens.length; i++) {
          arg[0]=tokens[i];
          ptolemy.data.Token newToken=(ptolemy.data.Token)convert.invoke(null,arg);
          farRec[channelindex][j].put(newToken);
        }
      }
    }
  }
 catch (  IllegalAccessException iae) {
    throw new InternalErrorException("String_Node_Str" + "String_Node_Str" + iae.getMessage());
  }
catch (  InvocationTargetException ite) {
    throw new InternalErrorException("String_Node_Str" + "String_Node_Str" + ite.getMessage());
  }
}