Program: 73403
Project: 73403
Buggy source:
/** 
 * Generate code for replacing the get() macro. This delegates to the receiver adapter for the specified channel and asks it to generate the get code.
 * @param channel The channel for which to generate the get code.
 * @param offset The offset in the array representation of the port.
 * @return The code that gets data from the specified channel.
 * @exception IllegalActionException If the receiver adapter is not found or it encounters an error while generating the get code.
 */
public String generateGetCode(String channel,String offset) throws IllegalActionException {
  Receiver[][] receivers=getReceiverAdapters();
  int channelIndex=Integer.parseInt(channel);
  if (receivers.length != 0) {
    if (channelIndex >= receivers.length) {
      throw new IllegalActionException(getComponent(),"String_Node_Str" + channelIndex + "String_Node_Str"+ "String_Node_Str"+ receivers.length+ "String_Node_Str"+ channel+ "String_Node_Str"+ offset+ "String_Node_Str");
    }
    if (receivers[channelIndex].length > 1) {
      throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
    }
    if (receivers[channelIndex].length > 0) {
      TypedIOPort port=(TypedIOPort)getComponent();
      try {
        if (port.getContainer() != null && ((Actor)port.getContainer()).getDirector() instanceof ptolemy.actor.sched.StaticSchedulingDirector) {
          return receivers[channelIndex][0].generateGetCode(offset);
        }
 else {
          String portName=StringUtilities.sanitizeName(port.getFullName());
          if (portName.startsWith("String_Node_Str")) {
            portName=portName.substring(1,portName.length());
          }
          portName=TemplateParser.escapePortName(portName);
          if (port.isMultiport()) {
            return portName + "String_Node_Str" + offset+ "String_Node_Str";
          }
 else {
            if (!((BooleanToken)getCodeGenerator().variablesAsArrays.getToken()).booleanValue()) {
              return portName;
            }
            return getCodeGenerator().generatePortName(port,portName,1);
          }
        }
      }
 catch (      Exception ex) {
        throw new IllegalActionException(getComponent(),ex,"String_Node_Str" + receivers[channelIndex][0] + "String_Node_Str"+ channelIndex);
      }
    }
  }
  TypedIOPort port=(TypedIOPort)getComponent();
  Type type=port.getType();
  if (port instanceof ParameterPort) {
    Parameter parameter=((ParameterPort)getComponent()).getParameter();
    if (port.numLinks() <= 0) {
      if (parameter.isStringMode()) {
        return "String_Node_Str" + parameter.getExpression().replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
      }
 else {
        return parameter.getValueAsString();
      }
    }
 else {
      throw new InternalErrorException(port,null,"String_Node_Str" + "String_Node_Str");
    }
  }
  String typeString=getCodeGenerator().codeGenType(type);
  System.err.println("String_Node_Str");
  return "String_Node_Str" + getCodeGenerator().codeGenType(BaseType.INT) + "String_Node_Str"+ typeString+ "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Generate code for replacing the get() macro. This delegates to the receiver adapter for the specified channel and asks it to generate the get code.
 * @param channel The channel for which to generate the get code.
 * @param offset The offset in the array representation of the port.
 * @return The code that gets data from the specified channel.
 * @exception IllegalActionException If the receiver adapter is not found or it encounters an error while generating the get code.
 */
public String generateGetCode(String channel,String offset) throws IllegalActionException {
  Receiver[][] receivers=getReceiverAdapters();
  int channelIndex=Integer.parseInt(channel);
  if (receivers.length != 0) {
    if (channelIndex >= receivers.length) {
      throw new IllegalActionException(getComponent(),"String_Node_Str" + channelIndex + "String_Node_Str"+ "String_Node_Str"+ receivers.length+ "String_Node_Str"+ channel+ "String_Node_Str"+ offset+ "String_Node_Str");
    }
    if (receivers[channelIndex].length > 1) {
      throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
    }
    if (receivers[channelIndex].length > 0) {
      TypedIOPort port=(TypedIOPort)getComponent();
      try {
        if (port.getContainer() != null && ((Actor)port.getContainer()).getDirector() instanceof ptolemy.actor.sched.StaticSchedulingDirector) {
          return receivers[channelIndex][0].generateGetCode(offset);
        }
 else {
          String portName=StringUtilities.sanitizeName(port.getFullName());
          if (portName.startsWith("String_Node_Str")) {
            portName=portName.substring(1,portName.length());
          }
          portName=TemplateParser.escapePortName(portName);
          if (port.isMultiport()) {
            return portName + "String_Node_Str" + offset+ "String_Node_Str";
          }
 else {
            if (!((BooleanToken)getCodeGenerator().variablesAsArrays.getToken()).booleanValue()) {
              return portName;
            }
            return getCodeGenerator().generatePortName(port,portName,1);
          }
        }
      }
 catch (      Throwable throwable) {
        throw new IllegalActionException(getComponent(),throwable,"String_Node_Str" + receivers[channelIndex][0] + "String_Node_Str"+ channelIndex);
      }
    }
  }
  TypedIOPort port=(TypedIOPort)getComponent();
  Type type=port.getType();
  if (port instanceof ParameterPort) {
    Parameter parameter=((ParameterPort)getComponent()).getParameter();
    if (port.numLinks() <= 0) {
      if (parameter.isStringMode()) {
        return "String_Node_Str" + parameter.getExpression().replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
      }
 else {
        return parameter.getValueAsString();
      }
    }
 else {
      throw new InternalErrorException(port,null,"String_Node_Str" + "String_Node_Str");
    }
  }
  String typeString=getCodeGenerator().codeGenType(type);
  System.err.println("String_Node_Str");
  return "String_Node_Str" + getCodeGenerator().codeGenType(BaseType.INT) + "String_Node_Str"+ typeString+ "String_Node_Str";
}