Program: 76154
Project: 76154
Buggy source:
/** 
 * Return true if the receiver containing this boundary detector is connected to the inside of a boundary port. A boundary port is an opaque port that is contained by a composite actor. If the containing receiver is connected  to the inside of a boundary port, then return true; otherwise return false. This method is not synchronized so the caller should be.
 * @return True if the containing receiver is connected to the inside of a boundary port; return false otherwise.
 */
public boolean isConnectedToBoundary(){
  if (_connectedBoundaryCacheIsOn) {
    return _isConnectedBoundaryValue;
  }
 else {
    IOPort innerPort=(IOPort)_rcvr.getContainer();
    if (innerPort == null) {
      _connectedBoundaryCacheIsOn=false;
      _isConnectedBoundaryValue=false;
      return _isConnectedBoundaryValue;
    }
    ComponentEntity innerEntity=(ComponentEntity)innerPort.getContainer();
    Port outerPort=null;
    ComponentEntity outerEntity=null;
    Iterator ports=innerPort.connectedPortList().iterator();
    int cnt=0;
    while (ports.hasNext()) {
      outerPort=(Port)ports.next();
      outerEntity=(ComponentEntity)outerPort.getContainer();
      if (outerEntity == innerEntity.getContainer()) {
        try {
          Receiver[][] rcvrs=((IOPort)outerPort).deepGetReceivers();
          for (int i=0; i < rcvrs.length; i++) {
            for (int j=0; j < rcvrs[i].length; j++) {
              if (_rcvr == rcvrs[i][j]) {
                _connectedBoundaryCacheIsOn=true;
                _isConnectedBoundaryValue=true;
                return true;
              }
            }
          }
        }
 catch (        IllegalActionException e) {
          System.out.println("String_Node_Str" + "String_Node_Str");
        }
      }
    }
    _connectedBoundaryCacheIsOn=true;
    _isConnectedBoundaryValue=false;
    return _isConnectedBoundaryValue;
  }
}

Fixed version (ground truth):
/** 
 * Return true if the receiver containing this boundary detector is connected to a boundary port. A boundary port is an opaque  port that is contained by a composite actor. If the containing  receiver is connected to a boundary port, then return true;  otherwise return false.  This method is not synchronized so the caller should be.
 * @return True if the containing receiver is connected to the inside of a boundary port; return false otherwise.
 */
public boolean isConnectedToBoundary(){
  if (_connectedBoundaryCacheIsOn) {
    return _isConnectedBoundaryValue;
  }
 else {
    IOPort contPort=(IOPort)_rcvr.getContainer();
    if (contPort == null) {
      _connectedBoundaryCacheIsOn=false;
      _isConnectedBoundaryValue=false;
      return _isConnectedBoundaryValue;
    }
    ComponentEntity contEntity=(ComponentEntity)contPort.getContainer();
    IOPort connectedPort=null;
    ComponentEntity connectedEntity=null;
    Iterator ports=contPort.connectedPortList().iterator();
    int cnt=0;
    while (ports.hasNext()) {
      connectedPort=(IOPort)ports.next();
      connectedEntity=(ComponentEntity)connectedPort.getContainer();
      if (connectedEntity == contEntity.getContainer() && connectedPort.isInput()) {
        try {
          Receiver[][] rcvrs=connectedPort.deepGetReceivers();
          for (int i=0; i < rcvrs.length; i++) {
            for (int j=0; j < rcvrs[i].length; j++) {
              if (_rcvr == rcvrs[i][j]) {
                _connectedBoundaryCacheIsOn=true;
                _isConnectedBoundaryValue=true;
                return true;
              }
            }
          }
        }
 catch (        IllegalActionException e) {
          System.out.println("String_Node_Str" + "String_Node_Str");
        }
      }
 else       if (connectedPort.isOpaque() && !connectedEntity.isAtomic() && connectedPort.isOutput()) {
        Receiver[][] rcvrs=connectedPort.getRemoteReceivers();
        for (int i=0; i < rcvrs.length; i++) {
          for (int j=0; j < rcvrs[i].length; j++) {
            if (_rcvr == rcvrs[i][j]) {
              _connectedBoundaryCacheIsOn=true;
              _isConnectedBoundaryValue=true;
              return true;
            }
          }
        }
      }
    }
    _connectedBoundaryCacheIsOn=true;
    _isConnectedBoundaryValue=false;
    return _isConnectedBoundaryValue;
  }
}