Program: 73508
Project: 73508
Buggy source:
/** 
 * Check the consistency of input/output ports. The following things are checked. <p> If an input port is a sensor port (no annotation), then it should not be connected to a NetworkInputDevice. Also, it should not have a networkDelay attribute. </p><p> If an input port is a network port (annotated networkPort), then it should always be connected to a NetworkInputDeivce. Also, it should not have a realTimeDelay attribute. </p>
 * @exception IllegalActionException If sensor ports are connected toNetworkInputDevice or have a networkDelay attribute; Or if a network port is not connected to a NetworkInputDeivce, or it has a realTimeDelay attribute.
 */
protected void _checkSensorActuatorNetworkConsistency() throws IllegalActionException {
  if (getContainer() instanceof TypedCompositeActor) {
    for (    TypedIOPort port : (List<TypedIOPort>)(((TypedCompositeActor)getContainer()).inputPortList())) {
      for (      TypedIOPort sinkPort : (List<TypedIOPort>)port.deepInsidePortList()) {
        if (isNetworkPort(port)) {
          if (sinkPort.isInput() && !(sinkPort.getContainer() instanceof NetworkInputDevice)) {
            throw new IllegalActionException(port,sinkPort.getContainer(),"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
          }
          Parameter parameter=(Parameter)((NamedObj)port).getAttribute("String_Node_Str");
          if (parameter != null) {
            throw new IllegalActionException(port,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
          }
        }
 else {
          Parameter parameter=(Parameter)getAttribute("String_Node_Str");
          if ((parameter != null) && (((DoubleToken)parameter.getToken()).doubleValue() != 0.0) && sinkPort.isInput()&& !(sinkPort.getContainer() instanceof SensorInputDevice)) {
            throw new IllegalActionException(port,sinkPort.getContainer(),"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
          }
          if (sinkPort.isInput() && sinkPort.getContainer() instanceof NetworkInputDevice) {
            throw new IllegalActionException(port,sinkPort.getContainer(),"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
          }
          parameter=(Parameter)((NamedObj)port).getAttribute("String_Node_Str");
          if (parameter != null) {
            throw new IllegalActionException(port,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
          }
        }
      }
    }
    for (    TypedIOPort port : (List<TypedIOPort>)(((TypedCompositeActor)getContainer()).outputPortList())) {
      for (      TypedIOPort sourcePort : (List<TypedIOPort>)port.deepInsidePortList()) {
        if (isNetworkPort(port)) {
          if (sourcePort.isOutput() && !(sourcePort.getContainer() instanceof NetworkOutputDevice)) {
            throw new IllegalActionException(port,sourcePort.getContainer(),"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
          }
          Parameter parameter=(Parameter)((NamedObj)port).getAttribute("String_Node_Str");
          if (parameter != null) {
            throw new IllegalActionException(port,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
          }
        }
 else {
          Parameter parameter=(Parameter)getAttribute("String_Node_Str");
          if ((parameter != null) && (((DoubleToken)parameter.getToken()).doubleValue() != 0.0) && sourcePort.isInput()&& !(sourcePort.getContainer() instanceof ActuatorOutputDevice)) {
            throw new IllegalActionException(port,sourcePort.getContainer(),"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
          }
          if (sourcePort.isOutput() && sourcePort.getContainer() instanceof NetworkOutputDevice) {
            throw new IllegalActionException(port,sourcePort.getContainer(),"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
          }
          parameter=(Parameter)((NamedObj)port).getAttribute("String_Node_Str");
          if (parameter != null) {
            throw new IllegalActionException(port,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Check the consistency of input/output ports. The following things are checked. <p> If an input port is a sensor port (no annotation), then it should not be connected to a NetworkInputDevice. Also, it should not have a networkDelay attribute. </p><p> If an input port is a network port (annotated networkPort), then it should always be connected to a NetworkInputDeivce. Also, it should not have a realTimeDelay attribute. </p>
 * @exception IllegalActionException If sensor ports are connected toNetworkInputDevice or have a networkDelay attribute; Or if a network port is not connected to a NetworkInputDeivce, or it has a realTimeDelay attribute.
 */
protected void _checkSensorActuatorNetworkConsistency() throws IllegalActionException {
  if (getContainer() instanceof TypedCompositeActor) {
    for (    TypedIOPort port : (List<TypedIOPort>)(((TypedCompositeActor)getContainer()).inputPortList())) {
      boolean sensorPort=false;
      boolean networkPort=false;
      if (_getNetworkTotalDelay(port) != null) {
        networkPort=true;
      }
      if (_getRealTimeDelay(port) != null) {
        sensorPort=true;
      }
      if (sensorPort && networkPort) {
        throw new IllegalActionException(port,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      }
      for (      TypedIOPort sinkPort : (List<TypedIOPort>)port.deepInsidePortList()) {
        if (isNetworkPort(port)) {
          if (sinkPort.isInput() && !(sinkPort.getContainer() instanceof NetworkInputDevice)) {
            throw new IllegalActionException(port,sinkPort.getContainer(),"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
          }
          Parameter parameter=(Parameter)((NamedObj)port).getAttribute("String_Node_Str");
          if (parameter != null) {
            throw new IllegalActionException(port,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
          }
        }
 else {
          Parameter parameter=(Parameter)getAttribute("String_Node_Str");
          if ((parameter != null) && (((DoubleToken)parameter.getToken()).doubleValue() != 0.0) && sinkPort.isInput()&& !(sinkPort.getContainer() instanceof SensorInputDevice)) {
            throw new IllegalActionException(port,sinkPort.getContainer(),"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
          }
          if (sinkPort.isInput() && sinkPort.getContainer() instanceof NetworkInputDevice) {
            throw new IllegalActionException(port,sinkPort.getContainer(),"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
          }
          parameter=(Parameter)((NamedObj)port).getAttribute("String_Node_Str");
          if (parameter != null) {
            throw new IllegalActionException(port,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
          }
        }
      }
    }
    for (    TypedIOPort port : (List<TypedIOPort>)(((TypedCompositeActor)getContainer()).outputPortList())) {
      for (      TypedIOPort sourcePort : (List<TypedIOPort>)port.deepInsidePortList()) {
        Parameter parameter=(Parameter)getAttribute("String_Node_Str");
        if ((parameter != null) && (((DoubleToken)parameter.getToken()).doubleValue() != 0.0) && sourcePort.isInput()&& !((sourcePort.getContainer() instanceof ActuatorOutputDevice) || (sourcePort.getContainer() instanceof NetworkOutputDevice))) {
          throw new IllegalActionException(port,sourcePort.getContainer(),"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
        }
      }
    }
  }
}