Enum PacketError.Condition

  • All Implemented Interfaces:
    Serializable, Comparable<PacketError.Condition>
    Enclosing class:
    PacketError

    public static enum PacketError.Condition
    extends Enum<PacketError.Condition>
    Type-safe enumeration for the error condition.

    Implementation note: XMPP error conditions use "-" characters in their names such as "bad-request". Because "-" characters are not valid identifier parts in Java, they have been converted to "_" characters in the enumeration names, such as bad_request. The toXMPP() and fromXMPP(String) methods can be used to convert between the enumertation values and XMPP error code strings.

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      bad_request
      The sender has sent XML that is malformed or that cannot be processed (e.g., an IQ stanza that includes an unrecognized value of the 'type' attribute); the associated error type SHOULD be "modify".
      conflict
      Access cannot be granted because an existing resource or session exists with the same name or address; the associated error type SHOULD be "cancel".
      feature_not_implemented
      The feature requested is not implemented by the recipient or server and therefore cannot be processed; the associated error type SHOULD be "cancel".
      forbidden
      The requesting entity does not possess the required permissions to perform the action; the associated error type SHOULD be "auth".
      gone
      The recipient or server can no longer be contacted at this address (the error stanza MAY contain a new address in the XML character data of the <gone/> element); the associated error type SHOULD be "modify".
      internal_server_error
      The server could not process the stanza because of a misconfiguration or an otherwise-undefined internal server error; the associated error type SHOULD be "wait".
      item_not_found
      The addressed JID or item requested cannot be found; the associated error type SHOULD be "cancel".
      jid_malformed
      The sending entity has provided or communicated an XMPP address (e.g., a value of the 'to' attribute) or aspect thereof (e.g., a resource identifier) that does not adhere to the syntax defined in Addressing Scheme (Section 3); the associated error type SHOULD be "modify".
      not_acceptable
      The recipient or server understands the request but is refusing to process it because it does not meet criteria defined by the recipient or server (e.g., a local policy regarding acceptable words in messages); the associated error type SHOULD be "modify".
      not_allowed
      The recipient or server does not allow any entity to perform the action; the associated error type SHOULD be "cancel".
      not_authorized
      The sender must provide proper credentials before being allowed to perform the action, or has provided improper credentials; the associated error type SHOULD be "auth".
      payment_required
      The requesting entity is not authorized to access the requested service because payment is required; the associated error type SHOULD be "auth".
      recipient_unavailable
      The intended recipient is temporarily unavailable; the associated error type SHOULD be "wait" (note: an application MUST NOT return this error if doing so would provide information about the intended recipient's network availability to an entity that is not authorized to know such information).
      redirect
      The recipient or server is redirecting requests for this information to another entity, usually temporarily (the error stanza SHOULD contain the alternate address, which MUST be a valid JID, in the XML character data of the <redirect/> element); the associated error type SHOULD be "modify".
      registration_required
      The requesting entity is not authorized to access the requested service because registration is required; the associated error type SHOULD be "auth".
      remote_server_not_found
      A remote server or service specified as part or all of the JID of the intended recipient does not exist; the associated error type SHOULD be "cancel".
      remote_server_timeout
      A remote server or service specified as part or all of the JID of the intended recipient (or required to fulfill a request) could not be contacted within a reasonable amount of time; the associated error type SHOULD be "wait".
      resource_constraint
      The server or recipient lacks the system resources necessary to service the request; the associated error type SHOULD be "wait".
      service_unavailable
      The server or recipient does not currently provide the requested service; the associated error type SHOULD be "cancel".
      subscription_required
      The requesting entity is not authorized to access the requested service because a subscription is required; the associated error type SHOULD be "auth".
      undefined_condition
      The error condition is not one of those defined by the other conditions in this list; any error type may be associated with this condition, and it SHOULD be used only in conjunction with an application-specific condition.
      unexpected_request
      The recipient or server understood the request but was not expecting it at this time (e.g., the request was out of order); the associated error type SHOULD be "wait".
    • Enum Constant Detail

      • bad_request

        public static final PacketError.Condition bad_request
        The sender has sent XML that is malformed or that cannot be processed (e.g., an IQ stanza that includes an unrecognized value of the 'type' attribute); the associated error type SHOULD be "modify".
      • conflict

        public static final PacketError.Condition conflict
        Access cannot be granted because an existing resource or session exists with the same name or address; the associated error type SHOULD be "cancel".
      • feature_not_implemented

        public static final PacketError.Condition feature_not_implemented
        The feature requested is not implemented by the recipient or server and therefore cannot be processed; the associated error type SHOULD be "cancel".
      • forbidden

        public static final PacketError.Condition forbidden
        The requesting entity does not possess the required permissions to perform the action; the associated error type SHOULD be "auth".
      • gone

        public static final PacketError.Condition gone
        The recipient or server can no longer be contacted at this address (the error stanza MAY contain a new address in the XML character data of the <gone/> element); the associated error type SHOULD be "modify".
      • internal_server_error

        public static final PacketError.Condition internal_server_error
        The server could not process the stanza because of a misconfiguration or an otherwise-undefined internal server error; the associated error type SHOULD be "wait".
      • item_not_found

        public static final PacketError.Condition item_not_found
        The addressed JID or item requested cannot be found; the associated error type SHOULD be "cancel".
      • jid_malformed

        public static final PacketError.Condition jid_malformed
        The sending entity has provided or communicated an XMPP address (e.g., a value of the 'to' attribute) or aspect thereof (e.g., a resource identifier) that does not adhere to the syntax defined in Addressing Scheme (Section 3); the associated error type SHOULD be "modify".
      • not_acceptable

        public static final PacketError.Condition not_acceptable
        The recipient or server understands the request but is refusing to process it because it does not meet criteria defined by the recipient or server (e.g., a local policy regarding acceptable words in messages); the associated error type SHOULD be "modify".
      • not_allowed

        public static final PacketError.Condition not_allowed
        The recipient or server does not allow any entity to perform the action; the associated error type SHOULD be "cancel".
      • not_authorized

        public static final PacketError.Condition not_authorized
        The sender must provide proper credentials before being allowed to perform the action, or has provided improper credentials; the associated error type SHOULD be "auth".
      • payment_required

        public static final PacketError.Condition payment_required
        The requesting entity is not authorized to access the requested service because payment is required; the associated error type SHOULD be "auth".
      • recipient_unavailable

        public static final PacketError.Condition recipient_unavailable
        The intended recipient is temporarily unavailable; the associated error type SHOULD be "wait" (note: an application MUST NOT return this error if doing so would provide information about the intended recipient's network availability to an entity that is not authorized to know such information).
      • redirect

        public static final PacketError.Condition redirect
        The recipient or server is redirecting requests for this information to another entity, usually temporarily (the error stanza SHOULD contain the alternate address, which MUST be a valid JID, in the XML character data of the <redirect/> element); the associated error type SHOULD be "modify".
      • registration_required

        public static final PacketError.Condition registration_required
        The requesting entity is not authorized to access the requested service because registration is required; the associated error type SHOULD be "auth".
      • remote_server_not_found

        public static final PacketError.Condition remote_server_not_found
        A remote server or service specified as part or all of the JID of the intended recipient does not exist; the associated error type SHOULD be "cancel".
      • remote_server_timeout

        public static final PacketError.Condition remote_server_timeout
        A remote server or service specified as part or all of the JID of the intended recipient (or required to fulfill a request) could not be contacted within a reasonable amount of time; the associated error type SHOULD be "wait".
      • resource_constraint

        public static final PacketError.Condition resource_constraint
        The server or recipient lacks the system resources necessary to service the request; the associated error type SHOULD be "wait".
      • service_unavailable

        public static final PacketError.Condition service_unavailable
        The server or recipient does not currently provide the requested service; the associated error type SHOULD be "cancel".
      • subscription_required

        public static final PacketError.Condition subscription_required
        The requesting entity is not authorized to access the requested service because a subscription is required; the associated error type SHOULD be "auth".
      • undefined_condition

        public static final PacketError.Condition undefined_condition
        The error condition is not one of those defined by the other conditions in this list; any error type may be associated with this condition, and it SHOULD be used only in conjunction with an application-specific condition.

        Implementation note: the default type for this condition is PacketError.Type.wait, which is not specified in the XMPP protocol.

      • unexpected_request

        public static final PacketError.Condition unexpected_request
        The recipient or server understood the request but was not expecting it at this time (e.g., the request was out of order); the associated error type SHOULD be "wait".
    • Method Detail

      • values

        public static PacketError.Condition[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (PacketError.Condition c : PacketError.Condition.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static PacketError.Condition valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • fromXMPP

        public static PacketError.Condition fromXMPP​(String condition)
        Converts a String value into its Condition representation.
        Parameters:
        condition - the String value.
        Returns:
        the condition corresponding to the String.
      • getDefaultType

        public PacketError.Type getDefaultType()
        Returns the default PacketError.Type associated with this condition. Each error condition has an error type that it is usually associated with.
        Returns:
        the default error type.
      • getLegacyCode

        public int getLegacyCode()
        Returns the legacy error code associated with the error. Error code mappings are based on XEP-0086 'Error Condition Mappings'. Support for legacy error codes is necessary since many "Jabber" clients do not understand XMPP error codes. The fromLegacyCode(int) method will convert numeric error codes into Conditions.
        Returns:
        the legacy error code.
        See Also:
        XEP-0086: Error Condition Mappings
      • toXMPP

        public String toXMPP()
        Returns the error code as a valid XMPP error code string.
        Returns:
        the XMPP error code value.