Program: 75987
Project: 75987
Buggy source:
/** 
 * Return the scheduling sequence as an enumeration. For efficiency, this method returns a cached version of the schedule, if it is valid.  Otherwise, it calls the protected method _schedule() to update the schedule.  Derived classes would normally override the protected method, not this one. The validity of the current schedule is set by the setValid() method. This method is read-synchronized on the workspace.
 * @return The Enumeration returned by the _schedule() method.
 * @exception IllegalActionException If the scheduler has no container(a director), or the director has no container (a CompositeActor).
 * @exception NotSchedulableException If the _schedule() methodthrows it. Not thrown in this base class, but may be needed by the derived schedulers.
 */
public Enumeration schedule() throws IllegalActionException, NotSchedulableException {
  try {
    workspace().getReadAccess();
    StaticSchedulingDirector dir=(StaticSchedulingDirector)getContainer();
    if (dir == null) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
    CompositeActor ca=(CompositeActor)(dir.getContainer());
    if (ca == null) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
    if (!isValid()) {
      _cachedSchedule=new ArrayList();
      Enumeration newSchedEnum=_schedule();
      while (newSchedEnum.hasMoreElements()) {
        _cachedSchedule.add(newSchedEnum.nextElement());
      }
    }
    return Collections.enumeration(_cachedSchedule);
  }
  finally {
    workspace().doneReading();
  }
}

Fixed version (ground truth):
/** 
 * Return the scheduling sequence as an enumeration. For efficiency, this method returns a cached version of the schedule, if it is valid.  Otherwise, it calls the protected method _schedule() to update the schedule.  Derived classes would normally override the protected method, not this one. The validity of the current schedule is set by the setValid() method. This method is read-synchronized on the workspace.
 * @return The Enumeration returned by the _schedule() method.
 * @exception IllegalActionException If the scheduler has no container(a director), or the director has no container (a CompositeActor).
 * @exception NotSchedulableException If the _schedule() methodthrows it. Not thrown in this base class, but may be needed by the derived schedulers.
 */
public Enumeration schedule() throws IllegalActionException, NotSchedulableException {
  try {
    workspace().getReadAccess();
    StaticSchedulingDirector dir=(StaticSchedulingDirector)getContainer();
    if (dir == null) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
    CompositeActor ca=(CompositeActor)(dir.getContainer());
    if (ca == null) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
    if (!isValid() || _cachedSchedule == null) {
      _cachedSchedule=new ArrayList();
      Enumeration newSchedEnum=_schedule();
      while (newSchedEnum.hasMoreElements()) {
        _cachedSchedule.add(newSchedEnum.nextElement());
      }
    }
    return Collections.enumeration(_cachedSchedule);
  }
  finally {
    workspace().doneReading();
  }
}