Program: 73979
Project: 73979
Buggy source:
/** 
 * Given a transition, find any input ports referenced in the guard expressions of the transitions, and if any of those input ports has status unknown, return false. FIXME: bogus: Also, if the port identifier does not end with "_isPresent", then return false if port identifier with "_isPresent" appended is false. There is no data on the port "in" then the identifier "in" will be undefined, or worse, will resolve to the port object itself. Otherwise, return true. These are the input ports whose status must be known for this transition to be enabled.
 * @param transition A transition
 * @return A set of input ports.
 * @exception IllegalActionException If the guard expression cannotbe parsed.
 */
private boolean _referencedInputPortsByGuardKnown(Transition transition) throws IllegalActionException {
  String string=transition.getGuardExpression();
  if (string.trim().equals("String_Node_Str")) {
    return true;
  }
  PtParser parser=new PtParser();
  ASTPtRootNode parseTree=parser.generateParseTree(string);
  ParseTreeFreeVariableCollector variableCollector=new ParseTreeFreeVariableCollector();
  ParserScope scope=getPortScope();
  Set<String> nameSet=variableCollector.collectFreeVariables(parseTree,scope);
  for (  String name : nameSet) {
    Port port=_getPortForIdentifier(name);
    if (port instanceof IOPort) {
      int channel=_getChannelForIdentifier(name);
      if (channel >= 0) {
        if (!((IOPort)port).isKnown(channel)) {
          return false;
        }
        if (!name.endsWith("String_Node_Str")) {
          Token token=scope.get(port.getName() + "String_Node_Str" + channel+ "String_Node_Str");
          if (!(token instanceof BooleanToken) || !((BooleanToken)token).booleanValue()) {
            return false;
          }
        }
      }
 else {
        if (!((IOPort)port).isKnown()) {
          return false;
        }
        if (!name.endsWith("String_Node_Str")) {
          Token token=scope.get(port.getName() + "String_Node_Str");
          if (!(token instanceof BooleanToken) || !((BooleanToken)token).booleanValue()) {
            return false;
          }
        }
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Given a transition, find any input ports referenced in the guard expressions of the transition, and if any of those input ports has status unknown, return false. Otherwise, return true. These are the input ports whose status must be known for this transition to be enabled.
 * @param transition A transition
 * @return True if all input ports referenced by the guard onthe transition have known status.
 * @exception IllegalActionException If the guard expression cannotbe parsed.
 */
private boolean _referencedInputPortsByGuardKnown(Transition transition) throws IllegalActionException {
  String string=transition.getGuardExpression();
  if (string.trim().equals("String_Node_Str")) {
    return true;
  }
  PtParser parser=new PtParser();
  ASTPtRootNode parseTree=parser.generateParseTree(string);
  ParseTreeFreeVariableCollector variableCollector=new ParseTreeFreeVariableCollector();
  ParserScope scope=getPortScope();
  Set<String> nameSet=variableCollector.collectFreeVariables(parseTree,scope);
  for (  String name : nameSet) {
    Port port=_getPortForIdentifier(name);
    if (port instanceof IOPort) {
      int channel=_getChannelForIdentifier(name);
      if (channel >= 0) {
        if (!((IOPort)port).isKnown(channel)) {
          return false;
        }
      }
 else {
        if (!((IOPort)port).isKnown()) {
          return false;
        }
      }
    }
  }
  return true;
}