Program: 73322
Project: 73322
Buggy source:
/** 
 * Return the code that creates temporary variables that hold the values to be read.  We need to do this so as to avoid reading from the same Ptolemy receiver twice, which would happen if we have an automatically generated actor with a regular non-multiport that feeds its output to two actors.
 * @param actorPortName The name of the Actor port from whichdata will be read.
 * @param codegenPortName The name of the port on the codegen side.For non-multiports, actorPortName and codegenPortName are the same. For multiports, codegenPortName will vary according to channel number while actorPortName will remain the same.
 * @param type The type of the port.
 * @param channel The channel number.For non-multiports, the channel number will be 0.
 */
private String _generateGetInsideDeclarations(String actorPortName,String codegenPortName,Type type,int channel){
  actorPortName=TemplateParser.escapePortName(actorPortName);
  codegenPortName=TemplateParser.escapePortName(codegenPortName);
  String portData=actorPortName + "String_Node_Str" + (channel == 0 ? "String_Node_Str" : channel);
  if (type instanceof ArrayType) {
    ArrayType array=(ArrayType)type;
    String codeGenElementType=getCodeGenerator().codeGenType(array.getDeclaredElementType()).replace("String_Node_Str","String_Node_Str");
    String targetElementType=getCodeGenerator().targetType(array.getDeclaredElementType());
    String ptolemyData="String_Node_Str" + actorPortName + "String_Node_Str";
    return type.getTokenClass().getName() + "String_Node_Str" + ptolemyData+ "String_Node_Str"+ type.getTokenClass().getName()+ "String_Node_Str"+ codegenPortName+ "String_Node_Str"+ (channel == 0 ? "String_Node_Str" : "String_Node_Str" + channel)+ "String_Node_Str"+ _eol+ _eol+ getCodeGenerator().comment("String_Node_Str")+ "String_Node_Str"+ portData+ "String_Node_Str"+ "String_Node_Str"+ ptolemyData+ "String_Node_Str"+ _eol+ "String_Node_Str"+ ptolemyData+ "String_Node_Str"+ _eol+ "String_Node_Str"+ portData+ "String_Node_Str"+ getCodeGenerator().codeGenType(array.getDeclaredElementType())+ "String_Node_Str"+ codeGenElementType+ "String_Node_Str"+ ptolemyData+ "String_Node_Str"+ targetElementType+ "String_Node_Str"+ _eol+ "String_Node_Str"+ _eol;
  }
 else   if (type == BaseType.COMPLEX) {
    return "String_Node_Str" + actorPortName + "String_Node_Str"+ portData+ "String_Node_Str"+ _eol+ "String_Node_Str"+ type.getTokenClass().getName()+ "String_Node_Str"+ "String_Node_Str"+ codegenPortName+ "String_Node_Str"+ "String_Node_Str"+ type.toString().toLowerCase()+ "String_Node_Str"+ _eol+ "String_Node_Str"+ _eol+ "String_Node_Str"+ _eol+ "String_Node_Str"+ portData+ "String_Node_Str"+ _eol;
  }
 else {
    return "String_Node_Str" + actorPortName + "String_Node_Str"+ portData+ "String_Node_Str"+ _eol+ "String_Node_Str"+ portData+ "String_Node_Str"+ "String_Node_Str"+ type.getTokenClass().getName()+ "String_Node_Str"+ "String_Node_Str"+ codegenPortName+ "String_Node_Str"+ "String_Node_Str"+ type.toString().toLowerCase()+ "String_Node_Str"+ _eol;
  }
}

Fixed version (ground truth):
/** 
 * Return the code that creates temporary variables that hold the values to be read.  We need to do this so as to avoid reading from the same Ptolemy receiver twice, which would happen if we have an automatically generated actor with a regular non-multiport that feeds its output to two actors.
 * @param actorPortName The name of the Actor port from whichdata will be read.
 * @param codegenPortName The name of the port on the codegen side.For non-multiports, actorPortName and codegenPortName are the same. For multiports, codegenPortName will vary according to channel number while actorPortName will remain the same.
 * @param type The type of the port.
 * @param channel The channel number.For non-multiports, the channel number will be 0.
 */
private String _generateGetInsideDeclarations(String actorPortName,String codegenPortName,Type type,int channel){
  actorPortName=TemplateParser.escapePortName(actorPortName);
  codegenPortName=TemplateParser.escapePortName(codegenPortName);
  String portData=actorPortName + "String_Node_Str" + (channel == 0 ? "String_Node_Str" : channel);
  if (type instanceof ArrayType) {
    ArrayType array=(ArrayType)type;
    String codeGenElementType=getCodeGenerator().codeGenType(array.getDeclaredElementType()).replace("String_Node_Str","String_Node_Str");
    String targetElementType=getCodeGenerator().targetType(array.getDeclaredElementType());
    String ptolemyData="String_Node_Str" + actorPortName + "String_Node_Str";
    return type.getTokenClass().getName() + "String_Node_Str" + ptolemyData+ "String_Node_Str"+ type.getTokenClass().getName()+ "String_Node_Str"+ codegenPortName+ "String_Node_Str"+ (channel == 0 ? "String_Node_Str" : "String_Node_Str" + channel)+ "String_Node_Str"+ _eol+ _eol+ getCodeGenerator().comment("String_Node_Str")+ "String_Node_Str"+ portData+ "String_Node_Str"+ "String_Node_Str"+ ptolemyData+ "String_Node_Str"+ _eol+ "String_Node_Str"+ ptolemyData+ "String_Node_Str"+ _eol+ "String_Node_Str"+ portData+ "String_Node_Str"+ getCodeGenerator().codeGenType(array.getDeclaredElementType())+ "String_Node_Str"+ codeGenElementType+ "String_Node_Str"+ ptolemyData+ "String_Node_Str"+ targetElementType+ "String_Node_Str"+ _eol+ "String_Node_Str"+ _eol+ _generateGetInside(actorPortName,codegenPortName,type,channel);
  }
 else   if (type == BaseType.COMPLEX) {
    return "String_Node_Str" + actorPortName + "String_Node_Str"+ portData+ "String_Node_Str"+ _eol+ "String_Node_Str"+ type.getTokenClass().getName()+ "String_Node_Str"+ "String_Node_Str"+ codegenPortName+ "String_Node_Str"+ "String_Node_Str"+ type.toString().toLowerCase()+ "String_Node_Str"+ _eol+ "String_Node_Str"+ _eol+ "String_Node_Str"+ _eol+ "String_Node_Str"+ portData+ "String_Node_Str"+ _eol+ _generateGetInside(actorPortName,codegenPortName,type,channel);
  }
 else {
    return "String_Node_Str" + actorPortName + "String_Node_Str"+ portData+ "String_Node_Str"+ _eol+ "String_Node_Str"+ codegenPortName+ "String_Node_Str"+ _eol+ "String_Node_Str"+ portData+ "String_Node_Str"+ "String_Node_Str"+ type.getTokenClass().getName()+ "String_Node_Str"+ "String_Node_Str"+ codegenPortName+ "String_Node_Str"+ "String_Node_Str"+ type.toString().toLowerCase()+ "String_Node_Str"+ _eol+ _generateGetInside(actorPortName,codegenPortName,type,channel)+ _eol+ "String_Node_Str"+ _eol;
  }
}