Program: 75556
Project: 75556
Buggy source:
/** 
 * Advance time to the next event time (or the outside time if this director is embedded in another domain); if there are any tasks that finish at the current time, then finish the execution of the current task by calling the fire() method of that actors. If <i>synchronizeToRealTime</i> is true, then wait until the real time has caught up the current time.
 * @return True
 * @exception IllegalActionException If the execution methodof one of the actors throws it.
 */
public boolean prefire() throws IllegalActionException {
  if (_isEmbedded()) {
    _outsideTime=((CompositeActor)getContainer()).getExecutiveDirector().getCurrentTime();
  }
 else {
    _outsideTime=_nextIterationTime;
  }
  if (_debugging)   _debug("String_Node_Str" + _outsideTime,"String_Node_Str" + getCurrentTime());
  if (!_isEmbedded() && _synchronizeToRealTime) {
    long elapsedTime=System.currentTimeMillis() - _realStartTime;
    double elapsedTimeInSeconds=((double)elapsedTime) / 1000.0;
    if (Math.abs(_outsideTime - elapsedTimeInSeconds) > 1e-3) {
      long timeToWait=(long)((_outsideTime - elapsedTimeInSeconds) * 1000.0);
      if (timeToWait > 0) {
        if (_debugging) {
          _debug("String_Node_Str" + timeToWait);
        }
synchronized (_eventQueue) {
          try {
            _eventQueue.wait(timeToWait);
          }
 catch (          InterruptedException ex) {
          }
        }
      }
    }
  }
  while (!_interruptQueue.isEmpty()) {
    DEEvent interruptEvent=(DEEvent)_interruptQueue.get();
    double timeStamp=interruptEvent.timeStamp();
    if ((timeStamp + 1e-10) < _outsideTime) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + timeStamp + "String_Node_Str"+ getCurrentTime());
    }
 else     if (Math.abs(timeStamp - _outsideTime) < 1e-10) {
      _interruptQueue.take();
      Actor actor=interruptEvent.actor();
      if (actor != null) {
        if (actor.prefire()) {
          actor.fire();
          if (!actor.postfire()) {
            _disableActor(actor);
          }
        }
      }
    }
 else {
      break;
    }
  }
  if (!_eventQueue.isEmpty()) {
    TMEvent event=(TMEvent)_eventQueue.get();
    if (event.hasStarted()) {
      if (_debugging)       _debug("String_Node_Str" + (_outsideTime - getCurrentTime()),"String_Node_Str",event.toString());
      event.timeProgress(_outsideTime - getCurrentTime());
      setCurrentTime(_outsideTime);
      if (Math.abs(event.processingTime()) < 1e-10) {
        if (_debugging)         _debug(getName(),"String_Node_Str",event.toString());
        _eventQueue.take();
        Actor actor=event.actor();
        actor.fire();
        _displaySchedule(((Nameable)actor).getName(),getCurrentTime(),ScheduleListener.TASK_SLEEPING);
        _displaySchedule();
        if (!actor.postfire()) {
          _disableActor(actor);
        }
      }
    }
  }
  setCurrentTime(_outsideTime);
  return true;
}

Fixed version (ground truth):
/** 
 * Advance time to the next event time (or the outside time if this director is embedded in another domain); if there are any tasks that finish at the current time, then finish the execution of the current task by calling the fire() method of that actors. If <i>synchronizeToRealTime</i> is true, then wait until the real time has caught up the current time.
 * @return True
 * @exception IllegalActionException If the execution methodof one of the actors throws it.
 */
public boolean prefire() throws IllegalActionException {
  if (_isEmbedded()) {
    _outsideTime=((CompositeActor)getContainer()).getExecutiveDirector().getCurrentTime();
  }
 else {
    _outsideTime=_nextIterationTime;
  }
  if (_debugging)   _debug("String_Node_Str" + _outsideTime,"String_Node_Str" + getCurrentTime());
  if (!_isEmbedded() && _synchronizeToRealTime) {
    long elapsedTime=System.currentTimeMillis() - _realStartTime;
    double elapsedTimeInSeconds=((double)elapsedTime) / 1000.0;
    if (Math.abs(_outsideTime - elapsedTimeInSeconds) > 1e-3) {
      long timeToWait=(long)((_outsideTime - elapsedTimeInSeconds) * 1000.0);
      if (timeToWait > 0) {
        if (_debugging) {
          _debug("String_Node_Str" + timeToWait);
        }
synchronized (_eventQueue) {
          try {
            _eventQueue.wait(timeToWait);
          }
 catch (          InterruptedException ex) {
          }
        }
      }
    }
  }
  double cachedCurrentTime=getCurrentTime();
  setCurrentTime(_outsideTime);
  if (_debugging) {
    _debug("String_Node_Str" + _eventQueue.size());
  }
  if (!_eventQueue.isEmpty()) {
    TMEvent event=(TMEvent)_eventQueue.get();
    if (event.hasStarted()) {
      if (_debugging)       _debug("String_Node_Str" + (getCurrentTime() - cachedCurrentTime),"String_Node_Str",event.toString());
      event.timeProgress(getCurrentTime() - cachedCurrentTime);
      if (_debugging)       _debug("String_Node_Str" + event.processingTime());
      if (Math.abs(event.processingTime()) < 1e-10) {
        if (_debugging)         _debug(getName(),"String_Node_Str",event.toString());
        _eventQueue.take();
        Actor actor=event.actor();
        actor.fire();
        _displaySchedule(((Nameable)actor).getName(),getCurrentTime(),ScheduleListener.TASK_SLEEPING);
        _displaySchedule();
        if (!actor.postfire()) {
          _disableActor(actor);
        }
      }
 else {
        if (_debugging)         _debug(getName(),"String_Node_Str" + event.processingTime());
      }
    }
  }
  while (!_interruptQueue.isEmpty()) {
    DEEvent interruptEvent=(DEEvent)_interruptQueue.get();
    double timeStamp=interruptEvent.timeStamp();
    if ((timeStamp + 1e-10) < _outsideTime) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + timeStamp + "String_Node_Str"+ getCurrentTime());
    }
 else     if (Math.abs(timeStamp - _outsideTime) < 1e-10) {
      _interruptQueue.take();
      Actor actor=interruptEvent.actor();
      if (actor != null) {
        if (actor.prefire()) {
          actor.fire();
          if (!actor.postfire()) {
            _disableActor(actor);
          }
        }
      }
    }
 else {
      break;
    }
  }
  return true;
}