Program: 74927
Project: 74927
Buggy source:
/** 
 * Generate the type conversion variable declarations for a given port. These are extra variable declarations that are needed for port type conversion between actors.
 * @param port The given port.
 * @param code The given code buffer to append to.
 * @exception IllegalActionException Thrown if the associated helper is not found, or if thesource port channel index is not found, or if the buffer size of  the given port cannot be determined, or if the given port name reference is not found.
 */
protected void _generateTypeConvertVariableDeclaration(TypedIOPort port,StringBuffer code) throws IllegalActionException {
  List sourcePorts=port.sourcePortList();
  for (int i=0; i < sourcePorts.size(); i++) {
    TypedIOPort sourcePort=(TypedIOPort)sourcePorts.get(i);
    if (port.getType().equals(sourcePort.getType())) {
      continue;
    }
    String sourcePortName=sourcePort.getName() + "String_Node_Str" + _getChannelIndex(port,i,sourcePort);
    CodeGeneratorHelper sourceHelper=(CodeGeneratorHelper)_getHelper(sourcePort.getContainer());
    String type=(String)sourceHelper._portDeclareTypes.get(sourcePortName);
    String convert=(String)sourceHelper._portConversions.get(sourcePortName);
    if (type == null) {
    }
 else     if (type.equals("String_Node_Str") && convert.indexOf("String_Node_Str") == -1) {
      for (int j=0; j < getBufferSize(port,i); j++) {
        String tempVariableName=_getReference(port.getName() + "String_Node_Str" + i+ "String_Node_Str"+ j).replace('[','_').replace(']','_');
        String tempVariableType=sourcePort.getType().toString();
        code.append(tempVariableType + "String_Node_Str" + tempVariableName+ "String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Generate the type conversion variable declarations for a given port. These are extra variable declarations that are needed for port type conversion between actors.
 * @param port The given port.
 * @param code The given code buffer to append to.
 * @exception IllegalActionException Thrown if the associated helper is not found, or if thesource port channel index is not found, or if the buffer size of  the given port cannot be determined, or if the given port name reference is not found.
 */
protected void _generateTypeConvertVariableDeclaration(TypedIOPort port,StringBuffer code) throws IllegalActionException {
  List sourcePorts=port.sourcePortList();
  for (int i=0; i < sourcePorts.size(); i++) {
    TypedIOPort sourcePort=(TypedIOPort)sourcePorts.get(i);
    if (port.getType() == sourcePort.getType() || port.getType() != BaseType.STRING) {
      continue;
    }
    String sourcePortName=sourcePort.getName() + "String_Node_Str" + _getChannelIndex(port,i,sourcePort);
    CodeGeneratorHelper sourceHelper=(CodeGeneratorHelper)_getHelper(sourcePort.getContainer());
    String type=(String)sourceHelper._portDeclareTypes.get(sourcePortName);
    String convert=(String)sourceHelper._portConversions.get(sourcePortName);
    if (type == null) {
    }
 else     if (type.equals("String_Node_Str") && convert.indexOf("String_Node_Str") == -1) {
      for (int j=0; j < getBufferSize(port,i); j++) {
        String tempVariableName=_getReference(port.getName() + "String_Node_Str" + i+ "String_Node_Str"+ j).replace('[','_').replace(']','_');
        String tempVariableType=sourcePort.getType().toString();
        code.append(tempVariableType + "String_Node_Str" + tempVariableName+ "String_Node_Str");
      }
    }
  }
}