Program: 75526
Project: 75526
Buggy source:
/** 
 * Evaluate the specified command.
 * @param command The command.
 * @return The return value of the command, or null if there is none.
 * @exception Exception If something goes wrong processing the command.
 */
public String evaluateCommand(String command) throws Exception {
  PtParser parser=new PtParser();
  ASTPtRootNode node=parser.generateSimpleAssignmentParseTree(command);
  String targetName=null;
  if (node instanceof ASTPtAssignmentNode) {
    ASTPtAssignmentNode assignmentNode=(ASTPtAssignmentNode)node;
    targetName=assignmentNode.getIdentifier();
    node=assignmentNode.getExpressionTree();
  }
  final NamedObj model=((ExpressionShellEffigy)getContainer()).getModel();
  ParserScope scope=new ModelScope(){
    public ptolemy.data.Token get(    String name) throws IllegalActionException {
      Variable result=getScopedVariable(null,model,name);
      if (result != null) {
        return result.getToken();
      }
 else {
        return null;
      }
    }
    public ptolemy.data.type.Type getType(    String name) throws IllegalActionException {
      Variable result=getScopedVariable(null,model,name);
      if (result != null) {
        return result.getType();
      }
 else {
        return null;
      }
    }
    public Set identifierSet(){
      return getAllScopedVariableNames(null,model);
    }
  }
;
  Token result=_evaluator.evaluateParseTree(node,scope);
  if (targetName != null) {
    Parameter parameter=new Parameter(model,targetName);
    parameter.setToken(result);
  }
  if (result == null) {
    return "String_Node_Str";
  }
 else {
    return result.toString();
  }
}

Fixed version (ground truth):
/** 
 * Evaluate the specified command.
 * @param command The command.
 * @return The return value of the command, or null if there is none.
 * @exception Exception If something goes wrong processing the command.
 */
public String evaluateCommand(String command) throws Exception {
  PtParser parser=new PtParser();
  ASTPtRootNode node=parser.generateSimpleAssignmentParseTree(command);
  String targetName=null;
  if (node instanceof ASTPtAssignmentNode) {
    ASTPtAssignmentNode assignmentNode=(ASTPtAssignmentNode)node;
    targetName=assignmentNode.getIdentifier();
    node=assignmentNode.getExpressionTree();
  }
  final NamedObj model=((ExpressionShellEffigy)getContainer()).getModel();
  ParserScope scope=new ModelScope(){
    public ptolemy.data.Token get(    String name) throws IllegalActionException {
      Variable result=getScopedVariable(null,model,name);
      if (result != null) {
        return result.getToken();
      }
 else {
        return null;
      }
    }
    public ptolemy.data.type.Type getType(    String name) throws IllegalActionException {
      Variable result=getScopedVariable(null,model,name);
      if (result != null) {
        return result.getType();
      }
 else {
        return null;
      }
    }
    public Set identifierSet(){
      return getAllScopedVariableNames(null,model);
    }
  }
;
  Token result=_evaluator.evaluateParseTree(node,scope);
  if (targetName != null) {
    Attribute attribute=model.getAttribute(targetName);
    if (attribute != null && !(attribute instanceof Parameter)) {
      attribute.setContainer(null);
      attribute=null;
    }
    if (attribute == null) {
      attribute=new Parameter(model,targetName);
    }
    ((Parameter)attribute).setToken(result);
  }
  if (result == null) {
    return "String_Node_Str";
  }
 else {
    return result.toString();
  }
}