Program: 74118
Project: 74118
Buggy source:
/** 
 * Return the scheduling sequence.  An exception will be thrown if the graph is not schedulable.  This occurs in the following circumstances: <ul> <li>The graph is not a connected graph. <li>The graph is not acyclic <li>Multiple output ports are connected to the same broadcast relation. (equivalent to a non-deterministic merge) </ul>
 * @return A Schedule type of the deeply contained opaque entitiesin the firing order.
 * @exception NotSchedulableException If the CompositeActor is notschedulable.
 */
protected Schedule _getSchedule(){
  DirectedAcyclicGraph dag=new DirectedAcyclicGraph();
  GRODirector director=(GRODirector)getContainer();
  if (director == null) {
    return null;
  }
  CompositeActor container=(CompositeActor)(director.getContainer());
  if (container == null) {
    return null;
  }
  CompositeActor castContainer=container;
  List entities=castContainer.deepEntityList();
  Iterator actors=entities.iterator();
  int actorCount=entities.size();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    dag.addNodeWeight(actor);
  }
  actors=castContainer.deepEntityList().iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    Set successors=new HashSet();
    Iterator outports=actor.outputPortList().iterator();
    while (outports.hasNext()) {
      IOPort outPort=(IOPort)outports.next();
      Iterator sinkPorts=outPort.sinkPortList().iterator();
      while (sinkPorts.hasNext()) {
        IOPort sinkPort=(IOPort)sinkPorts.next();
        if (sinkPort.isOutput()) {
          continue;
        }
        Actor sinkActor=(Actor)sinkPort.getContainer();
        successors.add(sinkActor);
      }
    }
    Iterator succeedingActors=successors.iterator();
    while (succeedingActors.hasNext()) {
      Actor connectedActor=(Actor)succeedingActors.next();
      dag.addEdge(connectedActor,actor);
    }
  }
  if (!dag.isAcyclic()) {
    Object[] cycleNodes=dag.cycleNodes();
    StringBuffer names=new StringBuffer();
    for (int i=0; i < cycleNodes.length; i++) {
      if (cycleNodes[i] instanceof Nameable) {
        if (i > 0) {
          names.append("String_Node_Str");
        }
        names.append(((Nameable)cycleNodes[i]).getFullName());
      }
    }
    throw new NotSchedulableException(this,"String_Node_Str" + names.toString());
  }
  if (dag.top() == null) {
  }
  Schedule schedule=new Schedule();
  for (int counter=0; counter < actorCount; counter++) {
    _constructDepthFirstSchedule(schedule,dag,(Actor)dag.top());
  }
  if (_debugging) {
    _debug("String_Node_Str");
    _debug(schedule.toString());
  }
  setValid(true);
  return schedule;
}

Fixed version (ground truth):
/** 
 * Return the scheduling sequence.  An exception will be thrown if the graph is not schedulable.  This occurs in the following circumstances: <ul> <li>The graph is not a connected graph. <li>The graph is not acyclic <li>Multiple output ports are connected to the same broadcast relation. (equivalent to a non-deterministic merge) </ul>
 * @return A Schedule type of the deeply contained opaque entitiesin the firing order.
 * @exception NotSchedulableException If the CompositeActor is notschedulable.
 */
protected Schedule _getSchedule(){
  DirectedAcyclicGraph dag=new DirectedAcyclicGraph();
  GRODirector director=(GRODirector)getContainer();
  if (director == null) {
    return null;
  }
  CompositeActor container=(CompositeActor)(director.getContainer());
  if (container == null) {
    return null;
  }
  CompositeActor castContainer=container;
  List entities=castContainer.deepEntityList();
  Iterator actors=entities.iterator();
  int actorCount=entities.size();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    dag.addNodeWeight(actor);
  }
  actors=castContainer.deepEntityList().iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    Set successors=new HashSet();
    Iterator outports=actor.outputPortList().iterator();
    while (outports.hasNext()) {
      IOPort outPort=(IOPort)outports.next();
      Iterator sinkPorts=outPort.sinkPortList().iterator();
      while (sinkPorts.hasNext()) {
        IOPort sinkPort=(IOPort)sinkPorts.next();
        if (sinkPort.isOutput()) {
          continue;
        }
        Actor sinkActor=(Actor)sinkPort.getContainer();
        successors.add(sinkActor);
      }
    }
    Iterator succeedingActors=successors.iterator();
    while (succeedingActors.hasNext()) {
      Actor connectedActor=(Actor)succeedingActors.next();
      dag.addEdge(connectedActor,actor);
    }
  }
  if (!dag.isAcyclic()) {
    Object[] cycleNodes=dag.cycleNodes();
    StringBuffer names=new StringBuffer();
    for (int i=0; i < cycleNodes.length; i++) {
      if (cycleNodes[i] instanceof Nameable) {
        if (i > 0) {
          names.append("String_Node_Str");
        }
        names.append(((Nameable)cycleNodes[i]).getFullName());
      }
    }
    throw new NotSchedulableException(this,"String_Node_Str" + names.toString());
  }
  if (dag.top() == null) {
  }
  Schedule schedule=new Schedule();
  _constructDepthFirstSchedule(schedule,dag,(Actor)dag.bottom());
  if (_debugging) {
    _debug("String_Node_Str");
    _debug(schedule.toString());
  }
  setValid(true);
  return schedule;
}