Package org.jivesoftware.smack.packet
Class StanzaError
- java.lang.Object
-
- org.jivesoftware.smack.packet.AbstractError
-
- org.jivesoftware.smack.packet.StanzaError
-
- All Implemented Interfaces:
Element,ExtensionElement,FullyQualifiedElement,NamedElement,XmlLangElement
public class StanzaError extends AbstractError implements ExtensionElement
Represents an XMPP error sub-packet. Typically, a server responds to a request that has problems by sending the stanza back and including an error packet. Each error has a type, error condition as well as as an optional text explanation. Typical errors are:XMPP Errors XMPP Error Condition Type RFC 6120 Section bad-request MODIFY 8.3.3.1 conflict CANCEL 8.3.3.2 feature-not-implemented CANCEL 8.3.3.3 forbidden AUTH 8.3.3.4 gone CANCEL 8.3.3.5 internal-server-error WAIT 8.3.3.6 item-not-found CANCEL 8.3.3.7 jid-malformed MODIFY 8.3.3.8 not-acceptable MODIFY 8.3.3.9 not-allowed CANCEL 8.3.3.10 not-authorized AUTH 8.3.3.11 policy-violation MODIFY 8.3.3.12 recipient-unavailable WAIT 8.3.3.13 redirect MODIFY 8.3.3.14 registration-required AUTH 8.3.3.15 remote-server-not-found CANCEL 8.3.3.16 remote-server-timeout WAIT 8.3.3.17 resource-constraint WAIT 8.3.3.18 service-unavailable CANCEL 8.3.3.19 subscription-required AUTH 8.3.3.20 undefined-condition MODIFY 8.3.3.21 unexpected-request WAIT 8.3.3.22
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStanzaError.Builderstatic classStanzaError.Conditionstatic classStanzaError.TypeA class to represent the type of the Error.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringERRORstatic java.lang.StringERROR_CONDITION_AND_TEXT_NAMESPACEstatic java.lang.StringNAMESPACEDeprecated.static javax.xml.namespace.QNameQNAME-
Fields inherited from class org.jivesoftware.smack.packet.AbstractError
descriptiveTexts, extensions, textNamespace
-
-
Constructor Summary
Constructors Constructor Description StanzaError(StanzaError.Condition condition, java.lang.String conditionText, java.lang.String errorGenerator, StanzaError.Type type, java.util.Map<java.lang.String,java.lang.String> descriptiveTexts, java.util.List<ExtensionElement> extensions)Creates a new error with the specified type, condition and message.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StanzaError.Builderfrom(StanzaError.Condition condition, java.lang.String descriptiveText)static StanzaError.BuildergetBuilder()static StanzaError.BuildergetBuilder(StanzaError xmppError)static StanzaError.BuildergetBuilder(StanzaError.Condition condition)StanzaError.ConditiongetCondition()Returns the error condition.java.lang.StringgetConditionText()java.lang.StringgetElementName()Returns the root element name.java.lang.StringgetErrorGenerator()java.lang.StringgetNamespace()Returns the root element XML namespace.StanzaError.TypegetType()Returns the error type.java.lang.StringtoString()XmlStringBuildertoXML(XmlEnvironment enclosingNamespace)-
Methods inherited from class org.jivesoftware.smack.packet.AbstractError
addDescriptiveTextsAndExtensions, getDescriptiveText, getDescriptiveText, getExtension
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jivesoftware.smack.packet.FullyQualifiedElement
getLanguage, getQName
-
-
-
-
Field Detail
-
ERROR_CONDITION_AND_TEXT_NAMESPACE
public static final java.lang.String ERROR_CONDITION_AND_TEXT_NAMESPACE
- See Also:
- Constant Field Values
-
NAMESPACE
@Deprecated public static final java.lang.String NAMESPACE
Deprecated.TODO describe me.- See Also:
- Constant Field Values
-
ERROR
public static final java.lang.String ERROR
- See Also:
- Constant Field Values
-
QNAME
public static final javax.xml.namespace.QName QNAME
-
-
Constructor Detail
-
StanzaError
public StanzaError(StanzaError.Condition condition, java.lang.String conditionText, java.lang.String errorGenerator, StanzaError.Type type, java.util.Map<java.lang.String,java.lang.String> descriptiveTexts, java.util.List<ExtensionElement> extensions)
Creates a new error with the specified type, condition and message. This constructor is used when the condition is not recognized automatically by XMPPError i.e. there is not a defined instance of ErrorCondition or it does not apply the default specification.- Parameters:
type- the error type.condition- the error condition.conditionText- TODO javadoc me pleaseerrorGenerator- TODO javadoc me pleasedescriptiveTexts- TODO javadoc me pleaseextensions- list of stanza extensions
-
-
Method Detail
-
getCondition
public StanzaError.Condition getCondition()
Returns the error condition.- Returns:
- the error condition.
-
getType
public StanzaError.Type getType()
Returns the error type.- Returns:
- the error type.
-
getErrorGenerator
public java.lang.String getErrorGenerator()
-
getConditionText
public java.lang.String getConditionText()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getElementName
public java.lang.String getElementName()
Description copied from interface:NamedElementReturns the root element name.- Specified by:
getElementNamein interfaceNamedElement- Returns:
- the element name.
-
getNamespace
public java.lang.String getNamespace()
Description copied from interface:FullyQualifiedElementReturns the root element XML namespace.- Specified by:
getNamespacein interfaceFullyQualifiedElement- Returns:
- the namespace.
-
toXML
public XmlStringBuilder toXML(XmlEnvironment enclosingNamespace)
-
from
public static StanzaError.Builder from(StanzaError.Condition condition, java.lang.String descriptiveText)
-
getBuilder
public static StanzaError.Builder getBuilder()
-
getBuilder
public static StanzaError.Builder getBuilder(StanzaError.Condition condition)
-
getBuilder
public static StanzaError.Builder getBuilder(StanzaError xmppError)
-
-