Class StanzaError

    • Constructor Detail

      • StanzaError

        public StanzaError​(StanzaError.Type type,
                           Condition condition)
        Creates an error with a given error type and a condition.

        The <error/> element MUST contain a defined condition element.

        Parameters:
        type - The error type.
        condition - The condition.
      • StanzaError

        public StanzaError​(StanzaError.Type type,
                           Condition condition,
                           String text)
        Creates an error with a given error type and a condition.

        The <error/> element MUST contain a defined condition element.

        Parameters:
        type - The error type.
        condition - The condition.
        text - The text.
      • StanzaError

        public StanzaError​(Condition condition)
        Creates an error with a given condition.

        The error type is set by the condition's associated error type.

        Parameters:
        condition - The condition.
      • StanzaError

        public StanzaError​(Condition condition,
                           String text)
        Creates an error with a given condition and text.

        The error type is set by the condition's associated error type.

        Parameters:
        condition - The condition.
        text - The text.
      • StanzaError

        public StanzaError​(Condition condition,
                           Object extension)
        Creates an error with a given condition and extension.

        The error type is set by the condition's associated error type.

        Parameters:
        condition - The condition.
        extension - The extension.
      • StanzaError

        public StanzaError​(StanzaError.Type type,
                           Condition condition,
                           String text,
                           Locale language,
                           Object extension,
                           Jid by)
        Creates a stanza error with all possible values.
        Parameters:
        type - The error type.
        condition - The condition.
        text - The text.
        language - The language.
        extension - The application specific condition.
        by - The entity which returns the error.
    • Method Detail

      • getBy

        public final Jid getBy()
        Gets the 'by' attribute.

        8.3.1. Rules

        The entity that returns an error stanza MAY pass along its JID to the sender of the generated stanza (e.g., for diagnostic or tracking purposes) through the addition of a 'by' attribute to the <error/> child element.
        Returns:
        The JID.
      • getType

        public final StanzaError.Type getType()
        Gets the error type, either 'auth', 'cancel', 'continue', 'modify' or 'wait'.
        Returns:
        The type.
      • getText

        public final String getText()
        Gets the optional error text.
        Returns:
        The text.
      • getLanguage

        public final Locale getLanguage()
        Gets the language of the error text.
        Specified by:
        getLanguage in interface LanguageElement
        Returns:
        The language.
      • getExtension

        public final Object getExtension()
        Gets the application specific condition, if any.

        8.3.4. Application-Specific Conditions

        As noted, an application MAY provide application-specific stanza error information by including a properly namespaced child within the error element. Typically, the application-specific element supplements or further qualifies a defined element. Thus, the <error/> element will contain two or three child elements.

        Returns:
        The application specific condition.