Program: 75997
Project: 75997
Buggy source:
private Actor _dequeueEvents(){
  Actor actorToFire=null;
  DEEvent currentEvent=null, nextEvent=null;
  int currentDepth=0;
  if (_eventQueue == null)   return null;
  while (true) {
    if (_stopWhenQueueIsEmpty) {
      if (_eventQueue.isEmpty()) {
        break;
      }
 else {
        nextEvent=(DEEvent)_eventQueue.get();
      }
    }
 else {
      if (actorToFire != null && _eventQueue.isEmpty())       break;
      _stopRequested=false;
      while (_eventQueue.isEmpty() && !_stopRequested) {
        if (_debugging) {
          _debug("String_Node_Str");
        }
synchronized (_eventQueue) {
          try {
            _eventQueue.wait();
          }
 catch (          InterruptedException e) {
            break;
          }
        }
      }
      if (_eventQueue.isEmpty()) {
        break;
      }
 else {
        nextEvent=(DEEvent)_eventQueue.get();
      }
    }
    if (actorToFire == null) {
      _eventQueue.take();
      currentEvent=nextEvent;
      actorToFire=currentEvent.actor();
      if (_disabledActors != null && _disabledActors.contains(actorToFire)) {
        if (_debugging)         _debug("String_Node_Str",((Nameable)actorToFire).getFullName());
        actorToFire=null;
        continue;
      }
      double currentTime=currentEvent.timeStamp();
      if (_synchronizeToRealTime) {
        long elapsedTime=System.currentTimeMillis() - _realStartTime;
        double elapsedTimeInSeconds=((double)elapsedTime) / 1000.0;
        if (currentTime > elapsedTimeInSeconds) {
          long timeToWait=(long)((currentTime - elapsedTimeInSeconds) * 1000.0);
          if (timeToWait > 0) {
            if (_debugging) {
              _debug("String_Node_Str" + timeToWait);
            }
synchronized (_eventQueue) {
              try {
                _eventQueue.wait(timeToWait);
              }
 catch (              InterruptedException ex) {
              }
            }
          }
        }
      }
      if (_debugging)       _debug("String_Node_Str",Double.toString(currentTime));
      try {
        setCurrentTime(currentTime);
      }
 catch (      IllegalActionException ex) {
        throw new InternalErrorException(ex.toString());
      }
      currentDepth=currentEvent.depth();
      _microstep=currentEvent.microstep();
      if (currentTime > getStopTime()) {
        if (_debugging) {
          _debug("String_Node_Str");
        }
        return null;
      }
      DEReceiver receiver=currentEvent.receiver();
      if (receiver != null) {
        if (_debugging)         _debug(getName(),"String_Node_Str",receiver.getContainer().getName());
        receiver._triggerEvent(currentEvent.token());
      }
    }
 else {
      if (nextEvent.isSimultaneousWith(currentEvent) && nextEvent.actor() == currentEvent.actor()) {
        _eventQueue.take();
        DEReceiver receiver=nextEvent.receiver();
        if (receiver != null) {
          receiver._triggerEvent(nextEvent.token());
        }
      }
 else {
        break;
      }
    }
  }
  return actorToFire;
}

Fixed version (ground truth):
private Actor _dequeueEvents(){
  Actor actorToFire=null;
  DEEvent currentEvent=null, nextEvent=null;
  int currentDepth=0;
  if (_eventQueue == null)   return null;
  while (true) {
    if (_stopWhenQueueIsEmpty) {
      if (_eventQueue.isEmpty()) {
        break;
      }
 else {
        nextEvent=(DEEvent)_eventQueue.get();
      }
    }
 else {
      if (actorToFire != null && _eventQueue.isEmpty())       break;
      _stopRequested=false;
      while (_eventQueue.isEmpty() && !_stopRequested) {
        if (_debugging) {
          _debug("String_Node_Str");
        }
synchronized (_eventQueue) {
          try {
            _eventQueue.wait();
          }
 catch (          InterruptedException e) {
            break;
          }
        }
      }
      if (_eventQueue.isEmpty()) {
        break;
      }
 else {
        nextEvent=(DEEvent)_eventQueue.get();
      }
    }
    if (actorToFire == null) {
      _eventQueue.take();
      currentEvent=nextEvent;
      actorToFire=currentEvent.actor();
      if (_disabledActors != null && _disabledActors.contains(actorToFire)) {
        if (_debugging)         _debug("String_Node_Str",((Nameable)actorToFire).getFullName());
        actorToFire=null;
        continue;
      }
      double currentTime=currentEvent.timeStamp();
      if (_synchronizeToRealTime) {
        long elapsedTime=System.currentTimeMillis() - _realStartTime;
        double elapsedTimeInSeconds=((double)elapsedTime) / 1000.0;
        if (currentTime > elapsedTimeInSeconds) {
          long timeToWait=(long)((currentTime - elapsedTimeInSeconds) * 1000.0);
          if (timeToWait > 0) {
            if (_debugging) {
              _debug("String_Node_Str" + timeToWait);
            }
synchronized (_eventQueue) {
              try {
                _eventQueue.wait(timeToWait);
              }
 catch (              InterruptedException ex) {
              }
            }
          }
        }
      }
      if (_debugging)       _debug("String_Node_Str",Double.toString(currentTime));
      try {
        setCurrentTime(currentTime);
      }
 catch (      IllegalActionException ex) {
        throw new InternalErrorException(ex.toString());
      }
      currentDepth=currentEvent.depth();
      _microstep=currentEvent.microstep();
      if (currentTime > getStopTime()) {
        if (_debugging) {
          _debug("String_Node_Str");
        }
        _exceedStopTime=true;
        return null;
      }
      DEReceiver receiver=currentEvent.receiver();
      if (receiver != null) {
        if (_debugging)         _debug(getName(),"String_Node_Str",receiver.getContainer().getName());
        receiver._triggerEvent(currentEvent.token());
      }
    }
 else {
      if (nextEvent.isSimultaneousWith(currentEvent) && nextEvent.actor() == currentEvent.actor()) {
        _eventQueue.take();
        DEReceiver receiver=nextEvent.receiver();
        if (receiver != null) {
          receiver._triggerEvent(nextEvent.token());
        }
      }
 else {
        break;
      }
    }
  }
  return actorToFire;
}