Program: 75165
Project: 75165
Buggy source:
/** 
 * If this method is called immediately after preinitialize(), initialize the mode controller and all the refinements. If this is a reinitialization, it typically means this is a sub-layer HDFFSMDirector and a "reset" has been called at the upper-level HDFFSMDirector. This method will then reinitialize all the refinements in the sub-layer, recompute the schedule of the initial state in the sub-layer, and notify update of port rates to the upper level director.
 * @exception IllegalActionException If the initialize() method ofone of the associated actors throws it.
 */
public void initialize() throws IllegalActionException {
  State currentState;
  FSMActor controller=getController();
  currentState=controller.currentState();
  State initialState=controller.getInitialState();
  if (!_reinitialize) {
    super.initialize();
    _reinitialize=true;
    if (initialState != _nextIntransientState) {
      _setCurrentState(_nextIntransientState);
      _setCurrentConnectionMap();
      _currentLocalReceiverMap=(Map)_localReceiverMaps.get(_nextIntransientState);
    }
  }
 else {
    super.initialize();
    _sendRequest=true;
    controller.setNewIteration(_sendRequest);
    currentState=transientStateTransition();
    TypedActor[] curRefinements=currentState.getRefinement();
    if (curRefinements.length > 1) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + currentState.getName());
    }
    TypedCompositeActor curRefinement=(TypedCompositeActor)(curRefinements[0]);
    Director refinementDir=curRefinement.getDirector();
    if (refinementDir instanceof HDFFSMDirector) {
      refinementDir.initialize();
    }
 else     if (refinementDir instanceof HDFDirector) {
      Scheduler refinmentSched=((StaticSchedulingDirector)refinementDir).getScheduler();
      refinmentSched.setValid(false);
      ((HDFDirector)refinementDir).getSchedule();
    }
 else     if (refinementDir instanceof SDFDirector) {
      Scheduler refinmentSched=((StaticSchedulingDirector)refinementDir).getScheduler();
      refinmentSched.setValid(true);
      ((SDFScheduler)refinmentSched).getSchedule();
    }
 else {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str");
    }
    _updateInputTokenConsumptionRates(curRefinement);
    _updateOutputTokenProductionRates(curRefinement);
    CompositeActor hdfActor=_getEnclosingDomainActor();
    Director director=hdfActor.getExecutiveDirector();
    ((StaticSchedulingDirector)director).invalidateSchedule();
  }
}

Fixed version (ground truth):
/** 
 * If this method is called immediately after preinitialize(), initialize the mode controller and all the refinements. If this is a reinitialization, it typically means this is a sub-layer HDFFSMDirector and a "reset" has been called at the upper-level HDFFSMDirector. This method will then reinitialize all the refinements in the sub-layer, recompute the schedule of the initial state in the sub-layer, and notify update of port rates to the upper level director.
 * @exception IllegalActionException If the initialize() method ofone of the associated actors throws it.
 */
public void initialize() throws IllegalActionException {
  State currentState;
  FSMActor controller=getController();
  currentState=controller.currentState();
  State initialState=controller.getInitialState();
  if (!_reinitialize) {
    super.initialize();
    _reinitialize=true;
    if (initialState != _nextIntransientState) {
      _setCurrentState(_nextIntransientState);
      _setCurrentConnectionMap();
      _currentLocalReceiverMap=(Map)_localReceiverMaps.get(_nextIntransientState);
    }
  }
 else {
    super.initialize();
    _sendRequest=true;
    controller.setNewIteration(_sendRequest);
    currentState=transientStateTransition();
    TypedActor[] curRefinements=currentState.getRefinement();
    if (curRefinements.length > 1) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + currentState.getName());
    }
    TypedCompositeActor curRefinement=(TypedCompositeActor)(curRefinements[0]);
    Director refinementDir=curRefinement.getDirector();
    if (refinementDir instanceof HDFFSMDirector) {
      refinementDir.initialize();
    }
 else     if (refinementDir instanceof StaticSchedulingDirector) {
      refinementDir.invalidateSchedule();
      ((StaticSchedulingDirector)refinementDir).getScheduler().getSchedule();
    }
    _updateInputTokenConsumptionRates(curRefinement);
    _updateOutputTokenProductionRates(curRefinement);
    CompositeActor hdfActor=_getEnclosingDomainActor();
    Director director=hdfActor.getExecutiveDirector();
    ((StaticSchedulingDirector)director).invalidateSchedule();
  }
}