Program: 74461
Project: 74461
Buggy source:
/** 
 * Generate code for the modes.
 * @param sb
 * @param model The model.
 * @return The modes code.
 * @exception IllegalActionException If there is a problem getting the director or accessing the ports.
 */
protected static void _modeCode(StringBuffer sb,State state,TDLModule module) throws IllegalActionException {
}

Fixed version (ground truth):
/** 
 * Generate code for the modes.
 * @param sb
 * @param model The model.
 * @return The modes code.
 * @exception IllegalActionException If there is a problem getting the director or accessing the ports.
 */
protected static void _modeCode(StringBuffer sb,State state,TDLModule module) throws IllegalActionException {
  int actorFreq=0;
  String outputName;
  String actorName;
  String modeName;
  modeName=state.getName();
  double periodValue=((TDLModuleDirector)module.getDirector()).getModePeriod(state);
  String start="String_Node_Str";
  if (((BooleanToken)state.isInitialState.getToken()).booleanValue())   start="String_Node_Str";
  sb.append("String_Node_Str" + start + "String_Node_Str"+ modeName+ "String_Node_Str"+ periodValue+ "String_Node_Str");
  Refinement refinement=(Refinement)state.getRefinement()[0];
  Iterator taskIterator=refinement.entityList().iterator();
  if (taskIterator.hasNext())   sb.append("String_Node_Str");
  while (taskIterator.hasNext()) {
    Actor actor=(Actor)taskIterator.next();
    int frequency=TDLModeScheduler.getFrequency((NamedObj)actor);
    StringBuffer taskoutputPorts=new StringBuffer();
    Iterator it=actor.inputPortList().iterator();
    while (it.hasNext()) {
      IOPort port=(IOPort)it.next();
      IOPort connectedToModuleOutputPort=(IOPort)port.deepConnectedInPortList().get(0);
      if (_portsConnectedToModuleOutputPorts.contains(connectedToModuleOutputPort)) {
        List ports=connectedToModuleOutputPort.deepConnectedOutPortList();
        IOPort moduleOutputPort=(IOPort)ports.get(0);
        ports=moduleOutputPort.deepInsidePortList();
        String fromPortName=((Port)ports.get(1)).getFullName().substring(1);
        fromPortName=fromPortName.substring(fromPortName.indexOf('.') + 1);
        fromPortName.replace(fromPortName.substring(fromPortName.indexOf('.'),fromPortName.indexOf('.',fromPortName.indexOf('.') + 1) + 1),"String_Node_Str");
        taskoutputPorts.append(port.getName() + "String_Node_Str" + fromPortName+ "String_Node_Str");
      }
    }
    if (taskoutputPorts.toString().length() > 0)     taskoutputPorts=new StringBuffer(taskoutputPorts.toString().substring(0,taskoutputPorts.toString().length() - 2));
    sb.append("String_Node_Str" + frequency + "String_Node_Str"+ actor.getName()+ "String_Node_Str"+ taskoutputPorts.toString()+ "String_Node_Str");
  }
  Iterator actorIterator=refinement.outputPortList().iterator();
  if (actorIterator.hasNext())   sb.append("String_Node_Str");
  while (actorIterator.hasNext()) {
    IOPort port=(IOPort)actorIterator.next();
    int frequency=TDLModeScheduler.getFrequency(port);
    String portName=port.getFullName().substring(1);
    portName=portName.substring(portName.indexOf('.') + 1);
    portName=portName.substring(portName.indexOf('.') + 1);
    sb.append("String_Node_Str" + frequency + "String_Node_Str"+ port.getName()+ "String_Node_Str"+ portName+ "String_Node_Str");
  }
  Iterator transitionIterator=state.nonpreemptiveTransitionList().iterator();
  if (transitionIterator.hasNext())   sb.append("String_Node_Str");
  while (transitionIterator.hasNext()) {
    Transition transition=(Transition)transitionIterator.next();
    int frequency=TDLModeScheduler.getFrequency(transition);
    sb.append("String_Node_Str" + frequency + "String_Node_Str"+ transition.getName()+ "String_Node_Str"+ transition.destinationState().getName()+ "String_Node_Str");
  }
  sb.append("String_Node_Str");
}