Program: 75776
Project: 75776
Buggy source:
/** 
 * Return true if the receiver containing this boundary detector is connected to the outside of an output boundary port; return false otherwise. A boundary port is an opaque port that is contained by a composite actor. If the receiver containing this boundary detector is contained on the inside of a boundary port, then return false. This method is not synchronized so the caller should be.
 * @return True if the containing receiver is connected to theoutside of a boundary port; return false otherwise.
 */
public boolean isConnectedToBoundaryOutside(){
  if (_connectedOutsideOfBoundaryCacheIsOn) {
    return _isConnectedOutsideOfBoundaryValue;
  }
 else {
    IOPort contPort=(IOPort)_rcvr.getContainer();
    if (contPort == null) {
      _connectedOutsideOfBoundaryCacheIsOn=false;
      _isConnectedOutsideOfBoundaryValue=false;
      return _isConnectedOutsideOfBoundaryValue;
    }
    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 (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]) {
              _connectedOutsideOfBoundaryCacheIsOn=true;
              _isConnectedOutsideOfBoundaryValue=true;
              return true;
            }
          }
        }
      }
    }
    _connectedOutsideOfBoundaryCacheIsOn=true;
    _isConnectedOutsideOfBoundaryValue=false;
    return _isConnectedOutsideOfBoundaryValue;
  }
}

Fixed version (ground truth):
/** 
 * Return true if the receiver containing this boundary detector is connected to the outside of an output boundary port; return false otherwise. A boundary port is an opaque port that is contained by a composite actor. If the receiver containing this boundary detector is contained on the inside of a boundary port, then return false. This method is not synchronized so the caller should be.
 * @return True if the containing receiver is connected to theoutside of a boundary port; return false otherwise.
 */
public boolean isConnectedToBoundaryOutside(){
  if (_connectedOutsideOfBoundaryCacheIsOn) {
    return _isConnectedOutsideOfBoundaryValue;
  }
 else {
    IOPort contPort=(IOPort)_receiver.getContainer();
    if (contPort == null) {
      _connectedOutsideOfBoundaryCacheIsOn=false;
      _isConnectedOutsideOfBoundaryValue=false;
      return _isConnectedOutsideOfBoundaryValue;
    }
    ComponentEntity contEntity=(ComponentEntity)contPort.getContainer();
    IOPort connectedPort=null;
    ComponentEntity connectedEntity=null;
    Iterator ports=contPort.connectedPortList().iterator();
    while (ports.hasNext()) {
      connectedPort=(IOPort)ports.next();
      connectedEntity=(ComponentEntity)connectedPort.getContainer();
      if (connectedPort.isOpaque() && !connectedEntity.isAtomic() && connectedPort.isOutput()) {
        Receiver[][] receivers=connectedPort.getRemoteReceivers();
        for (int i=0; i < receivers.length; i++) {
          for (int j=0; j < receivers[i].length; j++) {
            if (_receiver == receivers[i][j]) {
              _connectedOutsideOfBoundaryCacheIsOn=true;
              _isConnectedOutsideOfBoundaryValue=true;
              return true;
            }
          }
        }
      }
    }
    _connectedOutsideOfBoundaryCacheIsOn=true;
    _isConnectedOutsideOfBoundaryValue=false;
    return _isConnectedOutsideOfBoundaryValue;
  }
}