/**
   * Utility method throwing an exception if the stack is not properly initialized.
   *
   * @throws java.lang.IllegalStateException if the underlying stack is not registered and
   *     initialized.
   */
  private void assertConnected() throws IllegalStateException {
    if (jabberProvider == null)
      throw new IllegalStateException(
          "The provider must be non-null and signed on the "
              + "service before being able to send a file.");
    else if (!jabberProvider.isRegistered()) {
      // if we are not registered but the current status is online
      // change the current status
      if (opSetPersPresence.getPresenceStatus().isOnline()) {
        opSetPersPresence.fireProviderStatusChangeEvent(
            opSetPersPresence.getPresenceStatus(),
            jabberProvider.getJabberStatusEnum().getStatus(JabberStatusEnum.OFFLINE));
      }

      throw new IllegalStateException(
          "The provider must be signed on the service before " + "being able to send a file.");
    }
  }