Program: 73981
Project: 73981
Buggy source:
/** 
 * Execute all set actions contained by the transition chosen during the last call to chooseTransition(). Change current state to the destination state of the transition. Reset the refinement of the destination state if the <i>reset</i> parameter of the transition is true.
 * @exception IllegalActionException If any commit action throws it,or the last chosen transition does not have a destination state.
 */
protected void _commitLastChosenTransition() throws IllegalActionException {
  if (_lastChosenTransition == null) {
    return;
  }
  if (_debugging) {
    _debug("String_Node_Str",_lastChosenTransition.getFullName() + "String_Node_Str" + getDirector().getModelTime());
    _debug("String_Node_Str" + _lastChosenTransition.guardExpression.getExpression());
  }
  if (_lastChosenTransition.destinationState() == null) {
    throw new IllegalActionException(this,_lastChosenTransition,"String_Node_Str" + "String_Node_Str");
  }
  BooleanToken resetToken=(BooleanToken)_lastChosenTransition.reset.getToken();
  Actor[] actors=_lastChosenTransition.destinationState().getRefinement();
  if (actors != null) {
    Director executiveDirector=getExecutiveDirector();
    for (int i=0; i < actors.length; ++i) {
      if (resetToken.booleanValue()) {
        if (_debugging) {
          _debug(getFullName() + "String_Node_Str" + ((NamedObj)actors[i]).getName());
        }
        if (executiveDirector instanceof FSMDirector) {
          try {
            ((FSMDirector)executiveDirector)._indexOffset=1;
            actors[i].initialize();
          }
  finally {
            ((FSMDirector)executiveDirector)._indexOffset=0;
          }
        }
 else {
          actors[i].initialize();
        }
      }
 else {
        actors[i].getDirector().setModelTime(executiveDirector.getModelTime());
        Director destinationDirector=actors[i].getDirector();
        int index=1;
        if (executiveDirector instanceof SuperdenseTimeDirector) {
          index=((SuperdenseTimeDirector)executiveDirector).getIndex() + 1;
        }
        if (destinationDirector instanceof SuperdenseTimeDirector) {
          ((SuperdenseTimeDirector)destinationDirector).setIndex(index);
        }
      }
    }
  }
  Iterator actions=_lastChosenTransition.commitActionList().iterator();
  while (actions.hasNext() && !_stopRequested) {
    Action action=(Action)actions.next();
    action.execute();
  }
  boolean stateChanged=_currentState != _lastChosenTransition.destinationState();
  _currentState=_lastChosenTransition.destinationState();
  if (_debugging) {
    _debug(new StateEvent(this,_currentState));
  }
  if (((BooleanToken)_currentState.isFinalState.getToken()).booleanValue()) {
    _reachedFinalState=true;
  }
  _setCurrentConnectionMap();
  boolean stateDependent=((BooleanToken)stateDependentCausality.getToken()).booleanValue();
  if (stateDependent && stateChanged) {
    ChangeRequest request=new ChangeRequest(this,"String_Node_Str"){
      protected void _execute(){
        getDirector().invalidateSchedule();
      }
    }
;
    requestChange(request);
  }
  getDirector().fireAtCurrentTime(this);
}

Fixed version (ground truth):
/** 
 * Execute all set actions contained by the transition chosen during the last call to chooseTransition(). Change current state to the destination state of the transition. Reset the refinement of the destination state if the <i>reset</i> parameter of the transition is true.
 * @exception IllegalActionException If any commit action throws it,or the last chosen transition does not have a destination state.
 */
protected void _commitLastChosenTransition() throws IllegalActionException {
  if (_lastChosenTransition == null) {
    return;
  }
  if (_debugging) {
    _debug("String_Node_Str",_lastChosenTransition.getFullName() + "String_Node_Str" + getDirector().getModelTime());
    _debug("String_Node_Str" + _lastChosenTransition.guardExpression.getExpression());
  }
  if (_lastChosenTransition.destinationState() == null) {
    throw new IllegalActionException(this,_lastChosenTransition,"String_Node_Str" + "String_Node_Str");
  }
  BooleanToken resetToken=(BooleanToken)_lastChosenTransition.reset.getToken();
  Actor[] actors=_lastChosenTransition.destinationState().getRefinement();
  if (actors != null) {
    Director executiveDirector=getExecutiveDirector();
    for (int i=0; i < actors.length; ++i) {
      if (resetToken.booleanValue()) {
        if (_debugging) {
          _debug(getFullName() + "String_Node_Str" + ((NamedObj)actors[i]).getName());
        }
        if (executiveDirector instanceof FSMDirector) {
          try {
            ((FSMDirector)executiveDirector)._indexOffset=1;
            actors[i].initialize();
          }
  finally {
            ((FSMDirector)executiveDirector)._indexOffset=0;
          }
        }
 else {
          actors[i].initialize();
        }
      }
    }
  }
  Iterator actions=_lastChosenTransition.commitActionList().iterator();
  while (actions.hasNext() && !_stopRequested) {
    Action action=(Action)actions.next();
    action.execute();
  }
  boolean stateChanged=_currentState != _lastChosenTransition.destinationState();
  _currentState=_lastChosenTransition.destinationState();
  if (_debugging) {
    _debug(new StateEvent(this,_currentState));
  }
  if (((BooleanToken)_currentState.isFinalState.getToken()).booleanValue()) {
    _reachedFinalState=true;
  }
  _setCurrentConnectionMap();
  boolean stateDependent=((BooleanToken)stateDependentCausality.getToken()).booleanValue();
  if (stateDependent && stateChanged) {
    ChangeRequest request=new ChangeRequest(this,"String_Node_Str"){
      protected void _execute(){
        getDirector().invalidateSchedule();
      }
    }
;
    requestChange(request);
  }
  getDirector().fireAtCurrentTime(this);
}