Program: 75835
Project: 75835
Buggy source:
/** 
 * @exception IllegalActionException If fixme.
 */
public Schedule getSchedule() throws IllegalActionException {
  Scheduler scheduler=getScheduler();
  if (scheduler == null) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str");
  }
  Schedule schedule;
  if (isScheduleValid()) {
    schedule=scheduler.getSchedule();
  }
 else {
    CompositeActor container=(CompositeActor)getContainer();
    String momlKey=container.exportMoML();
    if (_scheduleCache.containsKey(momlKey)) {
      if (_debug_info) {
        System.out.println(getName() + "String_Node_Str");
      }
      _scheduleKeyList.remove(momlKey);
      _scheduleKeyList.add(0,momlKey);
      schedule=(Schedule)_scheduleCache.get(momlKey);
    }
 else {
      if (_debug_info) {
        System.out.println(getName() + "String_Node_Str");
      }
      _scheduleKeyList.add(0,momlKey);
      int cacheSize=((IntToken)(scheduleCacheSize.getToken())).intValue();
      if (_scheduleCache.size() >= cacheSize) {
        _scheduleKeyList.remove(cacheSize - 1);
        _scheduleCache.remove(momlKey);
      }
      schedule=scheduler.getSchedule();
      _scheduleCache.put(momlKey,schedule);
    }
  }
  return schedule;
}

Fixed version (ground truth):
/** 
 * Return the scheduling sequence as an instance of Schedule. For efficiency, this method maintains a schedule cache and will attempt to return a cached version of the schedule. If the cache does not contain the schedule for the current hdf graph, then the schedule will be computed by calling the getSchedule() method of the SDFScheduler. <p> The schedule cache uses a least-recently-used replacement policy. The size of the cache is specified by the scheduleCacheSize parameter. The default cache size is 100.
 * @return The Schedule for the current hdf graph.
 * @exception IllegalActionException If there is a problem gettingthe schedule.
 */
public Schedule getSchedule() throws IllegalActionException {
  Scheduler scheduler=getScheduler();
  Schedule schedule;
  if (isScheduleValid()) {
    schedule=scheduler.getSchedule();
  }
 else {
    if (_inputPortList == null) {
      _inputPortList=_getInputPortList();
    }
    if (_outputPortList == null) {
      _outputPortList=_getOutputPortList();
    }
    Iterator inputPorts=_inputPortList.iterator();
    String rates=new String();
    while (inputPorts.hasNext()) {
      IOPort inputPort=(IOPort)inputPorts.next();
      int rate=SDFScheduler.getTokenConsumptionRate(inputPort);
      rates=rates + String.valueOf(rate);
    }
    Iterator outputPorts=_outputPortList.iterator();
    while (inputPorts.hasNext()) {
      IOPort outputPort=(IOPort)outputPorts.next();
      int rate=SDFScheduler.getTokenProductionRate(outputPort);
      rates=rates + String.valueOf(rate);
    }
    if (_debug_info) {
      System.out.println("String_Node_Str" + rates);
    }
    String rateKey=rates;
    int cacheSize=((IntToken)(scheduleCacheSize.getToken())).intValue();
    if (_scheduleCache.containsKey(rateKey)) {
      if (_debug_info) {
        System.out.println(getName() + "String_Node_Str");
      }
      if (cacheSize > 0) {
        _scheduleKeyList.remove(rateKey);
        _scheduleKeyList.add(0,rateKey);
      }
      schedule=(Schedule)_scheduleCache.get(rateKey);
    }
 else {
      if (_debug_info) {
        System.out.println(getName() + "String_Node_Str");
      }
      if (cacheSize > 0) {
        while (_scheduleKeyList.size() >= cacheSize) {
          Object object=_scheduleKeyList.get(cacheSize - 1);
          _scheduleKeyList.remove(cacheSize - 1);
          _scheduleCache.remove(object);
        }
        _scheduleKeyList.add(0,rateKey);
      }
      schedule=scheduler.getSchedule();
      _scheduleCache.put(rateKey,schedule);
    }
  }
  return schedule;
}