Program: 72929
Project: 72929
Buggy source:
/** 
 * Schedule an actor for execution on a ResourceScheduler. If the actor can execute this method returns true. If resources are not available this method returns false.
 * @param actor The actor.
 * @param timestamp The time the actor requests to be scheduled.
 * @return True if actor was scheduled and can be fired.
 * @exception IllegalActionException Thrown if parameters cannot be read, actor cannot bescheduled or container cannot be fired at future time.
 */
protected boolean _schedule(Actor actor,Time timestamp) throws IllegalActionException {
  ResourceScheduler scheduler=_getResourceScheduler(actor);
  Time time=null;
  Boolean finished=true;
  if (timestamp == null) {
    timestamp=getModelTime();
  }
  if (scheduler != null) {
    Time environmentTime=((CompositeActor)scheduler.getContainer()).getDirector().getEnvironmentTime();
    time=scheduler.schedule(actor,environmentTime,getDeadline(actor,timestamp));
    if (_nextScheduleTime == null) {
      _nextScheduleTime=new HashMap<ResourceScheduler,Time>();
    }
    _nextScheduleTime.put(scheduler,time);
    finished=_actorFinished(actor);
    if (time != null && time.getDoubleValue() > 0.0) {
      CompositeActor container=(CompositeActor)scheduler.getContainer();
      Time fireAtTime=environmentTime;
      if (!time.equals(Time.POSITIVE_INFINITY)) {
        fireAtTime=fireAtTime.add(time);
        fireAt(actor,fireAtTime);
        container.getDirector().fireContainerAt(fireAtTime);
      }
    }
  }
 else   if (isEmbedded()) {
    return ((CompositeActor)((CompositeActor)getContainer()).getContainer()).getDirector()._schedule(actor,timestamp);
  }
  return time == null || finished;
}

Fixed version (ground truth):
/** 
 * Schedule an actor for execution on a ResourceScheduler. If the actor can execute this method returns true. If resources are not available this method returns false.
 * @param actor The actor.
 * @param timestamp The time the actor requests to be scheduled.
 * @return True if actor was scheduled and can be fired.
 * @exception IllegalActionException Thrown if parameters cannot be read, actor cannot bescheduled or container cannot be fired at future time.
 */
protected boolean _schedule(Actor actor,Time timestamp) throws IllegalActionException {
  ResourceScheduler scheduler=_getResourceScheduler(actor);
  Time time=null;
  Boolean finished=true;
  if (timestamp == null) {
    timestamp=getModelTime();
  }
  if (scheduler != null) {
    Time environmentTime=((CompositeActor)scheduler.getContainer()).getDirector().getEnvironmentTime();
    time=scheduler.schedule(actor,environmentTime,getDeadline(actor,timestamp));
    if (_nextScheduleTime == null) {
      _nextScheduleTime=new HashMap<ResourceScheduler,Time>();
    }
    _nextScheduleTime.put(scheduler,time);
    finished=_actorFinished(actor);
    if (time != null && time.getDoubleValue() > 0.0) {
      CompositeActor container=(CompositeActor)scheduler.getContainer();
      Time fireAtTime=environmentTime;
      if (!time.equals(Time.POSITIVE_INFINITY)) {
        fireAtTime=fireAtTime.add(time);
        container.getDirector().fireContainerAt(fireAtTime);
      }
    }
  }
 else   if (isEmbedded()) {
    return ((CompositeActor)((CompositeActor)getContainer()).getContainer()).getDirector()._schedule(actor,timestamp);
  }
  return time == null || finished;
}