Program: 74632
Project: 74632
Buggy source:
/** 
 * <p>Advance the current model tag to that of the earliest event in the event queue, and fire all actors that have requested or are triggered to be fired at the current tag. If <i>synchronizeToRealTime</i> is true, then before firing, wait until real time matches or exceeds the timestamp of the event. Note that the default unit for time is seconds. </p><p> Each actor is iterated repeatedly (prefire(), fire(), postfire()), until either it has no more input tokens, or its prefire() method returns false. </p><p> If there are no events in the event queue, then the behavior depends on the <i>stopWhenQueueIsEmpty</i> parameter. If it is false, then this thread will stall until events become available in the event queue. Otherwise, time will advance to the stop time and the execution will halt.</p>
 * @exception IllegalActionException If the firing actor throws it, orevent queue is not ready, or an event is missed, or time is set backwards.
 */
public void fire() throws IllegalActionException {
  while (true) {
    Actor actorToFire=_getNextActorToFire();
    if (actorToFire == null) {
      if (_isTopLevel()) {
        if (_debugging) {
          _debug("String_Node_Str");
        }
        _noMoreActorsToFire=true;
      }
 else {
        if (_debugging) {
          _debug("String_Node_Str" + "String_Node_Str");
        }
      }
      _stopFireRequested=false;
      return;
    }
    if (actorToFire == getContainer()) {
      _stopFireRequested=false;
      return;
    }
    if (_debugging) {
      _debug("String_Node_Str" + getModelTime() + "String_Node_Str"+ _microstep);
    }
    boolean refire;
    do {
      refire=false;
      if (_debugging) {
        if (((Nameable)actorToFire).getContainer() == null) {
          _debug("String_Node_Str");
          _disableActor(actorToFire);
          break;
        }
        _debug(new FiringEvent(this,actorToFire,FiringEvent.BEFORE_PREFIRE));
        if (!actorToFire.prefire()) {
          _debug("String_Node_Str");
          break;
        }
        _debug(new FiringEvent(this,actorToFire,FiringEvent.AFTER_PREFIRE));
        _debug(new FiringEvent(this,actorToFire,FiringEvent.BEFORE_FIRE));
        actorToFire.fire();
        _debug(new FiringEvent(this,actorToFire,FiringEvent.AFTER_FIRE));
        _debug(new FiringEvent(this,actorToFire,FiringEvent.BEFORE_POSTFIRE));
        if (!actorToFire.postfire()) {
          _debug("String_Node_Str",((Nameable)actorToFire).getName());
          _disableActor(actorToFire);
          break;
        }
        _debug(new FiringEvent(this,actorToFire,FiringEvent.AFTER_POSTFIRE));
      }
 else {
        if (((Nameable)actorToFire).getContainer() == null) {
          _disableActor(actorToFire);
          break;
        }
        if (!actorToFire.prefire()) {
          break;
        }
        actorToFire.fire();
        if (!actorToFire.postfire()) {
          _disableActor(actorToFire);
          break;
        }
      }
      Iterator inputPorts=actorToFire.inputPortList().iterator();
      while (inputPorts.hasNext() && !refire) {
        IOPort port=(IOPort)inputPorts.next();
        for (int i=0; i < port.getWidth(); i++) {
          if (port.hasToken(i)) {
            refire=true;
            break;
          }
        }
      }
    }
 while (refire);
synchronized (_eventQueue) {
      if (!_eventQueue.isEmpty()) {
        DEEvent next=_eventQueue.get();
        if ((next.timeStamp().compareTo(getModelTime()) > 0)) {
          _microstep=0;
          break;
        }
 else         if (next.microstep() > _microstep) {
          break;
        }
 else         if ((next.timeStamp().compareTo(getModelTime()) < 0) || (next.microstep() < _microstep)) {
          throw new IllegalActionException("String_Node_Str" + next.timeStamp() + "String_Node_Str"+ next.microstep()+ "String_Node_Str"+ "String_Node_Str"+ getModelTime()+ "String_Node_Str"+ _microstep+ "String_Node_Str");
        }
 else {
        }
      }
    }
  }
  _stopFireRequested=false;
  if (_debugging) {
    _debug("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * <p>Advance the current model tag to that of the earliest event in the event queue, and fire all actors that have requested or are triggered to be fired at the current tag. If <i>synchronizeToRealTime</i> is true, then before firing, wait until real time matches or exceeds the timestamp of the event. Note that the default unit for time is seconds. </p><p> Each actor is iterated repeatedly (prefire(), fire(), postfire()), until either it has no more input tokens, or its prefire() method returns false. </p><p> If there are no events in the event queue, then the behavior depends on the <i>stopWhenQueueIsEmpty</i> parameter. If it is false, then this thread will stall until events become available in the event queue. Otherwise, time will advance to the stop time and the execution will halt.</p>
 * @exception IllegalActionException If the firing actor throws it, orevent queue is not ready, or an event is missed, or time is set backwards.
 */
public void fire() throws IllegalActionException {
  while (true) {
    Actor actorToFire=_getNextActorToFire();
    if (actorToFire == null) {
      if (_isTopLevel()) {
        if (_debugging) {
          _debug("String_Node_Str");
        }
        if (!_stopFireRequested) {
          _noMoreActorsToFire=true;
        }
      }
 else {
        if (_debugging) {
          _debug("String_Node_Str" + "String_Node_Str");
        }
      }
      _stopFireRequested=false;
      return;
    }
    if (actorToFire == getContainer()) {
      _stopFireRequested=false;
      return;
    }
    if (_debugging) {
      _debug("String_Node_Str" + getModelTime() + "String_Node_Str"+ _microstep);
    }
    boolean refire;
    do {
      refire=false;
      if (_debugging) {
        if (((Nameable)actorToFire).getContainer() == null) {
          _debug("String_Node_Str");
          _disableActor(actorToFire);
          break;
        }
        _debug(new FiringEvent(this,actorToFire,FiringEvent.BEFORE_PREFIRE));
        if (!actorToFire.prefire()) {
          _debug("String_Node_Str");
          break;
        }
        _debug(new FiringEvent(this,actorToFire,FiringEvent.AFTER_PREFIRE));
        _debug(new FiringEvent(this,actorToFire,FiringEvent.BEFORE_FIRE));
        actorToFire.fire();
        _debug(new FiringEvent(this,actorToFire,FiringEvent.AFTER_FIRE));
        _debug(new FiringEvent(this,actorToFire,FiringEvent.BEFORE_POSTFIRE));
        if (!actorToFire.postfire()) {
          _debug("String_Node_Str",((Nameable)actorToFire).getName());
          _disableActor(actorToFire);
          break;
        }
        _debug(new FiringEvent(this,actorToFire,FiringEvent.AFTER_POSTFIRE));
      }
 else {
        if (((Nameable)actorToFire).getContainer() == null) {
          _disableActor(actorToFire);
          break;
        }
        if (!actorToFire.prefire()) {
          break;
        }
        actorToFire.fire();
        if (!actorToFire.postfire()) {
          _disableActor(actorToFire);
          break;
        }
      }
      Iterator inputPorts=actorToFire.inputPortList().iterator();
      while (inputPorts.hasNext() && !refire) {
        IOPort port=(IOPort)inputPorts.next();
        for (int i=0; i < port.getWidth(); i++) {
          if (port.hasToken(i)) {
            refire=true;
            break;
          }
        }
      }
    }
 while (refire);
synchronized (_eventQueue) {
      if (!_eventQueue.isEmpty()) {
        DEEvent next=_eventQueue.get();
        if ((next.timeStamp().compareTo(getModelTime()) > 0)) {
          _microstep=0;
          break;
        }
 else         if (next.microstep() > _microstep) {
          break;
        }
 else         if ((next.timeStamp().compareTo(getModelTime()) < 0) || (next.microstep() < _microstep)) {
          throw new IllegalActionException("String_Node_Str" + next.timeStamp() + "String_Node_Str"+ next.microstep()+ "String_Node_Str"+ "String_Node_Str"+ getModelTime()+ "String_Node_Str"+ _microstep+ "String_Node_Str");
        }
 else {
        }
      }
    }
  }
  _stopFireRequested=false;
  if (_debugging) {
    _debug("String_Node_Str");
  }
}