Program: 74730
Project: 74730
Buggy source:
/** 
 * Return the value or an expression in the target language for the specified parameter of the associated actor.  If the parameter is specified by an expression, then the expression will be parsed. If any parameter referenced in that expression is specified by another expression, the parsing continues recursively until either a parameter is directly specified by a constant or a parameter can be directly modified during execution in which case a reference to the parameter is generated.
 * @param name The name of the parameter.
 * @param container The container to search upwards from.
 * @return The value or expression as a string.
 * @exception IllegalActionException If the parameter does not exist ordoes not have a value.
 */
public String getParameterValue(String name,NamedObj container) throws IllegalActionException {
  name=processCode(name);
  StringTokenizer tokenizer=new StringTokenizer(name,"String_Node_Str");
  String attributeName=tokenizer.nextToken().trim();
  String offset=null;
  String castType=null;
  if (tokenizer.hasMoreTokens()) {
    offset=tokenizer.nextToken().trim();
    if (tokenizer.hasMoreTokens()) {
      throw new IllegalActionException(_component,name + "String_Node_Str" + "String_Node_Str");
    }
  }
  StringTokenizer tokenizer2=new StringTokenizer(attributeName,"String_Node_Str",false);
  if (tokenizer2.countTokens() != 1 && tokenizer2.countTokens() != 2) {
    throw new IllegalActionException(_component,"String_Node_Str" + attributeName);
  }
  if (tokenizer2.countTokens() == 2) {
    castType=tokenizer2.nextToken().trim();
    attributeName=tokenizer2.nextToken().trim();
  }
  Attribute attribute=ModelScope.getScopedVariable(null,container,attributeName);
  if (attribute == null) {
    throw new IllegalActionException(container,"String_Node_Str" + name);
  }
  if (offset == null) {
    if (attribute instanceof Variable) {
      Variable variable=(Variable)attribute;
      ParseTreeCodeGenerator parseTreeCodeGenerator=getParseTreeCodeGenerator();
      if (variable.isStringMode()) {
        return _generateTypeConvertMethod("String_Node_Str" + parseTreeCodeGenerator.escapeForTargetLanguage(variable.getExpression()) + "String_Node_Str",castType,"String_Node_Str");
      }
      PtParser parser=new PtParser();
      ASTPtRootNode parseTree=parser.generateParseTree(variable.getExpression());
      parseTreeCodeGenerator.evaluateParseTree(parseTree,new HelperScope(variable));
      return _generateTypeConvertMethod(processCode(parseTreeCodeGenerator.generateFireCode()),castType,codeGenType(variable.getType()));
    }
 else {
      return ((Settable)attribute).getExpression();
    }
  }
 else {
    if (attribute instanceof Parameter) {
      Token token=((Parameter)attribute).getToken();
      if (token instanceof ArrayToken) {
        Token element=((ArrayToken)token).getElement(new Integer(offset).intValue());
        return _generateTypeConvertMethod(element.toString(),castType,codeGenType(element.getType()));
      }
      throw new IllegalActionException(_component,attributeName + "String_Node_Str");
    }
    throw new IllegalActionException(_component,attributeName + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Return the value or an expression in the target language for the specified parameter of the associated actor.  If the parameter is specified by an expression, then the expression will be parsed. If any parameter referenced in that expression is specified by another expression, the parsing continues recursively until either a parameter is directly specified by a constant or a parameter can be directly modified during execution in which case a reference to the parameter is generated.
 * @param name The name of the parameter.
 * @param container The container to search upwards from.
 * @return The value or expression as a string.
 * @exception IllegalActionException If the parameter does not exist ordoes not have a value.
 */
public String getParameterValue(String name,NamedObj container) throws IllegalActionException {
  name=processCode(name);
  StringTokenizer tokenizer=new StringTokenizer(name,"String_Node_Str");
  String attributeName=tokenizer.nextToken().trim();
  String offset=null;
  String castType=null;
  if (tokenizer.hasMoreTokens()) {
    offset=tokenizer.nextToken().trim();
    if (tokenizer.hasMoreTokens()) {
      throw new IllegalActionException(_component,name + "String_Node_Str" + "String_Node_Str");
    }
  }
  StringTokenizer tokenizer2=new StringTokenizer(attributeName,"String_Node_Str",false);
  if (tokenizer2.countTokens() != 1 && tokenizer2.countTokens() != 2) {
    throw new IllegalActionException(_component,"String_Node_Str" + attributeName);
  }
  if (tokenizer2.countTokens() == 2) {
    castType=tokenizer2.nextToken().trim();
    attributeName=tokenizer2.nextToken().trim();
  }
  Attribute attribute=ModelScope.getScopedVariable(null,container,attributeName);
  if (attribute == null) {
    attribute=container.getAttribute(attributeName);
    if (attribute == null) {
      throw new IllegalActionException(container,"String_Node_Str" + name);
    }
  }
  if (offset == null) {
    if (attribute instanceof Variable) {
      Variable variable=(Variable)attribute;
      ParseTreeCodeGenerator parseTreeCodeGenerator=getParseTreeCodeGenerator();
      if (variable.isStringMode()) {
        return _generateTypeConvertMethod("String_Node_Str" + parseTreeCodeGenerator.escapeForTargetLanguage(variable.getExpression()) + "String_Node_Str",castType,"String_Node_Str");
      }
      PtParser parser=new PtParser();
      ASTPtRootNode parseTree=parser.generateParseTree(variable.getExpression());
      parseTreeCodeGenerator.evaluateParseTree(parseTree,new HelperScope(variable));
      return _generateTypeConvertMethod(processCode(parseTreeCodeGenerator.generateFireCode()),castType,codeGenType(variable.getType()));
    }
 else {
      return ((Settable)attribute).getExpression();
    }
  }
 else {
    if (attribute instanceof Parameter) {
      Token token=((Parameter)attribute).getToken();
      if (token instanceof ArrayToken) {
        Token element=((ArrayToken)token).getElement(new Integer(offset).intValue());
        return _generateTypeConvertMethod(element.toString(),castType,codeGenType(element.getType()));
      }
      throw new IllegalActionException(_component,attributeName + "String_Node_Str");
    }
    throw new IllegalActionException(_component,attributeName + "String_Node_Str");
  }
}