Program: 75905
Project: 75905
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(refinementName);
            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 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;
  }
}