Program: 75167
Project: 75167
Buggy source:
/** 
 * Generate variable declarations for inputs and outputs and parameters. Append the declarations to the given string buffer.
 * @param code The given string buffer.
 */
public void generateVariableDeclarations(StringBuffer code) throws IllegalActionException {
  code.append(comment("String_Node_Str" + getContainer().getFullName()));
  Iterator actors=((CompositeActor)getContainer()).deepEntityList().iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    CodeGeneratorHelper helper=(CodeGeneratorHelper)_getHelper((NamedObj)actor);
    HashSet parameterSet=helper.getReferencedParameter();
    if (parameterSet != null) {
      Iterator parameters=parameterSet.iterator();
      while (parameters.hasNext()) {
        Parameter parameter=(Parameter)parameters.next();
        String type=parameter.getType().toString();
        boolean isArrayType=false;
        if (type.equals("String_Node_Str")) {
          type="String_Node_Str";
        }
 else         if (type.charAt(0) == '{') {
          StringTokenizer tokenizer=new StringTokenizer("String_Node_Str");
          type=tokenizer.nextToken();
        }
        code.append("String_Node_Str");
        code.append(type);
        code.append("String_Node_Str");
        code.append(parameter.getFullName().replace('.','_'));
        if (isArrayType) {
          code.append("String_Node_Str");
        }
        code.append("String_Node_Str");
        code.append(parameter.getToken().toString());
        code.append("String_Node_Str");
      }
    }
    Iterator inputPorts=actor.inputPortList().iterator();
    while (inputPorts.hasNext()) {
      TypedIOPort inputPort=(TypedIOPort)inputPorts.next();
      if (inputPort.getWidth() == 0) {
        break;
      }
      code.append("String_Node_Str");
      code.append(inputPort.getType().toString());
      code.append("String_Node_Str");
      code.append(inputPort.getFullName().replace('.','_'));
      if (inputPort.isMultiport()) {
        code.append("String_Node_Str" + inputPort.getWidth() + "String_Node_Str");
      }
      int bufferCapacity=getBufferCapacity(inputPort);
      if (bufferCapacity > 1) {
        code.append("String_Node_Str" + bufferCapacity + "String_Node_Str");
      }
      code.append("String_Node_Str");
    }
    Iterator outputPorts=actor.outputPortList().iterator();
    while (outputPorts.hasNext()) {
      TypedIOPort outputPort=(TypedIOPort)outputPorts.next();
      if (outputPort.getWidth() == 0) {
        code.append("String_Node_Str");
        code.append(outputPort.getType().toString());
        code.append("String_Node_Str");
        code.append(outputPort.getFullName().replace('.','_'));
        code.append("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Generate variable declarations for inputs and outputs and parameters. Append the declarations to the given string buffer.
 * @param code The given string buffer.
 */
public void generateVariableDeclarations(StringBuffer code) throws IllegalActionException {
  code.append(comment("String_Node_Str" + getContainer().getFullName()));
  Iterator actors=((CompositeActor)getContainer()).deepEntityList().iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    CodeGeneratorHelper helper=(CodeGeneratorHelper)_getHelper((NamedObj)actor);
    HashSet parameterSet=helper.getReferencedParameter();
    if (parameterSet != null) {
      Iterator parameters=parameterSet.iterator();
      while (parameters.hasNext()) {
        Parameter parameter=(Parameter)parameters.next();
        String type=parameter.getType().toString();
        boolean isArrayType=false;
        if (type.charAt(0) == '{') {
          StringTokenizer tokenizer=new StringTokenizer(type,"String_Node_Str");
          type=tokenizer.nextToken();
          isArrayType=true;
        }
        if (type.equals("String_Node_Str")) {
          type="String_Node_Str";
        }
        code.append("String_Node_Str");
        code.append(type);
        code.append("String_Node_Str");
        code.append(parameter.getFullName().replace('.','_'));
        if (isArrayType) {
          code.append("String_Node_Str");
        }
        code.append("String_Node_Str");
        code.append(parameter.getToken().toString());
        code.append("String_Node_Str");
      }
    }
    Iterator inputPorts=actor.inputPortList().iterator();
    while (inputPorts.hasNext()) {
      TypedIOPort inputPort=(TypedIOPort)inputPorts.next();
      if (inputPort.getWidth() == 0) {
        break;
      }
      String type=inputPort.getType().toString();
      boolean isArrayType=false;
      if (type.charAt(0) == '{') {
        StringTokenizer tokenizer=new StringTokenizer(type,"String_Node_Str");
        type=tokenizer.nextToken();
        isArrayType=true;
      }
      if (type.equals("String_Node_Str")) {
        type="String_Node_Str";
      }
      code.append("String_Node_Str");
      code.append(type);
      code.append("String_Node_Str");
      code.append(inputPort.getFullName().replace('.','_'));
      if (inputPort.isMultiport()) {
        code.append("String_Node_Str" + inputPort.getWidth() + "String_Node_Str");
      }
      int bufferCapacity=getBufferCapacity(inputPort);
      if (bufferCapacity > 1) {
        code.append("String_Node_Str" + bufferCapacity + "String_Node_Str");
      }
      code.append("String_Node_Str");
    }
    Iterator outputPorts=actor.outputPortList().iterator();
    while (outputPorts.hasNext()) {
      TypedIOPort outputPort=(TypedIOPort)outputPorts.next();
      if (outputPort.getWidth() == 0) {
        String type=outputPort.getType().toString();
        boolean isArrayType=false;
        if (type.charAt(0) == '{') {
          StringTokenizer tokenizer=new StringTokenizer(type,"String_Node_Str");
          type=tokenizer.nextToken();
          isArrayType=true;
        }
        if (type.equals("String_Node_Str")) {
          type="String_Node_Str";
        }
        code.append("String_Node_Str");
        code.append(type);
        code.append("String_Node_Str");
        code.append(outputPort.getFullName().replace('.','_'));
        code.append("String_Node_Str");
      }
    }
  }
}