Program: 72344
Project: 72344
Buggy source:
/** 
 * Manage the correct termination of the   {@link HlaManager}. Call the HLA services to: unsubscribe to HLA attributes, unpublish HLA attributes, resign a Federation and destroy a Federation if the current Federate is the last participant.
 * @exception IllegalActionException If the parent class throws itof if a CERTI exception is raised then displayed it to the user.
 */
@Override public void wrapup() throws IllegalActionException {
  super.wrapup();
  if (_debugListeners != null && _debugListeners.size() > 0) {
    for (    Object listener : _debugListeners) {
      _certiRtig.removeDebugListener((DebugListener)listener);
    }
  }
  _strucuralInformation.clear();
  _registeredObject.clear();
  _debug("String_Node_Str" + "String_Node_Str" + _numberOfTARs + "String_Node_Str"+ _numberOfNERs+ "String_Node_Str"+ _numberOfTAGs);
  calculateRuntime();
  writeNumberOfHLACalls();
  writeDelays();
  writeUAVsInformations();
  writeRAVsInformations();
  writeTimes();
  if (_debugging) {
    _debug("String_Node_Str");
  }
  for (  Object[] obj : _hlaAttributesSubscribedTo.values()) {
    try {
      _rtia.unsubscribeObjectClass(_getClassHandleFromTab(obj));
    }
 catch (    RTIexception e) {
      throw new IllegalActionException(this,e,e.getMessage());
    }
catch (    ArrayIndexOutOfBoundsException e2) {
      throw new IllegalActionException(this,e2,"String_Node_Str" + "String_Node_Str" + obj + "String_Node_Str"+ obj.length+ "String_Node_Str");
    }
    if (_debugging) {
      _debug("String_Node_Str" + _getPortFromTab(obj).getContainer().getName() + "String_Node_Str"+ _getClassHandleFromTab(obj)+ "String_Node_Str");
    }
  }
  for (  Object[] obj : _hlaAttributesToPublish.values()) {
    try {
      _rtia.unpublishObjectClass(_getClassHandleFromTab(obj));
    }
 catch (    RTIexception e) {
      throw new IllegalActionException(this,e,e.getMessage());
    }
catch (    ArrayIndexOutOfBoundsException e2) {
      throw new IllegalActionException(this,e2,"String_Node_Str" + "String_Node_Str" + obj + "String_Node_Str"+ obj.length+ "String_Node_Str");
    }
    if (_debugging) {
      _debug("String_Node_Str" + _getPortFromTab(obj).getContainer().getName() + "String_Node_Str"+ _getClassHandleFromTab(obj)+ "String_Node_Str");
    }
  }
  try {
    _rtia.resignFederationExecution(ResignAction.DELETE_OBJECTS_AND_RELEASE_ATTRIBUTES);
  }
 catch (  RTIexception e) {
    throw new IllegalActionException(this,e,e.getMessage());
  }
  if (_debugging) {
    _debug("String_Node_Str");
  }
  boolean canDestroyRtig=false;
  while (!canDestroyRtig) {
    try {
      _rtia.destroyFederationExecution(_federationName);
    }
 catch (    FederatesCurrentlyJoined e) {
      if (_debugging) {
        _debug("String_Node_Str");
      }
    }
catch (    FederationExecutionDoesNotExist e) {
      if (_debugging) {
        _debug("String_Node_Str");
      }
      canDestroyRtig=true;
    }
catch (    RTIinternalError e) {
      throw new IllegalActionException(this,e,"String_Node_Str");
    }
catch (    ConcurrentAccessAttempted e) {
      throw new IllegalActionException(this,e,"String_Node_Str");
    }
    if (_debugging) {
      _debug("String_Node_Str" + "String_Node_Str");
    }
    canDestroyRtig=true;
  }
  if (_certiRtig != null) {
    _certiRtig.terminateProcess();
    if (_debugging) {
      _debug("String_Node_Str" + "String_Node_Str");
    }
  }
  _hlaAttributesToPublish.clear();
  _hlaAttributesSubscribedTo.clear();
  _fromFederationEvents.clear();
  _objectIdToClassHandle.clear();
  if (_debugging) {
    _debug("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Manage the correct termination of the   {@link HlaManager}. Call the HLA services to: unsubscribe to HLA attributes, unpublish HLA attributes, resign a Federation and destroy a Federation if the current Federate is the last participant.
 * @exception IllegalActionException If the parent class throws itof if a CERTI exception is raised then displayed it to the user.
 */
@Override public void wrapup() throws IllegalActionException {
  super.wrapup();
  if (_debugListeners != null && _debugListeners.size() > 0) {
    for (    Object listener : _debugListeners) {
      _certiRtig.removeDebugListener((DebugListener)listener);
    }
  }
  _strucuralInformation.clear();
  _registeredObject.clear();
  _debug("String_Node_Str" + "String_Node_Str" + _numberOfTARs + "String_Node_Str"+ _numberOfNERs+ "String_Node_Str"+ _numberOfTAGs);
  calculateRuntime();
  writeNumberOfHLACalls();
  writeDelays();
  writeUAVsInformations();
  writeRAVsInformations();
  writeTimes();
  if (_debugging) {
    _debug("String_Node_Str");
  }
  for (  Object[] obj : _hlaAttributesSubscribedTo.values()) {
    try {
      _rtia.unsubscribeObjectClass(_getClassHandleFromTab(obj));
    }
 catch (    RTIexception e) {
      throw new IllegalActionException(this,e,e.getMessage());
    }
catch (    ArrayIndexOutOfBoundsException e2) {
      throw new IllegalActionException(this,e2,"String_Node_Str" + "String_Node_Str" + Arrays.toString(obj) + "String_Node_Str"+ obj.length+ "String_Node_Str");
    }
    if (_debugging) {
      _debug("String_Node_Str" + _getPortFromTab(obj).getContainer().getName() + "String_Node_Str"+ _getClassHandleFromTab(obj)+ "String_Node_Str");
    }
  }
  for (  Object[] obj : _hlaAttributesToPublish.values()) {
    try {
      _rtia.unpublishObjectClass(_getClassHandleFromTab(obj));
    }
 catch (    RTIexception e) {
      throw new IllegalActionException(this,e,e.getMessage());
    }
catch (    ArrayIndexOutOfBoundsException e2) {
      throw new IllegalActionException(this,e2,"String_Node_Str" + "String_Node_Str" + Arrays.toString(obj) + "String_Node_Str"+ obj.length+ "String_Node_Str");
    }
    if (_debugging) {
      _debug("String_Node_Str" + _getPortFromTab(obj).getContainer().getName() + "String_Node_Str"+ _getClassHandleFromTab(obj)+ "String_Node_Str");
    }
  }
  try {
    _rtia.resignFederationExecution(ResignAction.DELETE_OBJECTS_AND_RELEASE_ATTRIBUTES);
  }
 catch (  RTIexception e) {
    throw new IllegalActionException(this,e,e.getMessage());
  }
  if (_debugging) {
    _debug("String_Node_Str");
  }
  boolean canDestroyRtig=false;
  while (!canDestroyRtig) {
    try {
      _rtia.destroyFederationExecution(_federationName);
    }
 catch (    FederatesCurrentlyJoined e) {
      if (_debugging) {
        _debug("String_Node_Str");
      }
    }
catch (    FederationExecutionDoesNotExist e) {
      if (_debugging) {
        _debug("String_Node_Str");
      }
      canDestroyRtig=true;
    }
catch (    RTIinternalError e) {
      throw new IllegalActionException(this,e,"String_Node_Str");
    }
catch (    ConcurrentAccessAttempted e) {
      throw new IllegalActionException(this,e,"String_Node_Str");
    }
    if (_debugging) {
      _debug("String_Node_Str" + "String_Node_Str");
    }
    canDestroyRtig=true;
  }
  if (_certiRtig != null) {
    _certiRtig.terminateProcess();
    if (_debugging) {
      _debug("String_Node_Str" + "String_Node_Str");
    }
  }
  _hlaAttributesToPublish.clear();
  _hlaAttributesSubscribedTo.clear();
  _fromFederationEvents.clear();
  _objectIdToClassHandle.clear();
  if (_debugging) {
    _debug("String_Node_Str");
  }
}