Program: 74925
Project: 74925
Buggy source:
/** 
 * Generate variable declarations for inputs and outputs and parameters. Append the declarations to the given string buffer.
 * @return code The generated code.
 * @exception IllegalActionException If the helper class for the modeldirector cannot be found.
 */
public String generateVariableDeclaration() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  code.append("String_Node_Str" + _component.getName() + "String_Node_Str");
  if (_referencedParameters != null) {
    Iterator parameters=_referencedParameters.iterator();
    while (parameters.hasNext()) {
      Parameter parameter=(Parameter)parameters.next();
      if (!_codeGenerator._modifiedVariables.contains(parameter)) {
        code.append("String_Node_Str" + _generateType(parameter.getType()) + "String_Node_Str"+ generateVariableName(parameter)+ "String_Node_Str");
      }
    }
  }
  Iterator inputPorts=((Actor)_component).inputPortList().iterator();
  while (inputPorts.hasNext()) {
    TypedIOPort inputPort=(TypedIOPort)inputPorts.next();
    if (inputPort.getWidth() == 0) {
      break;
    }
    String cType=_generateType(inputPort.getType());
    code.append("String_Node_Str" + cType + "String_Node_Str");
    code.append(generateName(inputPort));
    if (inputPort.isMultiport()) {
      code.append("String_Node_Str" + inputPort.getWidth() + "String_Node_Str");
    }
    int bufferSize=getBufferSize(inputPort);
    if (bufferSize > 1) {
      code.append("String_Node_Str" + bufferSize + "String_Node_Str");
    }
    code.append("String_Node_Str");
    _generateTypeConvertVariableDeclaration(inputPort,code);
  }
  Iterator outputPorts=((Actor)_component).outputPortList().iterator();
  while (outputPorts.hasNext()) {
    TypedIOPort outputPort=(TypedIOPort)outputPorts.next();
    if ((outputPort.getWidth() == 0) || (outputPort.getWidthInside() != 0)) {
      code.append("String_Node_Str" + _generateType(outputPort.getType()) + "String_Node_Str");
      code.append(generateName(outputPort));
      if (outputPort.isMultiport()) {
        code.append("String_Node_Str" + outputPort.getWidthInside() + "String_Node_Str");
      }
      int bufferSize=getBufferSize(outputPort);
      if (bufferSize > 1) {
        code.append("String_Node_Str" + bufferSize + "String_Node_Str");
      }
      code.append("String_Node_Str");
      _generateTypeConvertVariableDeclaration(outputPort,code);
    }
  }
  return processCode(code.toString());
}

Fixed version (ground truth):
/** 
 * Generate variable declarations for inputs and outputs and parameters. Append the declarations to the given string buffer.
 * @return code The generated code.
 * @exception IllegalActionException If the helper class for the modeldirector cannot be found.
 */
public String generateVariableDeclaration() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  code.append("String_Node_Str" + _component.getName() + "String_Node_Str");
  if (_referencedParameters != null) {
    Iterator parameters=_referencedParameters.iterator();
    while (parameters.hasNext()) {
      Parameter parameter=(Parameter)parameters.next();
      if (!_codeGenerator._modifiedVariables.contains(parameter)) {
        code.append("String_Node_Str" + _generateType(parameter.getType()) + "String_Node_Str"+ generateVariableName(parameter)+ "String_Node_Str");
      }
    }
  }
  Iterator inputPorts=((Actor)_component).inputPortList().iterator();
  while (inputPorts.hasNext()) {
    TypedIOPort inputPort=(TypedIOPort)inputPorts.next();
    if (inputPort.getWidth() == 0) {
      continue;
    }
    String cType=_generateType(inputPort.getType());
    code.append("String_Node_Str" + cType + "String_Node_Str");
    code.append(generateName(inputPort));
    if (inputPort.isMultiport()) {
      code.append("String_Node_Str" + inputPort.getWidth() + "String_Node_Str");
    }
    int bufferSize=getBufferSize(inputPort);
    if (bufferSize > 1) {
      code.append("String_Node_Str" + bufferSize + "String_Node_Str");
    }
    code.append("String_Node_Str");
    _generateTypeConvertVariableDeclaration(inputPort,code);
  }
  Iterator outputPorts=((Actor)_component).outputPortList().iterator();
  while (outputPorts.hasNext()) {
    TypedIOPort outputPort=(TypedIOPort)outputPorts.next();
    if ((outputPort.getWidth() == 0) || (outputPort.getWidthInside() != 0)) {
      code.append("String_Node_Str" + _generateType(outputPort.getType()) + "String_Node_Str");
      code.append(generateName(outputPort));
      if (outputPort.isMultiport()) {
        code.append("String_Node_Str" + outputPort.getWidthInside() + "String_Node_Str");
      }
      int bufferSize=getBufferSize(outputPort);
      if (bufferSize > 1) {
        code.append("String_Node_Str" + bufferSize + "String_Node_Str");
      }
      code.append("String_Node_Str");
      _generateTypeConvertVariableDeclaration(outputPort,code);
    }
  }
  return processCode(code.toString());
}