Program: 76457
Project: 76457
Buggy source:
/** 
 * Ends the execution of the model under the control of this director. A flag is set in all the receivers which causes  each process to terminate at the earliest communication point. <P> This method is not synchronized on the workspace, so the caller should be.
 * @exception IllegalActionException if an error occurs whileaccessing the receivers of all actors under the contol of this director.
 */
public void finish() throws IllegalActionException {
  CompositeActor cont=(CompositeActor)getContainer();
  Enumeration allMyActors=cont.deepGetEntities();
  Enumeration actorPorts;
  ProcessReceiver nextRec;
  LinkedList recs=new LinkedList();
  while (allMyActors.hasMoreElements()) {
    Actor actor=(Actor)allMyActors.nextElement();
    actorPorts=actor.inputPorts();
    while (actorPorts.hasMoreElements()) {
      IOPort port=(IOPort)actorPorts.nextElement();
      Receiver[][] receivers=port.getReceivers();
      for (int i=0; i < receivers.length; i++) {
        for (int j=0; j < receivers[i].length; j++) {
          nextRec=(ProcessReceiver)receivers[i][j];
          nextRec.setFinish();
          recs.insertFirst(nextRec);
        }
      }
    }
    actorPorts=cont.outputPorts();
    while (actorPorts.hasMoreElements()) {
      IOPort port=(IOPort)actorPorts.nextElement();
      Receiver[][] receivers=port.getReceivers();
      for (int i=0; i < receivers.length; i++) {
        for (int j=0; j < receivers[i].length; j++) {
          nextRec=(ProcessReceiver)receivers[i][j];
          nextRec.setFinish();
          recs.insertFirst(nextRec);
        }
      }
    }
    (new NotifyThread(recs)).start();
  }
  return;
}

Fixed version (ground truth):
/** 
 * End the execution of the model under the control of this director. A flag is set in all the receivers which causes  each process to terminate at the earliest communication point. <P> This method is not synchronized on the workspace, so the caller should be.
 * @exception IllegalActionException if an error occurs whileaccessing the receivers of all actors under the contol of this director.
 */
public void finish() throws IllegalActionException {
  CompositeActor cont=(CompositeActor)getContainer();
  Enumeration allMyActors=cont.deepGetEntities();
  Enumeration actorPorts;
  ProcessReceiver nextRec;
  LinkedList recs=new LinkedList();
  while (allMyActors.hasMoreElements()) {
    Actor actor=(Actor)allMyActors.nextElement();
    actorPorts=actor.inputPorts();
    while (actorPorts.hasMoreElements()) {
      IOPort port=(IOPort)actorPorts.nextElement();
      Receiver[][] receivers=port.getReceivers();
      for (int i=0; i < receivers.length; i++) {
        for (int j=0; j < receivers[i].length; j++) {
          nextRec=(ProcessReceiver)receivers[i][j];
          nextRec.setFinish();
          recs.insertFirst(nextRec);
        }
      }
    }
    actorPorts=cont.outputPorts();
    while (actorPorts.hasMoreElements()) {
      IOPort port=(IOPort)actorPorts.nextElement();
      Receiver[][] receivers=port.getReceivers();
      for (int i=0; i < receivers.length; i++) {
        for (int j=0; j < receivers[i].length; j++) {
          nextRec=(ProcessReceiver)receivers[i][j];
          nextRec.setFinish();
          recs.insertFirst(nextRec);
        }
      }
    }
    (new NotifyThread(recs)).start();
  }
  return;
}