Program: 73255
Project: 73255
Buggy source:
/** 
 * Fire the modal model for one iteration. If there is a preemptive transition enabled, execute its choice actions (outputActions). Otherwise, fire the refinement of the current state.  After this firing, if there is a transition enabled, execute its choice actions. If any tokens are produced during this iteration, they are sent to both the output ports of the model model but also the input ports of the mode controller.
 * @exception IllegalActionException If there is more than onetransition enabled and nondeterminism is not permitted, or there is no controller, or it is thrown by any choice action.
 */
public void fire() throws IllegalActionException {
  Time environmentTime=_getEnvironmentTime();
  setModelTime(environmentTime);
  _stateRefinementsToPostfire.clear();
  _transitionRefinementsToPostfire.clear();
  FSMActor controller=getController();
  State currentState=controller.currentState();
  if (_debugging) {
    _debug("String_Node_Str" + getFullName(),"String_Node_Str" + getModelTime());
    _debug("String_Node_Str",currentState.getName());
  }
  controller.readInputs();
  List<Transition> transitionList=currentState.preemptiveTransitionList();
  Transition chosenPreemptiveTransition=_chooseTransition(currentState,transitionList,false);
  while (chosenPreemptiveTransition != null) {
    State nextState=chosenPreemptiveTransition.destinationState();
    if (nextState == currentState) {
      break;
    }
    transitionList=nextState.outgoingPort.linkedRelationList();
    chosenPreemptiveTransition=_chooseTransition(nextState,transitionList,true);
  }
  if (controller._lastChosenTransition.size() > 0) {
    setModelTime(environmentTime);
    if (controller._currentState.getRefinement() != null) {
      TypedActor[] refinements=controller._currentState.getRefinement();
      for (      Actor refinementActor : refinements) {
        if (refinementActor instanceof CompositeActor) {
          CompositeActor refinement=(CompositeActor)refinementActor;
          for (          IOPort refinementPort : ((List<IOPort>)refinement.outputPortList())) {
            if (!refinementPort.isKnown()) {
              refinementPort.sendClear(0);
            }
          }
        }
      }
    }
    controller.readOutputsFromRefinement();
    return;
  }
  if (controller.foundUnknown()) {
    _assertAbsentOutputs(getController(),true);
    return;
  }
  Actor[] stateRefinements=currentState.getRefinement();
  if (stateRefinements != null) {
    for (int i=0; i < stateRefinements.length; ++i) {
      if (_stopRequested || _disabledActors.contains(stateRefinements[i])) {
        break;
      }
      _setTimeForRefinement(stateRefinements[i]);
      if (stateRefinements[i].prefire()) {
        if (_debugging) {
          _debug("String_Node_Str",stateRefinements[i].getName());
        }
        stateRefinements[i].fire();
        _stateRefinementsToPostfire.add(stateRefinements[i]);
      }
    }
  }
  setModelTime(environmentTime);
  controller.readOutputsFromRefinement();
  transitionList=currentState.nonpreemptiveTransitionList();
  Transition chosenNonpreemptiveTransition=_chooseTransition(currentState,transitionList,false);
  while (chosenNonpreemptiveTransition != null) {
    State nextState=chosenNonpreemptiveTransition.destinationState();
    if (nextState == currentState) {
      break;
    }
    transitionList=nextState.outgoingPort.linkedRelationList();
    chosenNonpreemptiveTransition=_chooseTransition(nextState,transitionList,true);
  }
  if (controller._lastChosenTransition.size() == 0) {
    _assertAbsentOutputs(controller,true);
  }
}

Fixed version (ground truth):
/** 
 * Fire the modal model for one iteration. If there is a preemptive transition enabled, execute its choice actions (outputActions). Otherwise, fire the refinement of the current state.  After this firing, if there is a transition enabled, execute its choice actions. If any tokens are produced during this iteration, they are sent to both the output ports of the model model but also the input ports of the mode controller.
 * @exception IllegalActionException If there is more than onetransition enabled and nondeterminism is not permitted, or there is no controller, or it is thrown by any choice action.
 */
public void fire() throws IllegalActionException {
  Time environmentTime=_getEnvironmentTime();
  setModelTime(environmentTime);
  _stateRefinementsToPostfire.clear();
  _transitionRefinementsToPostfire.clear();
  FSMActor controller=getController();
  controller._lastChosenTransition.clear();
  State currentState=controller.currentState();
  if (_debugging) {
    _debug("String_Node_Str" + getFullName(),"String_Node_Str" + getModelTime());
    _debug("String_Node_Str",currentState.getName());
  }
  controller.readInputs();
  List<Transition> transitionList=currentState.preemptiveTransitionList();
  Transition chosenPreemptiveTransition=_chooseTransition(currentState,transitionList,false);
  while (chosenPreemptiveTransition != null) {
    State nextState=chosenPreemptiveTransition.destinationState();
    if (nextState == currentState) {
      break;
    }
    transitionList=nextState.outgoingPort.linkedRelationList();
    chosenPreemptiveTransition=_chooseTransition(nextState,transitionList,true);
  }
  if (controller._lastChosenTransition.size() > 0) {
    setModelTime(environmentTime);
    if (controller._currentState.getRefinement() != null) {
      TypedActor[] refinements=controller._currentState.getRefinement();
      for (      Actor refinementActor : refinements) {
        if (refinementActor instanceof CompositeActor) {
          CompositeActor refinement=(CompositeActor)refinementActor;
          for (          IOPort refinementPort : ((List<IOPort>)refinement.outputPortList())) {
            if (!refinementPort.isKnown()) {
              refinementPort.sendClear(0);
            }
          }
        }
      }
    }
    controller.readOutputsFromRefinement();
    return;
  }
  if (controller.foundUnknown()) {
    _assertAbsentOutputs(getController(),true);
    return;
  }
  Actor[] stateRefinements=currentState.getRefinement();
  if (stateRefinements != null) {
    for (int i=0; i < stateRefinements.length; ++i) {
      if (_stopRequested || _disabledActors.contains(stateRefinements[i])) {
        break;
      }
      _setTimeForRefinement(stateRefinements[i]);
      if (stateRefinements[i].prefire()) {
        if (_debugging) {
          _debug("String_Node_Str",stateRefinements[i].getName());
        }
        stateRefinements[i].fire();
        _stateRefinementsToPostfire.add(stateRefinements[i]);
      }
    }
  }
  setModelTime(environmentTime);
  controller.readOutputsFromRefinement();
  transitionList=currentState.nonpreemptiveTransitionList();
  Transition chosenNonpreemptiveTransition=_chooseTransition(currentState,transitionList,false);
  while (chosenNonpreemptiveTransition != null) {
    State nextState=chosenNonpreemptiveTransition.destinationState();
    if (nextState == currentState) {
      break;
    }
    transitionList=nextState.outgoingPort.linkedRelationList();
    chosenNonpreemptiveTransition=_chooseTransition(nextState,transitionList,true);
  }
  if (controller._lastChosenTransition.size() == 0) {
    _assertAbsentOutputs(controller,true);
  }
}