Program: 73132
Project: 73132
Buggy source:
/** 
 * Handle timing error on a PtidesPort.  FIXME: for now this can only drop the event that caused the error or throw a message.  TODO: implement different behaviors.
 * @param port The port where the error occurred.
 * @param event The event that caused the error; i.e. that arrived too late or out of order.
 * @param message The error message.
 * @return A new PtidesEvent that can be safely processed or null if no event should be processed.
 * @throws IllegalActionException If error handling actor throws this.
 */
private PtidesEvent _handleTimingError(PtidesPort port,PtidesEvent event,String message) throws IllegalActionException {
  List list=((CompositeActor)getContainer()).entityList();
  for (int i=0; i < list.size(); i++) {
    Object entity=list.get(i);
    if (entity instanceof CompositeActor && ((CompositeActor)entity).getName().equals("String_Node_Str")) {
      CompositeActor errorHandler=(CompositeActor)entity;
      List errorHandlerEntities=errorHandler.entityList();
      for (int j=0; j < errorHandlerEntities.size(); j++) {
        Object errorHandlerEntity=errorHandlerEntities.get(j);
        if (errorHandlerEntity instanceof Const && ((Const)errorHandlerEntity).getName().equals("String_Node_Str" + port.getName())) {
          ((Const)errorHandlerEntity).fire();
          errorHandler.fire();
          List attributes=errorHandler.attributeList();
          for (int k=0; k < attributes.size(); k++) {
            Attribute attribute=(Attribute)attributes.get(k);
            if (attribute instanceof Parameter) {
              if (((Parameter)attribute).getName().equals("String_Node_Str" + port.getName())) {
                return null;
              }
 else               if (((Parameter)attribute).getName().equals("String_Node_Str" + port.getName())) {
                return event;
              }
            }
          }
        }
      }
    }
  }
  throw new IllegalActionException(port,message);
}

Fixed version (ground truth):
/** 
 * Handle timing error on a PtidesPort.  FIXME: for now this can only drop the event that caused the error or throw a message.  TODO: implement different behaviors.
 * @param port The port where the error occurred.
 * @param event The event that caused the error; i.e. that arrived too late or out of order.
 * @param message The error message.
 * @return A new PtidesEvent that can be safely processed or null if no event should be processed.
 * @throws IllegalActionException If error handling actor throws this.
 */
private PtidesEvent _handleTimingError(PtidesPort port,PtidesEvent event,String message) throws IllegalActionException {
  List list=((CompositeActor)getContainer()).entityList();
  for (int i=0; i < list.size(); i++) {
    Object entity=list.get(i);
    if (entity instanceof CompositeActor && ((CompositeActor)entity).getName().equals("String_Node_Str")) {
      CompositeActor errorHandler=(CompositeActor)entity;
      List errorHandlerEntities=errorHandler.entityList();
      for (int j=0; j < errorHandlerEntities.size(); j++) {
        Object errorHandlerEntity=errorHandlerEntities.get(j);
        if (errorHandlerEntity instanceof Const && ((Const)errorHandlerEntity).getName().equals("String_Node_Str" + port.getName())) {
          ((Const)errorHandlerEntity).fire();
          Time time=errorHandler.getDirector().getModelNextIterationTime();
          int index=1;
          while (time.compareTo(getModelTime()) <= 0) {
            ((CompositeActor)errorHandler).getDirector().setModelTime(time);
            ((DEDirector)((CompositeActor)errorHandler).getDirector()).setIndex(index);
            ((CompositeActor)errorHandler).prefire();
            ((CompositeActor)errorHandler).fire();
            ((CompositeActor)errorHandler).postfire();
            Time previousTime=time;
            time=errorHandler.getDirector().getModelNextIterationTime();
            if (time.equals(previousTime)) {
              index++;
            }
 else {
              index=1;
            }
          }
          List attributes=errorHandler.attributeList();
          for (int k=0; k < attributes.size(); k++) {
            Attribute attribute=(Attribute)attributes.get(k);
            if (attribute instanceof Parameter) {
              if (((Parameter)attribute).getName().equals("String_Node_Str" + port.getName())) {
                if (((Parameter)attribute).getToken() != null && ((BooleanToken)((Parameter)attribute).getToken()).booleanValue()) {
                  ((Parameter)attribute).setToken("String_Node_Str");
                  return null;
                }
              }
              if (((Parameter)attribute).getName().equals("String_Node_Str" + port.getName())) {
                if (((Parameter)attribute).getToken() != null && ((BooleanToken)((Parameter)attribute).getToken()).booleanValue()) {
                  return event;
                }
              }
            }
          }
        }
      }
    }
  }
  throw new IllegalActionException(port,message);
}