Program: 73842
Project: 73842
Buggy source:
/** 
 * Generate the type conversion statement for the particular offset of the two given channels. This assumes that the offset is the same for both channel. Advancing the offset of one has to advance the offset of the other.
 * @param source The given source channel.
 * @param sink The given sink channel.
 * @param offset The given offset.
 * @return The type convert statement for assigning the converted sourcevariable to the sink variable with the given offset.
 * @exception IllegalActionException If there is a problem getting theadapters for the ports or if the conversion cannot be handled.
 */
protected String _generateTypeConvertStatement(ProgramCodeGeneratorAdapter.Channel source,ProgramCodeGeneratorAdapter.Channel sink,int offset) throws IllegalActionException {
  Type sourceType=((TypedIOPort)source.port).getType();
  Type sinkType=((TypedIOPort)sink.port).getType();
  if (sourceType == BaseType.UNKNOWN) {
    return "String_Node_Str";
  }
  String sourcePortChannel=NamedProgramCodeGeneratorAdapter.generateName(source.port) + "String_Node_Str" + source.channelNumber+ "String_Node_Str"+ offset;
  String sourceRef=((NamedProgramCodeGeneratorAdapter)(getCodeGenerator().getAdapter(source.port.getContainer()))).getReference(sourcePortChannel);
  String sinkPortChannel=NamedProgramCodeGeneratorAdapter.generateName(sink.port) + "String_Node_Str" + sink.channelNumber+ "String_Node_Str"+ offset;
  if (sink.port.getContainer() instanceof CompositeActor && sink.port.isOutput()) {
    sinkPortChannel="String_Node_Str" + sinkPortChannel;
  }
  String sinkRef=((NamedProgramCodeGeneratorAdapter)(getCodeGenerator().getAdapter(sink.port.getContainer()))).getReference(sinkPortChannel,true);
  if (sink.port.getContainer() instanceof ModalController) {
    sinkRef=NamedProgramCodeGeneratorAdapter.generateName(sink.port);
    if (sink.port.isMultiport()) {
      sinkRef=sinkRef + "String_Node_Str" + sink.channelNumber+ "String_Node_Str";
    }
  }
  String result=sourceRef;
  String sourceCodeGenType=getCodeGenerator().codeGenType(sourceType);
  String sinkCodeGenType=getCodeGenerator().codeGenType(sinkType);
  if (!sinkCodeGenType.equals(sourceCodeGenType)) {
    result="String_Node_Str" + sourceCodeGenType + "String_Node_Str"+ sinkCodeGenType+ "String_Node_Str"+ result+ "String_Node_Str";
  }
  return sinkRef + "String_Node_Str" + result+ "String_Node_Str"+ _eol;
}

Fixed version (ground truth):
/** 
 * Generate the type conversion statement for the particular offset of the two given channels. This assumes that the offset is the same for both channel. Advancing the offset of one has to advance the offset of the other.
 * @param source The given source channel.
 * @param sink The given sink channel.
 * @param offset The given offset.
 * @return The type convert statement for assigning the converted sourcevariable to the sink variable with the given offset.
 * @exception IllegalActionException If there is a problem getting theadapters for the ports or if the conversion cannot be handled.
 */
protected String _generateTypeConvertStatement(ProgramCodeGeneratorAdapter.Channel source,ProgramCodeGeneratorAdapter.Channel sink,int offset) throws IllegalActionException {
  Type sourceType=((TypedIOPort)source.port).getType();
  Type sinkType=((TypedIOPort)sink.port).getType();
  if (sourceType == BaseType.UNKNOWN) {
    return "String_Node_Str";
  }
  String sourcePortChannel=NamedProgramCodeGeneratorAdapter.generateName(source.port) + "String_Node_Str" + source.channelNumber+ "String_Node_Str"+ offset;
  String sourceRef=((NamedProgramCodeGeneratorAdapter)(getCodeGenerator().getAdapter(source.port.getContainer()))).getReference(sourcePortChannel,false);
  String sinkPortChannel=NamedProgramCodeGeneratorAdapter.generateName(sink.port) + "String_Node_Str" + sink.channelNumber+ "String_Node_Str"+ offset;
  if (sink.port.getContainer() instanceof CompositeActor && sink.port.isOutput()) {
    sinkPortChannel="String_Node_Str" + sinkPortChannel;
  }
  String sinkRef=((NamedProgramCodeGeneratorAdapter)(getCodeGenerator().getAdapter(sink.port.getContainer()))).getReference(sinkPortChannel,true);
  if (sink.port.getContainer() instanceof ModalController) {
    sinkRef=NamedProgramCodeGeneratorAdapter.generateName(sink.port);
    if (sink.port.isMultiport()) {
      sinkRef=sinkRef + "String_Node_Str" + sink.channelNumber+ "String_Node_Str";
    }
  }
  String result=sourceRef;
  String sourceCodeGenType=getCodeGenerator().codeGenType(sourceType);
  String sinkCodeGenType=getCodeGenerator().codeGenType(sinkType);
  if (!sinkCodeGenType.equals(sourceCodeGenType)) {
    result="String_Node_Str" + sourceCodeGenType + "String_Node_Str"+ sinkCodeGenType+ "String_Node_Str"+ result+ "String_Node_Str";
  }
  return sinkRef + "String_Node_Str" + result+ "String_Node_Str"+ _eol;
}