Program: 75755
Project: 75755
Buggy source:
/** 
 * Given a destination name, return a NamedObj that matches that destination.
 * @param name The name of the destination, or null if none is found.
 * @return An object (like a port or a variable) with the specified name.
 * @exception IllegalActionException If the associated FSMActordoes not have a destination with the specified name.
 */
protected NamedObj _getDestination(String name) throws IllegalActionException {
  Transition transition=(Transition)getContainer();
  if (transition == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  Entity fsm=(Entity)transition.getContainer();
  if (fsm == null) {
    throw new IllegalActionException(this,transition,"String_Node_Str");
  }
  IOPort port=(IOPort)fsm.getPort(name);
  if (port == null) {
    Attribute var=fsm.getAttribute(name);
    if (var == null) {
      int period=name.indexOf("String_Node_Str");
      if (period > 0) {
        String refinementName=name.substring(0,period);
        String entryName=name.substring(period + 1);
        Nameable fsmContainer=fsm.getContainer();
        if (fsmContainer instanceof CompositeEntity) {
          Entity refinement=((CompositeEntity)fsmContainer).getEntity(refinementName);
          if (refinement != null) {
            Attribute entry=refinement.getAttribute(entryName);
            if (entry instanceof Variable) {
              return entry;
            }
          }
        }
      }
      throw new IllegalActionException(fsm,this,"String_Node_Str" + name);
    }
 else {
      if (!(var instanceof Variable)) {
        throw new IllegalActionException(fsm,this,"String_Node_Str" + name + "String_Node_Str"+ "String_Node_Str");
      }
      return var;
    }
  }
 else {
    if (!port.isOutput()) {
      throw new IllegalActionException(fsm,this,"String_Node_Str" + name);
    }
    return port;
  }
}

Fixed version (ground truth):
/** 
 * Given a destination name, return a NamedObj that matches that destination.
 * @param name The name of the destination, or null if none is found.
 * @return An object (like a port or a variable) with the specified name.
 * @exception IllegalActionException If the associated FSMActordoes not have a destination with the specified name.
 */
protected NamedObj _getDestination(String name) throws IllegalActionException {
  Transition transition=(Transition)getContainer();
  if (transition == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  Entity fsm=(Entity)transition.getContainer();
  if (fsm == null) {
    throw new IllegalActionException(this,transition,"String_Node_Str");
  }
  IOPort port=(IOPort)fsm.getPort(name);
  if (port == null) {
    Attribute variable=fsm.getAttribute(name);
    if (variable == null) {
      int period=name.indexOf("String_Node_Str");
      if (period > 0) {
        String refinementName=name.substring(0,period);
        String entryName=name.substring(period + 1);
        Nameable fsmContainer=fsm.getContainer();
        if (fsmContainer instanceof CompositeEntity) {
          Entity refinement=((CompositeEntity)fsmContainer).getEntity(refinementName);
          if (refinement != null) {
            Attribute entry=refinement.getAttribute(entryName);
            if (entry instanceof Variable) {
              return entry;
            }
          }
        }
      }
      throw new IllegalActionException(fsm,this,"String_Node_Str" + name);
    }
 else {
      if (!(variable instanceof Variable)) {
        throw new IllegalActionException(fsm,this,"String_Node_Str" + name + "String_Node_Str"+ "String_Node_Str");
      }
      return variable;
    }
  }
 else {
    if (!port.isOutput()) {
      throw new IllegalActionException(fsm,this,"String_Node_Str" + name);
    }
    return port;
  }
}