Program: 72976
Project: 72976
Buggy source:
public void getfire(ResultHandler<Iterable<Event.Builder>> resultHandler) throws CollectionAbortedException {
  try {
    List<PtidesEvent> list=_inputEventQueue.get(getModelTime());
    if (list != null) {
      for (      PtidesEvent event : list) {
        if (event.ioPort() != null) {
          _currentLogicalTime=event.timeStamp();
          _currentSourceTimestamp=event.sourceTimestamp();
          _currentLogicalIndex=event.microstep();
          event.receiver().put(event.token());
          _currentLogicalTime=null;
        }
      }
      _inputEventQueue.remove(getModelTime());
    }
    super.getfire(resultHandler);
    list=_outputEventQueue.get(getModelTime());
    if (list != null) {
      for (      PtidesEvent event : list) {
        _currentLogicalTime=event.timeStamp();
        _currentSourceTimestamp=event.sourceTimestamp();
        _currentLogicalIndex=event.microstep();
        if (event.ioPort() instanceof MetroIIPtidesPort) {
          double deviceDelay=_getDoubleParameterValue(event.ioPort(),"String_Node_Str");
          Queue<PtidesEvent> ptidesOutputPortList=_ptidesOutputPortEventQueue.get(event.ioPort());
          if (ptidesOutputPortList == null) {
            ptidesOutputPortList=new LinkedList<PtidesEvent>();
          }
          PtidesEvent newEvent=new PtidesEvent(event.ioPort(),event.channel(),event.timeStamp(),event.microstep(),event.depth(),event.token(),event.receiver(),localClock.getLocalTime().add(deviceDelay),event.sourceTimestamp());
          ptidesOutputPortList.add(newEvent);
          _ptidesOutputPortEventQueue.put((MetroIIPtidesPort)event.ioPort(),ptidesOutputPortList);
        }
        _currentLogicalTime=null;
      }
      _outputEventQueue.remove(getModelTime());
    }
    for (    MetroIIPtidesPort port : _ptidesOutputPortEventQueue.keySet()) {
      Queue<PtidesEvent> ptidesOutputPortList=_ptidesOutputPortEventQueue.get(port);
      if (ptidesOutputPortList != null && ptidesOutputPortList.size() > 0) {
        PtidesEvent event=ptidesOutputPortList.peek();
        if (event.absoluteDeadline().equals(localClock.getLocalTime())) {
          _currentLogicalTime=event.timeStamp();
          _currentSourceTimestamp=event.sourceTimestamp();
          _currentLogicalIndex=event.microstep();
          event.ioPort().send(0,event.token());
          _currentLogicalTime=null;
          ptidesOutputPortList.poll();
        }
      }
    }
  }
 catch (  IllegalActionException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void getfire(ResultHandler<Iterable<Event.Builder>> resultHandler) throws CollectionAbortedException {
  try {
    List<PtidesEvent> list=_inputEventQueue.get(getModelTime());
    if (list != null) {
      for (      PtidesEvent event : list) {
        if (event.ioPort() != null) {
          _currentLogicalTime=event.timeStamp();
          _currentSourceTimestamp=event.sourceTimestamp();
          _currentLogicalIndex=event.microstep();
          event.receiver().put(event.token());
          _currentLogicalTime=null;
          if (_debugging) {
            _debug("String_Node_Str" + event.ioPort());
          }
        }
      }
      _inputEventQueue.remove(getModelTime());
    }
    super.getfire(resultHandler);
    list=_outputEventQueue.get(getModelTime());
    if (list != null) {
      for (      PtidesEvent event : list) {
        _currentLogicalTime=event.timeStamp();
        _currentSourceTimestamp=event.sourceTimestamp();
        _currentLogicalIndex=event.microstep();
        if (event.ioPort() instanceof MetroIIPtidesPort) {
          double deviceDelay=_getDoubleParameterValue(event.ioPort(),"String_Node_Str");
          Queue<PtidesEvent> ptidesOutputPortList=_ptidesOutputPortEventQueue.get(event.ioPort());
          if (ptidesOutputPortList == null) {
            ptidesOutputPortList=new LinkedList<PtidesEvent>();
          }
          PtidesEvent newEvent=new PtidesEvent(event.ioPort(),event.channel(),event.timeStamp(),event.microstep(),event.depth(),event.token(),event.receiver(),localClock.getLocalTime().add(deviceDelay),event.sourceTimestamp());
          ptidesOutputPortList.add(newEvent);
          _ptidesOutputPortEventQueue.put((MetroIIPtidesPort)event.ioPort(),ptidesOutputPortList);
        }
        _currentLogicalTime=null;
      }
      _outputEventQueue.remove(getModelTime());
    }
    for (    MetroIIPtidesPort port : _ptidesOutputPortEventQueue.keySet()) {
      Queue<PtidesEvent> ptidesOutputPortList=_ptidesOutputPortEventQueue.get(port);
      if (ptidesOutputPortList != null && ptidesOutputPortList.size() > 0) {
        PtidesEvent event=ptidesOutputPortList.peek();
        if (event.absoluteDeadline().equals(localClock.getLocalTime())) {
          _currentLogicalTime=event.timeStamp();
          _currentSourceTimestamp=event.sourceTimestamp();
          _currentLogicalIndex=event.microstep();
          event.ioPort().send(0,event.token());
          _currentLogicalTime=null;
          ptidesOutputPortList.poll();
        }
      }
    }
  }
 catch (  IllegalActionException e) {
    e.printStackTrace();
  }
}