Program: 75604
Project: 75604
Buggy source:
/** 
 * Push the rates calculated for this system up to the contained Actor, but only if the ports do not have a set rates. This allows the container to be properly scheduled if it is in a hierarchical system and the outside system is SDF.
 * @param externalRates A map from external port to the rate of thatport.
 * @exception IllegalActionException If any called method throws it.
 * @exception NotSchedulableException If an external port is bothan input and an output, or neither an input or an output, or connected on the inside to ports that have different tokenInitProduction.
 */
private void _setContainerRates(Map externalRates) throws NotSchedulableException, IllegalActionException {
  Director director=(Director)getContainer();
  CompositeActor container=(CompositeActor)director.getContainer();
  Iterator ports=container.portList().iterator();
  while (ports.hasNext()) {
    IOPort port=(IOPort)ports.next();
    if (_debugging && VERBOSE) {
      _debug("String_Node_Str" + port.getName());
    }
    Integer rate=(Integer)externalRates.get(port);
    if (port.isInput() && port.isOutput()) {
      throw new NotSchedulableException(port,"String_Node_Str" + "String_Node_Str");
    }
 else     if (port.isInput()) {
      _setIfNotDefined(port,"String_Node_Str",rate.intValue());
      if (_debugging && VERBOSE) {
        _debug("String_Node_Str" + rate.intValue());
      }
    }
 else     if (port.isOutput()) {
      _setIfNotDefined(port,"String_Node_Str",rate.intValue());
      if (_debugging && VERBOSE) {
        _debug("String_Node_Str" + rate.intValue());
      }
      Iterator connectedPorts=port.insidePortList().iterator();
      IOPort foundOutputPort=null;
      while (connectedPorts.hasNext()) {
        IOPort connectedPort=(IOPort)connectedPorts.next();
        if (connectedPort.isOutput()) {
          if (foundOutputPort != null && getTokenInitProduction(foundOutputPort) != getTokenInitProduction(connectedPort)) {
            throw new NotSchedulableException("String_Node_Str" + port + "String_Node_Str"+ "String_Node_Str"+ foundOutputPort+ "String_Node_Str"+ connectedPort);
          }
          _setIfNotDefined(port,"String_Node_Str",getTokenInitProduction(connectedPort));
          if (_debugging && VERBOSE) {
            _debug("String_Node_Str" + getTokenInitProduction(connectedPort));
          }
          foundOutputPort=connectedPort;
        }
      }
      if (_debugging && VERBOSE) {
        _debug("String_Node_Str" + rate);
      }
    }
 else {
      throw new NotSchedulableException(port,"String_Node_Str" + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Push the rates calculated for this system up to the contained Actor, but only if the ports do not have a set rates. This allows the container to be properly scheduled if it is in a hierarchical system and the outside system is SDF.
 * @param externalRates A map from external port to the rate of thatport.
 * @exception IllegalActionException If any called method throws it.
 * @exception NotSchedulableException If an external port is bothan input and an output, or neither an input or an output, or connected on the inside to ports that have different tokenInitProduction.
 */
private void _setContainerRates(Map externalRates) throws NotSchedulableException, IllegalActionException {
  Director director=(Director)getContainer();
  CompositeActor container=(CompositeActor)director.getContainer();
  Iterator ports=container.portList().iterator();
  while (ports.hasNext()) {
    IOPort port=(IOPort)ports.next();
    if (_debugging && VERBOSE) {
      _debug("String_Node_Str" + port.getName());
    }
    Integer rate=(Integer)externalRates.get(port);
    if (port.isInput() && port.isOutput()) {
      throw new NotSchedulableException(port,"String_Node_Str" + "String_Node_Str");
    }
 else     if (port.isInput()) {
      _setIfNotDefined(port,"String_Node_Str",rate.intValue());
      if (_debugging && VERBOSE) {
        _debug("String_Node_Str" + rate.intValue());
      }
    }
 else     if (port.isOutput()) {
      _setIfNotDefined(port,"String_Node_Str",rate.intValue());
      if (_debugging && VERBOSE) {
        _debug("String_Node_Str" + rate.intValue());
      }
      Iterator connectedPorts=port.deepInsidePortList().iterator();
      IOPort foundOutputPort=null;
      while (connectedPorts.hasNext()) {
        IOPort connectedPort=(IOPort)connectedPorts.next();
        if (connectedPort.isOutput()) {
          if (foundOutputPort != null && getTokenInitProduction(foundOutputPort) != getTokenInitProduction(connectedPort)) {
            throw new NotSchedulableException("String_Node_Str" + port + "String_Node_Str"+ "String_Node_Str"+ foundOutputPort+ "String_Node_Str"+ connectedPort);
          }
          _setIfNotDefined(port,"String_Node_Str",getTokenInitProduction(connectedPort));
          if (_debugging && VERBOSE) {
            _debug("String_Node_Str" + getTokenInitProduction(connectedPort));
          }
          foundOutputPort=connectedPort;
        }
      }
      if (_debugging && VERBOSE) {
        _debug("String_Node_Str" + rate);
      }
    }
 else {
      throw new NotSchedulableException(port,"String_Node_Str" + "String_Node_Str");
    }
  }
}