mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-21 22:02:06 +01:00
Rename XMPPError to StanzaError
Fixes SMACK-769.
This commit is contained in:
parent
609f4243d9
commit
2efec89050
53 changed files with 205 additions and 208 deletions
|
@ -38,7 +38,7 @@ import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Nonza;
|
import org.jivesoftware.smack.packet.Nonza;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.SASLFailure;
|
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.SASLFailure;
|
||||||
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.Success;
|
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.Success;
|
||||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
|
@ -526,7 +526,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
|
||||||
if ("urn:ietf:params:xml:ns:xmpp-streams".equals(parser.getNamespace(null))) {
|
if ("urn:ietf:params:xml:ns:xmpp-streams".equals(parser.getNamespace(null))) {
|
||||||
throw new StreamErrorException(PacketParserUtils.parseStreamError(parser));
|
throw new StreamErrorException(PacketParserUtils.parseStreamError(parser));
|
||||||
} else {
|
} else {
|
||||||
XMPPError.Builder builder = PacketParserUtils.parseError(parser);
|
StanzaError.Builder builder = PacketParserUtils.parseError(parser);
|
||||||
throw new XMPPException.XMPPErrorException(null, builder.build());
|
throw new XMPPException.XMPPErrorException(null, builder.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,9 +74,9 @@ import org.jivesoftware.smack.packet.Nonza;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.packet.Session;
|
import org.jivesoftware.smack.packet.Session;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smack.packet.StartTls;
|
import org.jivesoftware.smack.packet.StartTls;
|
||||||
import org.jivesoftware.smack.packet.StreamError;
|
import org.jivesoftware.smack.packet.StreamError;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
|
||||||
import org.jivesoftware.smack.parsing.ParsingExceptionCallback;
|
import org.jivesoftware.smack.parsing.ParsingExceptionCallback;
|
||||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
import org.jivesoftware.smack.provider.ProviderManager;
|
import org.jivesoftware.smack.provider.ProviderManager;
|
||||||
|
@ -1087,15 +1087,15 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
throw new IllegalStateException("Should only encounter IQ type 'get' or 'set'");
|
throw new IllegalStateException("Should only encounter IQ type 'get' or 'set'");
|
||||||
}
|
}
|
||||||
if (iqRequestHandler == null) {
|
if (iqRequestHandler == null) {
|
||||||
XMPPError.Condition replyCondition;
|
StanzaError.Condition replyCondition;
|
||||||
switch (unknownIqRequestReplyMode) {
|
switch (unknownIqRequestReplyMode) {
|
||||||
case doNotReply:
|
case doNotReply:
|
||||||
return;
|
return;
|
||||||
case replyFeatureNotImplemented:
|
case replyFeatureNotImplemented:
|
||||||
replyCondition = XMPPError.Condition.feature_not_implemented;
|
replyCondition = StanzaError.Condition.feature_not_implemented;
|
||||||
break;
|
break;
|
||||||
case replyServiceUnavailable:
|
case replyServiceUnavailable:
|
||||||
replyCondition = XMPPError.Condition.service_unavailable;
|
replyCondition = StanzaError.Condition.service_unavailable;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
|
@ -1103,7 +1103,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
|
|
||||||
// If the IQ stanza is of type "get" or "set" with no registered IQ request handler, then answer an
|
// If the IQ stanza is of type "get" or "set" with no registered IQ request handler, then answer an
|
||||||
// IQ of type 'error' with condition 'service-unavailable'.
|
// IQ of type 'error' with condition 'service-unavailable'.
|
||||||
ErrorIQ errorIQ = IQ.createErrorResponse(iq, XMPPError.getBuilder((
|
ErrorIQ errorIQ = IQ.createErrorResponse(iq, StanzaError.getBuilder((
|
||||||
replyCondition)));
|
replyCondition)));
|
||||||
try {
|
try {
|
||||||
sendStanza(errorIQ);
|
sendStanza(errorIQ);
|
||||||
|
|
|
@ -19,8 +19,8 @@ package org.jivesoftware.smack;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Nonza;
|
import org.jivesoftware.smack.packet.Nonza;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smack.packet.StreamError;
|
import org.jivesoftware.smack.packet.StreamError;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
|
||||||
|
|
||||||
import org.jxmpp.jid.Jid;
|
import org.jxmpp.jid.Jid;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ import org.jxmpp.jid.Jid;
|
||||||
* is sent to the client an XMPPException will be thrown containing the StreamError sent
|
* is sent to the client an XMPPException will be thrown containing the StreamError sent
|
||||||
* by the server.
|
* by the server.
|
||||||
*
|
*
|
||||||
* @see XMPPError
|
* @see StanzaError
|
||||||
* @author Matt Tucker
|
* @author Matt Tucker
|
||||||
*/
|
*/
|
||||||
public abstract class XMPPException extends Exception {
|
public abstract class XMPPException extends Exception {
|
||||||
|
@ -74,17 +74,17 @@ public abstract class XMPPException extends Exception {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 212790389529249604L;
|
private static final long serialVersionUID = 212790389529249604L;
|
||||||
private final XMPPError error;
|
private final StanzaError error;
|
||||||
private final Stanza stanza;
|
private final Stanza stanza;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new XMPPErrorException with the given builder.
|
* Creates a new XMPPErrorException with the given builder.
|
||||||
*
|
*
|
||||||
* @param xmppErrorBuilder
|
* @param xmppErrorBuilder
|
||||||
* @deprecated Use {@link #XMPPErrorException(Stanza, XMPPError)} instead.
|
* @deprecated Use {@link #XMPPErrorException(Stanza, StanzaError)} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public XMPPErrorException(XMPPError.Builder xmppErrorBuilder) {
|
public XMPPErrorException(StanzaError.Builder xmppErrorBuilder) {
|
||||||
this(null, xmppErrorBuilder.build());
|
this(null, xmppErrorBuilder.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ public abstract class XMPPException extends Exception {
|
||||||
* @param stanza stanza that contained the exception.
|
* @param stanza stanza that contained the exception.
|
||||||
* @param error the root cause of the exception.
|
* @param error the root cause of the exception.
|
||||||
*/
|
*/
|
||||||
public XMPPErrorException(Stanza stanza, XMPPError error) {
|
public XMPPErrorException(Stanza stanza, StanzaError error) {
|
||||||
super();
|
super();
|
||||||
this.error = error;
|
this.error = error;
|
||||||
this.stanza = stanza;
|
this.stanza = stanza;
|
||||||
|
@ -106,7 +106,7 @@ public abstract class XMPPException extends Exception {
|
||||||
*
|
*
|
||||||
* @return the XMPPError associated with this exception.
|
* @return the XMPPError associated with this exception.
|
||||||
*/
|
*/
|
||||||
public XMPPError getXMPPError() {
|
public StanzaError getXMPPError() {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ public abstract class XMPPException extends Exception {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ifHasErrorThenThrow(Stanza packet) throws XMPPErrorException {
|
public static void ifHasErrorThenThrow(Stanza packet) throws XMPPErrorException {
|
||||||
XMPPError xmppError = packet.getError();
|
StanzaError xmppError = packet.getError();
|
||||||
if (xmppError != null) {
|
if (xmppError != null) {
|
||||||
throw new XMPPErrorException(packet, xmppError);
|
throw new XMPPErrorException(packet, xmppError);
|
||||||
}
|
}
|
||||||
|
@ -141,16 +141,16 @@ public abstract class XMPPException extends Exception {
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final XMPPError.Condition condition;
|
private final StanzaError.Condition condition;
|
||||||
|
|
||||||
private final Nonza nonza;
|
private final Nonza nonza;
|
||||||
|
|
||||||
public FailedNonzaException(Nonza nonza, XMPPError.Condition condition) {
|
public FailedNonzaException(Nonza nonza, StanzaError.Condition condition) {
|
||||||
this.condition = condition;
|
this.condition = condition;
|
||||||
this.nonza = nonza;
|
this.nonza = nonza;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XMPPError.Condition getCondition() {
|
public StanzaError.Condition getCondition() {
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.jivesoftware.smack.util.Objects;
|
||||||
|
|
||||||
public class ErrorIQ extends SimpleIQ {
|
public class ErrorIQ extends SimpleIQ {
|
||||||
|
|
||||||
public static final String ELEMENT = XMPPError.ERROR;
|
public static final String ELEMENT = StanzaError.ERROR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new error IQ.
|
* Constructs a new error IQ.
|
||||||
|
@ -29,7 +29,7 @@ public class ErrorIQ extends SimpleIQ {
|
||||||
* </p>
|
* </p>
|
||||||
* @param xmppErrorBuilder the XMPPError builder (required).
|
* @param xmppErrorBuilder the XMPPError builder (required).
|
||||||
*/
|
*/
|
||||||
public ErrorIQ(XMPPError.Builder xmppErrorBuilder) {
|
public ErrorIQ(StanzaError.Builder xmppErrorBuilder) {
|
||||||
super(ELEMENT, null);
|
super(ELEMENT, null);
|
||||||
Objects.requireNonNull(xmppErrorBuilder, "xmppErrorBuilder must not be null");
|
Objects.requireNonNull(xmppErrorBuilder, "xmppErrorBuilder must not be null");
|
||||||
setType(IQ.Type.error);
|
setType(IQ.Type.error);
|
||||||
|
|
|
@ -263,7 +263,7 @@ public abstract class IQ extends Stanza {
|
||||||
* <li>The type set to {@link Type#error IQ.Type.error}.
|
* <li>The type set to {@link Type#error IQ.Type.error}.
|
||||||
* <li>The id set to the id of the originating IQ.
|
* <li>The id set to the id of the originating IQ.
|
||||||
* <li>The child element contained in the associated originating IQ.
|
* <li>The child element contained in the associated originating IQ.
|
||||||
* <li>The provided {@link XMPPError XMPPError}.
|
* <li>The provided {@link StanzaError XMPPError}.
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @param request the {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set} IQ packet.
|
* @param request the {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set} IQ packet.
|
||||||
|
@ -272,7 +272,7 @@ public abstract class IQ extends Stanza {
|
||||||
* {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set}.
|
* {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set}.
|
||||||
* @return a new {@link Type#error IQ.Type.error} IQ based on the originating IQ.
|
* @return a new {@link Type#error IQ.Type.error} IQ based on the originating IQ.
|
||||||
*/
|
*/
|
||||||
public static ErrorIQ createErrorResponse(final IQ request, final XMPPError.Builder error) {
|
public static ErrorIQ createErrorResponse(final IQ request, final StanzaError.Builder error) {
|
||||||
if (!(request.getType() == Type.get || request.getType() == Type.set)) {
|
if (!(request.getType() == Type.get || request.getType() == Type.set)) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
|
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
|
||||||
|
@ -287,8 +287,8 @@ public abstract class IQ extends Stanza {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ErrorIQ createErrorResponse(final IQ request, final XMPPError.Condition condition) {
|
public static ErrorIQ createErrorResponse(final IQ request, final StanzaError.Condition condition) {
|
||||||
return createErrorResponse(request, XMPPError.getBuilder(condition));
|
return createErrorResponse(request, StanzaError.getBuilder(condition));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -300,7 +300,7 @@ public abstract class IQ extends Stanza {
|
||||||
* <li>The type set to {@link Type#error IQ.Type.error}.
|
* <li>The type set to {@link Type#error IQ.Type.error}.
|
||||||
* <li>The id set to the id of the originating IQ.
|
* <li>The id set to the id of the originating IQ.
|
||||||
* <li>The child element contained in the associated originating IQ.
|
* <li>The child element contained in the associated originating IQ.
|
||||||
* <li>The provided {@link XMPPError XMPPError}.
|
* <li>The provided {@link StanzaError XMPPError}.
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @param request the {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set} IQ packet.
|
* @param request the {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set} IQ packet.
|
||||||
|
@ -309,8 +309,8 @@ public abstract class IQ extends Stanza {
|
||||||
* {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set}.
|
* {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set}.
|
||||||
* @return a new {@link Type#error IQ.Type.error} IQ based on the originating IQ.
|
* @return a new {@link Type#error IQ.Type.error} IQ based on the originating IQ.
|
||||||
*/
|
*/
|
||||||
public static ErrorIQ createErrorResponse(final IQ request, final XMPPError error) {
|
public static ErrorIQ createErrorResponse(final IQ request, final StanzaError error) {
|
||||||
return createErrorResponse(request, XMPPError.getBuilder(error));
|
return createErrorResponse(request, StanzaError.getBuilder(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -105,13 +105,13 @@ public interface Packet extends TopLevelStreamElement {
|
||||||
*
|
*
|
||||||
* @return the error sub-packet or <tt>null</tt> if there isn't an error.
|
* @return the error sub-packet or <tt>null</tt> if there isn't an error.
|
||||||
*/
|
*/
|
||||||
XMPPError getError();
|
StanzaError getError();
|
||||||
/**
|
/**
|
||||||
* Sets the error for this packet.
|
* Sets the error for this packet.
|
||||||
*
|
*
|
||||||
* @param error the error to associate with this packet.
|
* @param error the error to associate with this packet.
|
||||||
*/
|
*/
|
||||||
void setError(XMPPError error);
|
void setError(StanzaError error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the xml:lang of this Stanza, or null if one has not been set.
|
* Returns the xml:lang of this Stanza, or null if one has not been set.
|
||||||
|
|
|
@ -61,7 +61,7 @@ public abstract class Stanza implements TopLevelStreamElement {
|
||||||
private String id = null;
|
private String id = null;
|
||||||
private Jid to;
|
private Jid to;
|
||||||
private Jid from;
|
private Jid from;
|
||||||
private XMPPError error = null;
|
private StanzaError error = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional value of the 'xml:lang' attribute of the outermost element of
|
* Optional value of the 'xml:lang' attribute of the outermost element of
|
||||||
|
@ -254,7 +254,7 @@ public abstract class Stanza implements TopLevelStreamElement {
|
||||||
*
|
*
|
||||||
* @return the error sub-packet or <tt>null</tt> if there isn't an error.
|
* @return the error sub-packet or <tt>null</tt> if there isn't an error.
|
||||||
*/
|
*/
|
||||||
public XMPPError getError() {
|
public StanzaError getError() {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,10 +262,10 @@ public abstract class Stanza implements TopLevelStreamElement {
|
||||||
* Sets the error for this packet.
|
* Sets the error for this packet.
|
||||||
*
|
*
|
||||||
* @param error the error to associate with this packet.
|
* @param error the error to associate with this packet.
|
||||||
* @deprecated use {@link #setError(org.jivesoftware.smack.packet.XMPPError.Builder)} instead.
|
* @deprecated use {@link #setError(org.jivesoftware.smack.packet.StanzaError.Builder)} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void setError(XMPPError error) {
|
public void setError(StanzaError error) {
|
||||||
this.error = error;
|
this.error = error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ public abstract class Stanza implements TopLevelStreamElement {
|
||||||
*
|
*
|
||||||
* @param xmppErrorBuilder the error to associate with this stanza.
|
* @param xmppErrorBuilder the error to associate with this stanza.
|
||||||
*/
|
*/
|
||||||
public void setError(XMPPError.Builder xmppErrorBuilder) {
|
public void setError(StanzaError.Builder xmppErrorBuilder) {
|
||||||
if (xmppErrorBuilder == null) {
|
if (xmppErrorBuilder == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -534,7 +534,7 @@ public abstract class Stanza implements TopLevelStreamElement {
|
||||||
* @param xml the XmlStringBuilder to append the error to.
|
* @param xml the XmlStringBuilder to append the error to.
|
||||||
*/
|
*/
|
||||||
protected void appendErrorIfExists(XmlStringBuilder xml) {
|
protected void appendErrorIfExists(XmlStringBuilder xml) {
|
||||||
XMPPError error = getError();
|
StanzaError error = getError();
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
xml.append(error.toXML());
|
xml.append(error.toXML());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2003-2007 Jive Software, 2015-2017 Florian Schmaus
|
* Copyright 2003-2007 Jive Software, 2015-2018 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -61,14 +61,13 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
* @author Matt Tucker
|
* @author Matt Tucker
|
||||||
* @see <a href="http://xmpp.org/rfcs/rfc6120.html#stanzas-error-syntax">RFC 6120 - 8.3.2 Syntax: The Syntax of XMPP error stanzas</a>
|
* @see <a href="http://xmpp.org/rfcs/rfc6120.html#stanzas-error-syntax">RFC 6120 - 8.3.2 Syntax: The Syntax of XMPP error stanzas</a>
|
||||||
*/
|
*/
|
||||||
// TODO Rename this class to StanzaError (RFC 6120 § 8.3) in Smack 4.3, as this is what this class actually is. SMACK-769
|
|
||||||
// TODO Use StanzaErrorTextElement here.
|
// TODO Use StanzaErrorTextElement here.
|
||||||
public class XMPPError extends AbstractError {
|
public class StanzaError extends AbstractError {
|
||||||
|
|
||||||
public static final String NAMESPACE = "urn:ietf:params:xml:ns:xmpp-stanzas";
|
public static final String NAMESPACE = "urn:ietf:params:xml:ns:xmpp-stanzas";
|
||||||
public static final String ERROR = "error";
|
public static final String ERROR = "error";
|
||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(XMPPError.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(StanzaError.class.getName());
|
||||||
static final Map<Condition, Type> CONDITION_TO_TYPE = new HashMap<Condition, Type>();
|
static final Map<Condition, Type> CONDITION_TO_TYPE = new HashMap<Condition, Type>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -116,7 +115,7 @@ public class XMPPError extends AbstractError {
|
||||||
* @param extensions list of stanza extensions
|
* @param extensions list of stanza extensions
|
||||||
* @param stanza the stanza carrying this XMPP error.
|
* @param stanza the stanza carrying this XMPP error.
|
||||||
*/
|
*/
|
||||||
public XMPPError(Condition condition, String conditionText, String errorGenerator, Type type, Map<String, String> descriptiveTexts,
|
public StanzaError(Condition condition, String conditionText, String errorGenerator, Type type, Map<String, String> descriptiveTexts,
|
||||||
List<ExtensionElement> extensions, Stanza stanza) {
|
List<ExtensionElement> extensions, Stanza stanza) {
|
||||||
super(descriptiveTexts, NAMESPACE, extensions);
|
super(descriptiveTexts, NAMESPACE, extensions);
|
||||||
this.condition = Objects.requireNonNull(condition, "condition must not be null");
|
this.condition = Objects.requireNonNull(condition, "condition must not be null");
|
||||||
|
@ -227,8 +226,8 @@ public class XMPPError extends AbstractError {
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XMPPError.Builder from(Condition condition, String descriptiveText) {
|
public static StanzaError.Builder from(Condition condition, String descriptiveText) {
|
||||||
XMPPError.Builder builder = getBuilder().setCondition(condition);
|
StanzaError.Builder builder = getBuilder().setCondition(condition);
|
||||||
if (descriptiveText != null) {
|
if (descriptiveText != null) {
|
||||||
Map<String, String> descriptiveTexts = new HashMap<>();
|
Map<String, String> descriptiveTexts = new HashMap<>();
|
||||||
descriptiveTexts.put("en", descriptiveText);
|
descriptiveTexts.put("en", descriptiveText);
|
||||||
|
@ -245,7 +244,7 @@ public class XMPPError extends AbstractError {
|
||||||
return getBuilder().setCondition(condition);
|
return getBuilder().setCondition(condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Builder getBuilder(XMPPError xmppError) {
|
public static Builder getBuilder(StanzaError xmppError) {
|
||||||
return getBuilder().copyFrom(xmppError);
|
return getBuilder().copyFrom(xmppError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,7 +283,7 @@ public class XMPPError extends AbstractError {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder copyFrom(XMPPError xmppError) {
|
public Builder copyFrom(StanzaError xmppError) {
|
||||||
setCondition(xmppError.getCondition());
|
setCondition(xmppError.getCondition());
|
||||||
setType(xmppError.getType());
|
setType(xmppError.getType());
|
||||||
setConditionText(xmppError.getConditionText());
|
setConditionText(xmppError.getConditionText());
|
||||||
|
@ -296,8 +295,8 @@ public class XMPPError extends AbstractError {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XMPPError build() {
|
public StanzaError build() {
|
||||||
return new XMPPError(condition, conditionText, errorGenerator, type, descriptiveTexts,
|
return new StanzaError(condition, conditionText, errorGenerator, type, descriptiveTexts,
|
||||||
extensions, stanza);
|
extensions, stanza);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smack.packet;
|
||||||
|
|
||||||
public class StanzaErrorTextElement extends AbstractTextElement {
|
public class StanzaErrorTextElement extends AbstractTextElement {
|
||||||
|
|
||||||
public static final String NAMESPACE = XMPPError.NAMESPACE;
|
public static final String NAMESPACE = StanzaError.NAMESPACE;
|
||||||
|
|
||||||
public StanzaErrorTextElement(String text, String lang) {
|
public StanzaErrorTextElement(String text, String lang) {
|
||||||
super(text, lang);
|
super(text, lang);
|
||||||
|
|
|
@ -37,10 +37,10 @@ import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.packet.Session;
|
import org.jivesoftware.smack.packet.Session;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smack.packet.StartTls;
|
import org.jivesoftware.smack.packet.StartTls;
|
||||||
import org.jivesoftware.smack.packet.StreamError;
|
import org.jivesoftware.smack.packet.StreamError;
|
||||||
import org.jivesoftware.smack.packet.UnparsedIQ;
|
import org.jivesoftware.smack.packet.UnparsedIQ;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
|
||||||
import org.jivesoftware.smack.parsing.StandardExtensionElementProvider;
|
import org.jivesoftware.smack.parsing.StandardExtensionElementProvider;
|
||||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
import org.jivesoftware.smack.provider.IQProvider;
|
import org.jivesoftware.smack.provider.IQProvider;
|
||||||
|
@ -607,7 +607,7 @@ public class PacketParserUtils {
|
||||||
ParserUtils.assertAtStartTag(parser);
|
ParserUtils.assertAtStartTag(parser);
|
||||||
final int initialDepth = parser.getDepth();
|
final int initialDepth = parser.getDepth();
|
||||||
IQ iqPacket = null;
|
IQ iqPacket = null;
|
||||||
XMPPError.Builder error = null;
|
StanzaError.Builder error = null;
|
||||||
|
|
||||||
final String id = parser.getAttributeValue("", "id");
|
final String id = parser.getAttributeValue("", "id");
|
||||||
final Jid to = ParserUtils.getJidAttribute(parser, "to");
|
final Jid to = ParserUtils.getJidAttribute(parser, "to");
|
||||||
|
@ -854,15 +854,15 @@ public class PacketParserUtils {
|
||||||
* @return an error sub-packet.
|
* @return an error sub-packet.
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static XMPPError.Builder parseError(XmlPullParser parser)
|
public static StanzaError.Builder parseError(XmlPullParser parser)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
final int initialDepth = parser.getDepth();
|
final int initialDepth = parser.getDepth();
|
||||||
Map<String, String> descriptiveTexts = null;
|
Map<String, String> descriptiveTexts = null;
|
||||||
List<ExtensionElement> extensions = new ArrayList<>();
|
List<ExtensionElement> extensions = new ArrayList<>();
|
||||||
XMPPError.Builder builder = XMPPError.getBuilder();
|
StanzaError.Builder builder = StanzaError.getBuilder();
|
||||||
|
|
||||||
// Parse the error header
|
// Parse the error header
|
||||||
builder.setType(XMPPError.Type.fromString(parser.getAttributeValue("", "type")));
|
builder.setType(StanzaError.Type.fromString(parser.getAttributeValue("", "type")));
|
||||||
builder.setErrorGenerator(parser.getAttributeValue("", "by"));
|
builder.setErrorGenerator(parser.getAttributeValue("", "by"));
|
||||||
|
|
||||||
outerloop: while (true) {
|
outerloop: while (true) {
|
||||||
|
@ -872,13 +872,13 @@ public class PacketParserUtils {
|
||||||
String name = parser.getName();
|
String name = parser.getName();
|
||||||
String namespace = parser.getNamespace();
|
String namespace = parser.getNamespace();
|
||||||
switch (namespace) {
|
switch (namespace) {
|
||||||
case XMPPError.NAMESPACE:
|
case StanzaError.NAMESPACE:
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case Stanza.TEXT:
|
case Stanza.TEXT:
|
||||||
descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts);
|
descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
builder.setCondition(XMPPError.Condition.fromString(name));
|
builder.setCondition(StanzaError.Condition.fromString(name));
|
||||||
if (!parser.isEmptyElementTag()) {
|
if (!parser.isEmptyElementTag()) {
|
||||||
builder.setConditionText(parser.nextText());
|
builder.setConditionText(parser.nextText());
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class IQResponseTest {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGeneratingValidErrorResponse() throws XmppStringprepException {
|
public void testGeneratingValidErrorResponse() throws XmppStringprepException {
|
||||||
final XMPPError.Builder error = XMPPError.getBuilder(XMPPError.Condition.bad_request);
|
final StanzaError.Builder error = StanzaError.getBuilder(StanzaError.Condition.bad_request);
|
||||||
final IQ request = new TestIQ(ELEMENT, NAMESPACE);
|
final IQ request = new TestIQ(ELEMENT, NAMESPACE);
|
||||||
|
|
||||||
request.setType(IQ.Type.set);
|
request.setType(IQ.Type.set);
|
||||||
|
@ -110,7 +110,7 @@ public class IQResponseTest {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGeneratingErrorBasedOnError() throws XmppStringprepException {
|
public void testGeneratingErrorBasedOnError() throws XmppStringprepException {
|
||||||
final XMPPError.Builder error = XMPPError.getBuilder(XMPPError.Condition.bad_request);
|
final StanzaError.Builder error = StanzaError.getBuilder(StanzaError.Condition.bad_request);
|
||||||
final IQ request = new TestIQ(ELEMENT, NAMESPACE);
|
final IQ request = new TestIQ(ELEMENT, NAMESPACE);
|
||||||
|
|
||||||
request.setType(IQ.Type.error);
|
request.setType(IQ.Type.error);
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smack.packet;
|
package org.jivesoftware.smack.packet;
|
||||||
|
|
||||||
import static org.jivesoftware.smack.packet.XMPPError.Condition;
|
import static org.jivesoftware.smack.packet.StanzaError.Condition;
|
||||||
import static org.jivesoftware.smack.packet.XMPPError.Type;
|
import static org.jivesoftware.smack.packet.StanzaError.Type;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -27,7 +27,7 @@ import org.junit.Test;
|
||||||
public class XMPPErrorTest {
|
public class XMPPErrorTest {
|
||||||
@Test
|
@Test
|
||||||
public void testConditionHasDefaultTypeMapping() throws NoSuchFieldException, IllegalAccessException {
|
public void testConditionHasDefaultTypeMapping() throws NoSuchFieldException, IllegalAccessException {
|
||||||
Map<Condition, Type> conditionToTypeMap = XMPPError.CONDITION_TO_TYPE;
|
Map<Condition, Type> conditionToTypeMap = StanzaError.CONDITION_TO_TYPE;
|
||||||
assertEquals("CONDITION_TO_TYPE map is likely out of sync with Condition enum",
|
assertEquals("CONDITION_TO_TYPE map is likely out of sync with Condition enum",
|
||||||
Condition.values().length,
|
Condition.values().length,
|
||||||
conditionToTypeMap.size());
|
conditionToTypeMap.size());
|
||||||
|
|
|
@ -37,7 +37,7 @@ import javax.xml.transform.TransformerException;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smack.sasl.SASLError;
|
import org.jivesoftware.smack.sasl.SASLError;
|
||||||
import org.jivesoftware.smack.sasl.packet.SaslStreamElements;
|
import org.jivesoftware.smack.sasl.packet.SaslStreamElements;
|
||||||
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.SASLFailure;
|
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.SASLFailure;
|
||||||
|
@ -875,8 +875,8 @@ public class PacketParserUtilsTest {
|
||||||
final String text = "Dummy descriptive text";
|
final String text = "Dummy descriptive text";
|
||||||
Map<String, String> texts = new HashMap<>();
|
Map<String, String> texts = new HashMap<>();
|
||||||
texts.put(null, text);
|
texts.put(null, text);
|
||||||
XMPPError
|
StanzaError
|
||||||
.getBuilder(XMPPError.Condition.internal_server_error)
|
.getBuilder(StanzaError.Condition.internal_server_error)
|
||||||
.setDescriptiveTexts(texts)
|
.setDescriptiveTexts(texts)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
@ -886,14 +886,14 @@ public class PacketParserUtilsTest {
|
||||||
final String text = "Dummy descriptive text";
|
final String text = "Dummy descriptive text";
|
||||||
Map<String, String> texts = new HashMap<>();
|
Map<String, String> texts = new HashMap<>();
|
||||||
texts.put("", text);
|
texts.put("", text);
|
||||||
XMPPError error = XMPPError
|
StanzaError error = StanzaError
|
||||||
.getBuilder(XMPPError.Condition.internal_server_error)
|
.getBuilder(StanzaError.Condition.internal_server_error)
|
||||||
.setDescriptiveTexts(texts)
|
.setDescriptiveTexts(texts)
|
||||||
.build();
|
.build();
|
||||||
final String errorXml = XMLBuilder
|
final String errorXml = XMLBuilder
|
||||||
.create(XMPPError.ERROR).a("type", "cancel").up()
|
.create(StanzaError.ERROR).a("type", "cancel").up()
|
||||||
.element("internal-server-error", XMPPError.NAMESPACE).up()
|
.element("internal-server-error", StanzaError.NAMESPACE).up()
|
||||||
.element("text", XMPPError.NAMESPACE).t(text).up()
|
.element("text", StanzaError.NAMESPACE).t(text).up()
|
||||||
.asString();
|
.asString();
|
||||||
XmlUnitUtils.assertSimilar(errorXml, error.toXML());
|
XmlUnitUtils.assertSimilar(errorXml, error.toXML());
|
||||||
}
|
}
|
||||||
|
@ -902,12 +902,12 @@ public class PacketParserUtilsTest {
|
||||||
public void ensureNoNullLangInParsedDescriptiveTexts() throws Exception {
|
public void ensureNoNullLangInParsedDescriptiveTexts() throws Exception {
|
||||||
final String text = "Dummy descriptive text";
|
final String text = "Dummy descriptive text";
|
||||||
final String errorXml = XMLBuilder
|
final String errorXml = XMLBuilder
|
||||||
.create(XMPPError.ERROR).a("type", "cancel").up()
|
.create(StanzaError.ERROR).a("type", "cancel").up()
|
||||||
.element("internal-server-error", XMPPError.NAMESPACE).up()
|
.element("internal-server-error", StanzaError.NAMESPACE).up()
|
||||||
.element("text", XMPPError.NAMESPACE).t(text).up()
|
.element("text", StanzaError.NAMESPACE).t(text).up()
|
||||||
.asString();
|
.asString();
|
||||||
XmlPullParser parser = TestUtils.getParser(errorXml);
|
XmlPullParser parser = TestUtils.getParser(errorXml);
|
||||||
XMPPError error = PacketParserUtils.parseError(parser).build();
|
StanzaError error = PacketParserUtils.parseError(parser).build();
|
||||||
assertEquals(text, error.getDescriptiveText());
|
assertEquals(text, error.getDescriptiveText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smackx.httpfileupload.element;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,7 +67,7 @@ public class FileTooLargeError implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FileTooLargeError from(IQ iq) {
|
public static FileTooLargeError from(IQ iq) {
|
||||||
XMPPError error = iq.getError();
|
StanzaError error = iq.getError();
|
||||||
if (error == null) {
|
if (error == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smackx.blocking.element;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.blocking.BlockingCommandManager;
|
import org.jivesoftware.smackx.blocking.BlockingCommandManager;
|
||||||
|
@ -53,7 +53,7 @@ public class BlockedErrorExtension implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockedErrorExtension from(Message message) {
|
public static BlockedErrorExtension from(Message message) {
|
||||||
XMPPError error = message.getError();
|
StanzaError error = message.getError();
|
||||||
if (error == null) {
|
if (error == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.jivesoftware.smack.XMPPConnectionRegistry;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.bytestreams.BytestreamListener;
|
import org.jivesoftware.smackx.bytestreams.BytestreamListener;
|
||||||
import org.jivesoftware.smackx.bytestreams.BytestreamManager;
|
import org.jivesoftware.smackx.bytestreams.BytestreamManager;
|
||||||
|
@ -452,7 +452,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
protected void replyRejectPacket(IQ request) throws NotConnectedException, InterruptedException {
|
protected void replyRejectPacket(IQ request) throws NotConnectedException, InterruptedException {
|
||||||
IQ error = IQ.createErrorResponse(request, XMPPError.Condition.not_acceptable);
|
IQ error = IQ.createErrorResponse(request, StanzaError.Condition.not_acceptable);
|
||||||
connection().sendStanza(error);
|
connection().sendStanza(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
protected void replyResourceConstraintPacket(IQ request) throws NotConnectedException, InterruptedException {
|
protected void replyResourceConstraintPacket(IQ request) throws NotConnectedException, InterruptedException {
|
||||||
IQ error = IQ.createErrorResponse(request, XMPPError.Condition.resource_constraint);
|
IQ error = IQ.createErrorResponse(request, StanzaError.Condition.resource_constraint);
|
||||||
connection().sendStanza(error);
|
connection().sendStanza(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,7 +478,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
protected void replyItemNotFoundPacket(IQ request) throws NotConnectedException, InterruptedException {
|
protected void replyItemNotFoundPacket(IQ request) throws NotConnectedException, InterruptedException {
|
||||||
IQ error = IQ.createErrorResponse(request, XMPPError.Condition.item_not_found);
|
IQ error = IQ.createErrorResponse(request, StanzaError.Condition.item_not_found);
|
||||||
connection().sendStanza(error);
|
connection().sendStanza(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.jivesoftware.smack.filter.StanzaTypeFilter;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smack.util.stringencoder.Base64;
|
import org.jivesoftware.smack.util.stringencoder.Base64;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
|
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
|
||||||
|
@ -476,7 +476,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
||||||
*/
|
*/
|
||||||
if (data.getSeq() <= this.lastSequence) {
|
if (data.getSeq() <= this.lastSequence) {
|
||||||
IQ unexpectedRequest = IQ.createErrorResponse((IQ) packet,
|
IQ unexpectedRequest = IQ.createErrorResponse((IQ) packet,
|
||||||
XMPPError.Condition.unexpected_request);
|
StanzaError.Condition.unexpected_request);
|
||||||
connection.sendStanza(unexpectedRequest);
|
connection.sendStanza(unexpectedRequest);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -486,7 +486,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
||||||
if (data.getDecodedData() == null) {
|
if (data.getDecodedData() == null) {
|
||||||
// data is invalid; respond with bad-request error
|
// data is invalid; respond with bad-request error
|
||||||
IQ badRequest = IQ.createErrorResponse((IQ) packet,
|
IQ badRequest = IQ.createErrorResponse((IQ) packet,
|
||||||
XMPPError.Condition.bad_request);
|
StanzaError.Condition.bad_request);
|
||||||
connection.sendStanza(badRequest);
|
connection.sendStanza(badRequest);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.bytestreams.BytestreamListener;
|
import org.jivesoftware.smackx.bytestreams.BytestreamListener;
|
||||||
import org.jivesoftware.smackx.bytestreams.BytestreamManager;
|
import org.jivesoftware.smackx.bytestreams.BytestreamManager;
|
||||||
|
@ -699,7 +699,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
protected void replyRejectPacket(IQ packet) throws NotConnectedException, InterruptedException {
|
protected void replyRejectPacket(IQ packet) throws NotConnectedException, InterruptedException {
|
||||||
XMPPError.Builder xmppError = XMPPError.getBuilder(XMPPError.Condition.not_acceptable);
|
StanzaError.Builder xmppError = StanzaError.getBuilder(StanzaError.Condition.not_acceptable);
|
||||||
IQ errorIQ = IQ.createErrorResponse(packet, xmppError);
|
IQ errorIQ = IQ.createErrorResponse(packet, xmppError);
|
||||||
connection().sendStanza(errorIQ);
|
connection().sendStanza(errorIQ);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.bytestreams.BytestreamRequest;
|
import org.jivesoftware.smackx.bytestreams.BytestreamRequest;
|
||||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
||||||
|
@ -283,7 +283,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
||||||
*/
|
*/
|
||||||
private void cancelRequest() throws XMPPErrorException, NotConnectedException, InterruptedException {
|
private void cancelRequest() throws XMPPErrorException, NotConnectedException, InterruptedException {
|
||||||
String errorMessage = "Could not establish socket with any provided host";
|
String errorMessage = "Could not establish socket with any provided host";
|
||||||
XMPPError.Builder error = XMPPError.from(XMPPError.Condition.item_not_found, errorMessage);
|
StanzaError.Builder error = StanzaError.from(StanzaError.Condition.item_not_found, errorMessage);
|
||||||
IQ errorIQ = IQ.createErrorResponse(this.bytestreamRequest, error);
|
IQ errorIQ = IQ.createErrorResponse(this.bytestreamRequest, error);
|
||||||
this.manager.getConnection().sendStanza(errorIQ);
|
this.manager.getConnection().sendStanza(errorIQ);
|
||||||
throw new XMPPErrorException(errorIQ, error.build());
|
throw new XMPPErrorException(errorIQ, error.build());
|
||||||
|
|
|
@ -21,7 +21,7 @@ import java.util.List;
|
||||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.commands.packet.AdHocCommandData;
|
import org.jivesoftware.smackx.commands.packet.AdHocCommandData;
|
||||||
import org.jivesoftware.smackx.xdata.Form;
|
import org.jivesoftware.smackx.xdata.Form;
|
||||||
|
@ -94,7 +94,7 @@ public abstract class AdHocCommand {
|
||||||
* @return the specific condition of this error, or null if it doesn't have
|
* @return the specific condition of this error, or null if it doesn't have
|
||||||
* any.
|
* any.
|
||||||
*/
|
*/
|
||||||
public static SpecificErrorCondition getSpecificErrorCondition(XMPPError error) {
|
public static SpecificErrorCondition getSpecificErrorCondition(StanzaError error) {
|
||||||
// This method is implemented to provide an easy way of getting a packet
|
// This method is implemented to provide an easy way of getting a packet
|
||||||
// extension of the XMPPError.
|
// extension of the XMPPError.
|
||||||
for (SpecificErrorCondition condition : SpecificErrorCondition.values()) {
|
for (SpecificErrorCondition condition : SpecificErrorCondition.values()) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
|
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
|
||||||
import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.commands.AdHocCommand.Action;
|
import org.jivesoftware.smackx.commands.AdHocCommand.Action;
|
||||||
|
@ -349,7 +349,7 @@ public final class AdHocCommandManager extends Manager {
|
||||||
if (!commands.containsKey(commandNode)) {
|
if (!commands.containsKey(commandNode)) {
|
||||||
// Requested command does not exist so return
|
// Requested command does not exist so return
|
||||||
// item_not_found error.
|
// item_not_found error.
|
||||||
return respondError(response, XMPPError.Condition.item_not_found);
|
return respondError(response, StanzaError.Condition.item_not_found);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new session ID
|
// Create new session ID
|
||||||
|
@ -364,7 +364,7 @@ public final class AdHocCommandManager extends Manager {
|
||||||
}
|
}
|
||||||
catch (InstantiationException | IllegalAccessException | IllegalArgumentException
|
catch (InstantiationException | IllegalAccessException | IllegalArgumentException
|
||||||
| InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
| InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
||||||
XMPPError.Builder xmppError = XMPPError.getBuilder().setCondition(XMPPError.Condition.internal_server_error).setDescriptiveEnText(e.getMessage());
|
StanzaError.Builder xmppError = StanzaError.getBuilder().setCondition(StanzaError.Condition.internal_server_error).setDescriptiveEnText(e.getMessage());
|
||||||
return respondError(response, xmppError);
|
return respondError(response, xmppError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,20 +375,20 @@ public final class AdHocCommandManager extends Manager {
|
||||||
// Answer forbidden error if requester permissions are not
|
// Answer forbidden error if requester permissions are not
|
||||||
// enough to execute the requested command
|
// enough to execute the requested command
|
||||||
if (!command.hasPermission(requestData.getFrom())) {
|
if (!command.hasPermission(requestData.getFrom())) {
|
||||||
return respondError(response, XMPPError.Condition.forbidden);
|
return respondError(response, StanzaError.Condition.forbidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
Action action = requestData.getAction();
|
Action action = requestData.getAction();
|
||||||
|
|
||||||
// If the action is unknown then respond an error.
|
// If the action is unknown then respond an error.
|
||||||
if (action != null && action.equals(Action.unknown)) {
|
if (action != null && action.equals(Action.unknown)) {
|
||||||
return respondError(response, XMPPError.Condition.bad_request,
|
return respondError(response, StanzaError.Condition.bad_request,
|
||||||
AdHocCommand.SpecificErrorCondition.malformedAction);
|
AdHocCommand.SpecificErrorCondition.malformedAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the action is not execute, then it is an invalid action.
|
// If the action is not execute, then it is an invalid action.
|
||||||
if (action != null && !action.equals(Action.execute)) {
|
if (action != null && !action.equals(Action.execute)) {
|
||||||
return respondError(response, XMPPError.Condition.bad_request,
|
return respondError(response, StanzaError.Condition.bad_request,
|
||||||
AdHocCommand.SpecificErrorCondition.badAction);
|
AdHocCommand.SpecificErrorCondition.badAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,16 +460,16 @@ public final class AdHocCommandManager extends Manager {
|
||||||
// If there is an exception caused by the next, complete,
|
// If there is an exception caused by the next, complete,
|
||||||
// prev or cancel method, then that error is returned to the
|
// prev or cancel method, then that error is returned to the
|
||||||
// requester.
|
// requester.
|
||||||
XMPPError error = e.getXMPPError();
|
StanzaError error = e.getXMPPError();
|
||||||
|
|
||||||
// If the error type is cancel, then the execution is
|
// If the error type is cancel, then the execution is
|
||||||
// canceled therefore the status must show that, and the
|
// canceled therefore the status must show that, and the
|
||||||
// command be removed from the executing list.
|
// command be removed from the executing list.
|
||||||
if (XMPPError.Type.CANCEL.equals(error.getType())) {
|
if (StanzaError.Type.CANCEL.equals(error.getType())) {
|
||||||
response.setStatus(Status.canceled);
|
response.setStatus(Status.canceled);
|
||||||
executingCommands.remove(sessionId);
|
executingCommands.remove(sessionId);
|
||||||
}
|
}
|
||||||
return respondError(response, XMPPError.getBuilder(error));
|
return respondError(response, StanzaError.getBuilder(error));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -479,7 +479,7 @@ public final class AdHocCommandManager extends Manager {
|
||||||
// This also handles if the command was removed in the meanwhile
|
// This also handles if the command was removed in the meanwhile
|
||||||
// of getting the key and the value of the map.
|
// of getting the key and the value of the map.
|
||||||
if (command == null) {
|
if (command == null) {
|
||||||
return respondError(response, XMPPError.Condition.bad_request,
|
return respondError(response, StanzaError.Condition.bad_request,
|
||||||
AdHocCommand.SpecificErrorCondition.badSessionid);
|
AdHocCommand.SpecificErrorCondition.badSessionid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,7 +490,7 @@ public final class AdHocCommandManager extends Manager {
|
||||||
executingCommands.remove(sessionId);
|
executingCommands.remove(sessionId);
|
||||||
|
|
||||||
// Answer a not_allowed error (session-expired)
|
// Answer a not_allowed error (session-expired)
|
||||||
return respondError(response, XMPPError.Condition.not_allowed,
|
return respondError(response, StanzaError.Condition.not_allowed,
|
||||||
AdHocCommand.SpecificErrorCondition.sessionExpired);
|
AdHocCommand.SpecificErrorCondition.sessionExpired);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,7 +504,7 @@ public final class AdHocCommandManager extends Manager {
|
||||||
|
|
||||||
// If the action is unknown the respond an error
|
// If the action is unknown the respond an error
|
||||||
if (action != null && action.equals(Action.unknown)) {
|
if (action != null && action.equals(Action.unknown)) {
|
||||||
return respondError(response, XMPPError.Condition.bad_request,
|
return respondError(response, StanzaError.Condition.bad_request,
|
||||||
AdHocCommand.SpecificErrorCondition.malformedAction);
|
AdHocCommand.SpecificErrorCondition.malformedAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,7 +517,7 @@ public final class AdHocCommandManager extends Manager {
|
||||||
// Check that the specified action was previously
|
// Check that the specified action was previously
|
||||||
// offered
|
// offered
|
||||||
if (!command.isValidAction(action)) {
|
if (!command.isValidAction(action)) {
|
||||||
return respondError(response, XMPPError.Condition.bad_request,
|
return respondError(response, StanzaError.Condition.bad_request,
|
||||||
AdHocCommand.SpecificErrorCondition.badAction);
|
AdHocCommand.SpecificErrorCondition.badAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,16 +570,16 @@ public final class AdHocCommandManager extends Manager {
|
||||||
// If there is an exception caused by the next, complete,
|
// If there is an exception caused by the next, complete,
|
||||||
// prev or cancel method, then that error is returned to the
|
// prev or cancel method, then that error is returned to the
|
||||||
// requester.
|
// requester.
|
||||||
XMPPError error = e.getXMPPError();
|
StanzaError error = e.getXMPPError();
|
||||||
|
|
||||||
// If the error type is cancel, then the execution is
|
// If the error type is cancel, then the execution is
|
||||||
// canceled therefore the status must show that, and the
|
// canceled therefore the status must show that, and the
|
||||||
// command be removed from the executing list.
|
// command be removed from the executing list.
|
||||||
if (XMPPError.Type.CANCEL.equals(error.getType())) {
|
if (StanzaError.Type.CANCEL.equals(error.getType())) {
|
||||||
response.setStatus(Status.canceled);
|
response.setStatus(Status.canceled);
|
||||||
executingCommands.remove(sessionId);
|
executingCommands.remove(sessionId);
|
||||||
}
|
}
|
||||||
return respondError(response, XMPPError.getBuilder(error));
|
return respondError(response, StanzaError.getBuilder(error));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -593,8 +593,8 @@ public final class AdHocCommandManager extends Manager {
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
*/
|
*/
|
||||||
private static IQ respondError(AdHocCommandData response,
|
private static IQ respondError(AdHocCommandData response,
|
||||||
XMPPError.Condition condition) {
|
StanzaError.Condition condition) {
|
||||||
return respondError(response, XMPPError.getBuilder(condition));
|
return respondError(response, StanzaError.getBuilder(condition));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -605,9 +605,9 @@ public final class AdHocCommandManager extends Manager {
|
||||||
* @param specificCondition the adhoc command error condition.
|
* @param specificCondition the adhoc command error condition.
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
*/
|
*/
|
||||||
private static IQ respondError(AdHocCommandData response, XMPPError.Condition condition,
|
private static IQ respondError(AdHocCommandData response, StanzaError.Condition condition,
|
||||||
AdHocCommand.SpecificErrorCondition specificCondition) {
|
AdHocCommand.SpecificErrorCondition specificCondition) {
|
||||||
XMPPError.Builder error = XMPPError.getBuilder(condition).addExtension(new AdHocCommandData.SpecificError(specificCondition));
|
StanzaError.Builder error = StanzaError.getBuilder(condition).addExtension(new AdHocCommandData.SpecificError(specificCondition));
|
||||||
return respondError(response, error);
|
return respondError(response, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,7 +618,7 @@ public final class AdHocCommandManager extends Manager {
|
||||||
* @param error the error to send.
|
* @param error the error to send.
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
*/
|
*/
|
||||||
private static IQ respondError(AdHocCommandData response, XMPPError.Builder error) {
|
private static IQ respondError(AdHocCommandData response, StanzaError.Builder error) {
|
||||||
response.setType(IQ.Type.error);
|
response.setType(IQ.Type.error);
|
||||||
response.setError(error);
|
response.setError(error);
|
||||||
return response;
|
return response;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package org.jivesoftware.smackx.commands.provider;
|
package org.jivesoftware.smackx.commands.provider;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
import org.jivesoftware.smack.provider.IQProvider;
|
import org.jivesoftware.smack.provider.IQProvider;
|
||||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
|
@ -109,7 +109,7 @@ public class AdHocCommandDataProvider extends IQProvider<AdHocCommandData> {
|
||||||
adHocCommandData.addNote(new AdHocCommandNote(type, value));
|
adHocCommandData.addNote(new AdHocCommandNote(type, value));
|
||||||
}
|
}
|
||||||
else if (parser.getName().equals("error")) {
|
else if (parser.getName().equals("error")) {
|
||||||
XMPPError.Builder error = PacketParserUtils.parseError(parser);
|
StanzaError.Builder error = PacketParserUtils.parseError(parser);
|
||||||
adHocCommandData.setError(error);
|
adHocCommandData.setError(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smack.util.Objects;
|
import org.jivesoftware.smack.util.Objects;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ public final class ServiceDiscoveryManager extends Manager {
|
||||||
// Return <item-not-found/> error since client doesn't contain
|
// Return <item-not-found/> error since client doesn't contain
|
||||||
// the specified node
|
// the specified node
|
||||||
response.setType(IQ.Type.error);
|
response.setType(IQ.Type.error);
|
||||||
response.setError(XMPPError.getBuilder(XMPPError.Condition.item_not_found));
|
response.setError(StanzaError.getBuilder(StanzaError.Condition.item_not_found));
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ public final class ServiceDiscoveryManager extends Manager {
|
||||||
} else {
|
} else {
|
||||||
// Return <item-not-found/> error since specified node was not found
|
// Return <item-not-found/> error since specified node was not found
|
||||||
response.setType(IQ.Type.error);
|
response.setType(IQ.Type.error);
|
||||||
response.setError(XMPPError.getBuilder(XMPPError.Condition.item_not_found));
|
response.setError(StanzaError.getBuilder(StanzaError.Condition.item_not_found));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
|
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
|
||||||
import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.si.packet.StreamInitiation;
|
import org.jivesoftware.smackx.si.packet.StreamInitiation;
|
||||||
|
|
||||||
|
@ -171,8 +171,8 @@ public final class FileTransferManager extends Manager {
|
||||||
// Bytestream rejection as specified in XEP-65 5.3.1 Example 13, which says that
|
// Bytestream rejection as specified in XEP-65 5.3.1 Example 13, which says that
|
||||||
// 'not-acceptable' should be returned. This is done by Smack in
|
// 'not-acceptable' should be returned. This is done by Smack in
|
||||||
// Socks5BytestreamManager.replyRejectPacket(IQ).
|
// Socks5BytestreamManager.replyRejectPacket(IQ).
|
||||||
IQ rejection = IQ.createErrorResponse(initiation, XMPPError.getBuilder(
|
IQ rejection = IQ.createErrorResponse(initiation, StanzaError.getBuilder(
|
||||||
XMPPError.Condition.forbidden));
|
StanzaError.Condition.forbidden));
|
||||||
connection().sendStanza(rejection);
|
connection().sendStanza(rejection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtension;
|
import org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtension;
|
||||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
||||||
|
@ -194,7 +194,7 @@ public final class FileTransferNegotiator extends Manager {
|
||||||
|
|
||||||
if (streamMethodField == null) {
|
if (streamMethodField == null) {
|
||||||
String errorMessage = "No stream methods contained in stanza.";
|
String errorMessage = "No stream methods contained in stanza.";
|
||||||
XMPPError.Builder error = XMPPError.from(XMPPError.Condition.bad_request, errorMessage);
|
StanzaError.Builder error = StanzaError.from(StanzaError.Condition.bad_request, errorMessage);
|
||||||
IQ iqPacket = IQ.createErrorResponse(si, error);
|
IQ iqPacket = IQ.createErrorResponse(si, error);
|
||||||
connection().sendStanza(iqPacket);
|
connection().sendStanza(iqPacket);
|
||||||
throw new FileTransferException.NoStreamMethodsOfferedException();
|
throw new FileTransferException.NoStreamMethodsOfferedException();
|
||||||
|
@ -206,7 +206,7 @@ public final class FileTransferNegotiator extends Manager {
|
||||||
selectedStreamNegotiator = getNegotiator(streamMethodField);
|
selectedStreamNegotiator = getNegotiator(streamMethodField);
|
||||||
}
|
}
|
||||||
catch (NoAcceptableTransferMechanisms e) {
|
catch (NoAcceptableTransferMechanisms e) {
|
||||||
IQ iqPacket = IQ.createErrorResponse(si, XMPPError.from(XMPPError.Condition.bad_request, "No acceptable transfer mechanism"));
|
IQ iqPacket = IQ.createErrorResponse(si, StanzaError.from(StanzaError.Condition.bad_request, "No acceptable transfer mechanism"));
|
||||||
connection().sendStanza(iqPacket);
|
connection().sendStanza(iqPacket);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.jivesoftware.smack.SmackException;
|
||||||
import org.jivesoftware.smack.SmackException.IllegalStateChangeException;
|
import org.jivesoftware.smack.SmackException.IllegalStateChangeException;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
|
||||||
import org.jxmpp.jid.Jid;
|
import org.jxmpp.jid.Jid;
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ public class OutgoingFileTransfer extends FileTransfer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleXMPPException(XMPPErrorException e) {
|
private void handleXMPPException(XMPPErrorException e) {
|
||||||
XMPPError error = e.getXMPPError();
|
StanzaError error = e.getXMPPError();
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
switch (error.getCondition()) {
|
switch (error.getCondition()) {
|
||||||
case forbidden:
|
case forbidden:
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.jivesoftware.smack.packet.IQ.Type;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.XMPPError.Condition;
|
import org.jivesoftware.smack.packet.StanzaError.Condition;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
import org.jivesoftware.smackx.iqlast.packet.LastActivity;
|
import org.jivesoftware.smackx.iqlast.packet.LastActivity;
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.XMPPError.Condition;
|
import org.jivesoftware.smack.packet.StanzaError.Condition;
|
||||||
import org.jivesoftware.smack.provider.IQProvider;
|
import org.jivesoftware.smack.provider.IQProvider;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.iqprivate.packet.DefaultPrivateData;
|
import org.jivesoftware.smackx.iqprivate.packet.DefaultPrivateData;
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
|
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
|
||||||
import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.XMPPError.Condition;
|
import org.jivesoftware.smack.packet.StanzaError.Condition;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
import org.jivesoftware.smackx.iqversion.packet.Version;
|
import org.jivesoftware.smackx.iqversion.packet.Version;
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.jivesoftware.smack.SmackException;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||||
import org.jivesoftware.smackx.jingle.element.JingleAction;
|
import org.jivesoftware.smackx.jingle.element.JingleAction;
|
||||||
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||||
|
@ -423,8 +423,8 @@ public class JingleUtil {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public IQ createErrorUnknownSession(Jingle request) {
|
public IQ createErrorUnknownSession(Jingle request) {
|
||||||
XMPPError.Builder error = XMPPError.getBuilder();
|
StanzaError.Builder error = StanzaError.getBuilder();
|
||||||
error.setCondition(XMPPError.Condition.item_not_found)
|
error.setCondition(StanzaError.Condition.item_not_found)
|
||||||
.addExtension(JingleError.UNKNOWN_SESSION);
|
.addExtension(JingleError.UNKNOWN_SESSION);
|
||||||
return IQ.createErrorResponse(request, error);
|
return IQ.createErrorResponse(request, error);
|
||||||
}
|
}
|
||||||
|
@ -435,7 +435,7 @@ public class JingleUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ createErrorUnknownInitiator(Jingle request) {
|
public IQ createErrorUnknownInitiator(Jingle request) {
|
||||||
return IQ.createErrorResponse(request, XMPPError.Condition.service_unavailable);
|
return IQ.createErrorResponse(request, StanzaError.Condition.service_unavailable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendErrorUnknownInitiator(Jingle request)
|
public void sendErrorUnknownInitiator(Jingle request)
|
||||||
|
@ -444,8 +444,8 @@ public class JingleUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ createErrorUnsupportedInfo(Jingle request) {
|
public IQ createErrorUnsupportedInfo(Jingle request) {
|
||||||
XMPPError.Builder error = XMPPError.getBuilder();
|
StanzaError.Builder error = StanzaError.getBuilder();
|
||||||
error.setCondition(XMPPError.Condition.feature_not_implemented)
|
error.setCondition(StanzaError.Condition.feature_not_implemented)
|
||||||
.addExtension(JingleError.UNSUPPORTED_INFO);
|
.addExtension(JingleError.UNSUPPORTED_INFO);
|
||||||
return IQ.createErrorResponse(request, error);
|
return IQ.createErrorResponse(request, error);
|
||||||
}
|
}
|
||||||
|
@ -456,8 +456,8 @@ public class JingleUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ createErrorTieBreak(Jingle request) {
|
public IQ createErrorTieBreak(Jingle request) {
|
||||||
XMPPError.Builder error = XMPPError.getBuilder();
|
StanzaError.Builder error = StanzaError.getBuilder();
|
||||||
error.setCondition(XMPPError.Condition.conflict)
|
error.setCondition(StanzaError.Condition.conflict)
|
||||||
.addExtension(JingleError.TIE_BREAK);
|
.addExtension(JingleError.TIE_BREAK);
|
||||||
return IQ.createErrorResponse(request, error);
|
return IQ.createErrorResponse(request, error);
|
||||||
}
|
}
|
||||||
|
@ -468,8 +468,8 @@ public class JingleUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ createErrorOutOfOrder(Jingle request) {
|
public IQ createErrorOutOfOrder(Jingle request) {
|
||||||
XMPPError.Builder error = XMPPError.getBuilder();
|
StanzaError.Builder error = StanzaError.getBuilder();
|
||||||
error.setCondition(XMPPError.Condition.unexpected_request)
|
error.setCondition(StanzaError.Condition.unexpected_request)
|
||||||
.addExtension(JingleError.OUT_OF_ORDER);
|
.addExtension(JingleError.OUT_OF_ORDER);
|
||||||
return IQ.createErrorResponse(request, error);
|
return IQ.createErrorResponse(request, error);
|
||||||
}
|
}
|
||||||
|
@ -480,7 +480,7 @@ public class JingleUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ createErrorMalformedRequest(Jingle request) {
|
public IQ createErrorMalformedRequest(Jingle request) {
|
||||||
return IQ.createErrorResponse(request, XMPPError.Condition.bad_request);
|
return IQ.createErrorResponse(request, StanzaError.Condition.bad_request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendErrorMalformedRequest(Jingle request)
|
public void sendErrorMalformedRequest(Jingle request)
|
||||||
|
|
|
@ -41,7 +41,7 @@ import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.IQ.Type;
|
import org.jivesoftware.smack.packet.IQ.Type;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smack.util.ExceptionCallback;
|
import org.jivesoftware.smack.util.ExceptionCallback;
|
||||||
import org.jivesoftware.smack.util.SuccessCallback;
|
import org.jivesoftware.smack.util.SuccessCallback;
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ public final class PingManager extends Manager {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
final XMPPError xmppError = xmppErrorException.getXMPPError();
|
final StanzaError xmppError = xmppErrorException.getXMPPError();
|
||||||
|
|
||||||
// We may received an error response from an intermediate service returning an error like
|
// We may received an error response from an intermediate service returning an error like
|
||||||
// 'remote-server-not-found' or 'remote-server-timeout' to us (which would fake the 'from' address,
|
// 'remote-server-not-found' or 'remote-server-timeout' to us (which would fake the 'from' address,
|
||||||
|
@ -167,9 +167,9 @@ public final class PingManager extends Manager {
|
||||||
|
|
||||||
// Some clients don't obey the first rule and instead send back a feature-not-implement condition with type 'cancel',
|
// Some clients don't obey the first rule and instead send back a feature-not-implement condition with type 'cancel',
|
||||||
// which allows us to consider this response as valid "error response" pong.
|
// which allows us to consider this response as valid "error response" pong.
|
||||||
XMPPError.Type type = xmppError.getType();
|
StanzaError.Type type = xmppError.getType();
|
||||||
XMPPError.Condition condition = xmppError.getCondition();
|
StanzaError.Condition condition = xmppError.getCondition();
|
||||||
return type == XMPPError.Type.CANCEL && condition == XMPPError.Condition.feature_not_implemented;
|
return type == StanzaError.Type.CANCEL && condition == StanzaError.Condition.feature_not_implemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SmackFuture<Boolean, Exception> pingAsync(Jid jid) {
|
public SmackFuture<Boolean, Exception> pingAsync(Jid jid) {
|
||||||
|
|
|
@ -35,8 +35,8 @@ import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.IQ.Type;
|
import org.jivesoftware.smack.packet.IQ.Type;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smack.packet.XMPPError.Condition;
|
import org.jivesoftware.smack.packet.StanzaError.Condition;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||||
|
@ -556,7 +556,7 @@ public final class PubSubManager extends Manager {
|
||||||
leafNode = createNode();
|
leafNode = createNode();
|
||||||
}
|
}
|
||||||
catch (XMPPErrorException e) {
|
catch (XMPPErrorException e) {
|
||||||
if (e.getXMPPError().getCondition() == XMPPError.Condition.forbidden) {
|
if (e.getXMPPError().getCondition() == StanzaError.Condition.forbidden) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
|
||||||
import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.IQ.Type;
|
import org.jivesoftware.smack.packet.IQ.Type;
|
||||||
import org.jivesoftware.smack.packet.XMPPError.Condition;
|
import org.jivesoftware.smack.packet.StanzaError.Condition;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
import org.jivesoftware.smackx.time.packet.Time;
|
import org.jivesoftware.smackx.time.packet.Time;
|
||||||
|
|
|
@ -22,7 +22,7 @@ import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.InitExtensions;
|
import org.jivesoftware.smackx.InitExtensions;
|
||||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.Close;
|
import org.jivesoftware.smackx.bytestreams.ibb.packet.Close;
|
||||||
|
@ -78,7 +78,7 @@ public class CloseListenerTest extends InitExtensions {
|
||||||
// assert that reply is the correct error packet
|
// assert that reply is the correct error packet
|
||||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||||
assertEquals(XMPPError.Condition.item_not_found,
|
assertEquals(StanzaError.Condition.item_not_found,
|
||||||
argument.getValue().getError().getCondition());
|
argument.getValue().getError().getCondition());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.InitExtensions;
|
import org.jivesoftware.smackx.InitExtensions;
|
||||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.Data;
|
import org.jivesoftware.smackx.bytestreams.ibb.packet.Data;
|
||||||
|
@ -80,7 +80,7 @@ public class DataListenerTest extends InitExtensions {
|
||||||
// assert that reply is the correct error packet
|
// assert that reply is the correct error packet
|
||||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||||
assertEquals(XMPPError.Condition.item_not_found,
|
assertEquals(StanzaError.Condition.item_not_found,
|
||||||
argument.getValue().getError().getCondition());
|
argument.getValue().getError().getCondition());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.bytestreams.ibb;
|
||||||
import org.jivesoftware.smack.packet.EmptyResultIQ;
|
import org.jivesoftware.smack.packet.EmptyResultIQ;
|
||||||
import org.jivesoftware.smack.packet.ErrorIQ;
|
import org.jivesoftware.smack.packet.ErrorIQ;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
|
||||||
import org.jxmpp.jid.Jid;
|
import org.jxmpp.jid.Jid;
|
||||||
|
|
||||||
|
@ -38,8 +38,8 @@ public class IBBPacketUtils {
|
||||||
* @param condition the XMPP error condition
|
* @param condition the XMPP error condition
|
||||||
* @return an error IQ
|
* @return an error IQ
|
||||||
*/
|
*/
|
||||||
public static IQ createErrorIQ(Jid from, Jid to, XMPPError.Condition condition) {
|
public static IQ createErrorIQ(Jid from, Jid to, StanzaError.Condition condition) {
|
||||||
XMPPError.Builder xmppError = XMPPError.getBuilder(condition);
|
StanzaError.Builder xmppError = StanzaError.getBuilder(condition);
|
||||||
IQ errorIQ = new ErrorIQ(xmppError);
|
IQ errorIQ = new ErrorIQ(xmppError);
|
||||||
errorIQ.setType(IQ.Type.error);
|
errorIQ.setType(IQ.Type.error);
|
||||||
errorIQ.setFrom(from);
|
errorIQ.setFrom(from);
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.InitExtensions;
|
import org.jivesoftware.smackx.InitExtensions;
|
||||||
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType;
|
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType;
|
||||||
|
@ -118,7 +118,7 @@ public class InBandBytestreamManagerTest extends InitExtensions {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
IQ errorIQ = IBBPacketUtils.createErrorIQ(targetJID, initiatorJID,
|
IQ errorIQ = IBBPacketUtils.createErrorIQ(targetJID, initiatorJID,
|
||||||
XMPPError.Condition.feature_not_implemented);
|
StanzaError.Condition.feature_not_implemented);
|
||||||
protocol.addResponse(errorIQ);
|
protocol.addResponse(errorIQ);
|
||||||
|
|
||||||
// start In-Band Bytestream
|
// start In-Band Bytestream
|
||||||
|
@ -127,7 +127,7 @@ public class InBandBytestreamManagerTest extends InitExtensions {
|
||||||
fail("exception should be thrown");
|
fail("exception should be thrown");
|
||||||
}
|
}
|
||||||
catch (XMPPErrorException e) {
|
catch (XMPPErrorException e) {
|
||||||
assertEquals(XMPPError.Condition.feature_not_implemented,
|
assertEquals(StanzaError.Condition.feature_not_implemented,
|
||||||
e.getXMPPError().getCondition());
|
e.getXMPPError().getCondition());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ import static org.mockito.Mockito.verify;
|
||||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.InitExtensions;
|
import org.jivesoftware.smackx.InitExtensions;
|
||||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.Open;
|
import org.jivesoftware.smackx.bytestreams.ibb.packet.Open;
|
||||||
|
@ -89,7 +89,7 @@ public class InBandBytestreamRequestTest extends InitExtensions {
|
||||||
// assert that reply is the correct error packet
|
// assert that reply is the correct error packet
|
||||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||||
assertEquals(XMPPError.Condition.not_acceptable,
|
assertEquals(StanzaError.Condition.not_acceptable,
|
||||||
argument.getValue().getError().getCondition());
|
argument.getValue().getError().getCondition());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.jivesoftware.smack.StanzaListener;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smack.util.stringencoder.Base64;
|
import org.jivesoftware.smack.util.stringencoder.Base64;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.InitExtensions;
|
import org.jivesoftware.smackx.InitExtensions;
|
||||||
|
@ -378,7 +378,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void verify(IQ request, IQ response) {
|
public void verify(IQ request, IQ response) {
|
||||||
assertEquals(XMPPError.Condition.unexpected_request,
|
assertEquals(StanzaError.Condition.unexpected_request,
|
||||||
request.getError().getCondition());
|
request.getError().getCondition());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void verify(IQ request, IQ response) {
|
public void verify(IQ request, IQ response) {
|
||||||
assertEquals(XMPPError.Condition.bad_request,
|
assertEquals(StanzaError.Condition.bad_request,
|
||||||
request.getError().getCondition());
|
request.getError().getCondition());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.InitExtensions;
|
import org.jivesoftware.smackx.InitExtensions;
|
||||||
import org.jivesoftware.smackx.bytestreams.BytestreamRequest;
|
import org.jivesoftware.smackx.bytestreams.BytestreamRequest;
|
||||||
|
@ -97,7 +97,7 @@ public class InitiationListenerTest extends InitExtensions {
|
||||||
// assert that reply is the correct error packet
|
// assert that reply is the correct error packet
|
||||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||||
assertEquals(XMPPError.Condition.not_acceptable,
|
assertEquals(StanzaError.Condition.not_acceptable,
|
||||||
argument.getValue().getError().getCondition());
|
argument.getValue().getError().getCondition());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ public class InitiationListenerTest extends InitExtensions {
|
||||||
// assert that reply is the correct error packet
|
// assert that reply is the correct error packet
|
||||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||||
assertEquals(XMPPError.Condition.resource_constraint,
|
assertEquals(StanzaError.Condition.resource_constraint,
|
||||||
argument.getValue().getError().getCondition());
|
argument.getValue().getError().getCondition());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ public class InitiationListenerTest extends InitExtensions {
|
||||||
// assert that reply is the correct error packet
|
// assert that reply is the correct error packet
|
||||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||||
assertEquals(XMPPError.Condition.not_acceptable,
|
assertEquals(StanzaError.Condition.not_acceptable,
|
||||||
argument.getValue().getError().getCondition());
|
argument.getValue().getError().getCondition());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.bytestreams.BytestreamRequest;
|
import org.jivesoftware.smackx.bytestreams.BytestreamRequest;
|
||||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
||||||
|
@ -104,7 +104,7 @@ public class InitiationListenerTest {
|
||||||
// assert that reply is the correct error packet
|
// assert that reply is the correct error packet
|
||||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||||
assertEquals(XMPPError.Condition.not_acceptable,
|
assertEquals(StanzaError.Condition.not_acceptable,
|
||||||
argument.getValue().getError().getCondition());
|
argument.getValue().getError().getCondition());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ public class InitiationListenerTest {
|
||||||
// assert that reply is the correct error packet
|
// assert that reply is the correct error packet
|
||||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||||
assertEquals(XMPPError.Condition.not_acceptable,
|
assertEquals(StanzaError.Condition.not_acceptable,
|
||||||
argument.getValue().getError().getCondition());
|
argument.getValue().getError().getCondition());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.packet.ErrorIQ;
|
import org.jivesoftware.smack.packet.ErrorIQ;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
||||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.StreamHost;
|
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.StreamHost;
|
||||||
|
@ -433,7 +433,7 @@ public class Socks5ByteStreamManagerTest {
|
||||||
Verification.requestTypeGET);
|
Verification.requestTypeGET);
|
||||||
|
|
||||||
// build error packet to reject SOCKS5 Bytestream
|
// build error packet to reject SOCKS5 Bytestream
|
||||||
XMPPError.Builder builder = XMPPError.getBuilder(XMPPError.Condition.not_acceptable);
|
StanzaError.Builder builder = StanzaError.getBuilder(StanzaError.Condition.not_acceptable);
|
||||||
IQ rejectPacket = new ErrorIQ(builder);
|
IQ rejectPacket = new ErrorIQ(builder);
|
||||||
rejectPacket.setFrom(targetJID);
|
rejectPacket.setFrom(targetJID);
|
||||||
rejectPacket.setTo(initiatorJID);
|
rejectPacket.setTo(initiatorJID);
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ public class Socks5ByteStreamRequestTest {
|
||||||
assertTrue(IQ.class.isInstance(targetResponse));
|
assertTrue(IQ.class.isInstance(targetResponse));
|
||||||
assertEquals(initiatorJID, targetResponse.getTo());
|
assertEquals(initiatorJID, targetResponse.getTo());
|
||||||
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
|
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
|
||||||
assertEquals(XMPPError.Condition.item_not_found,
|
assertEquals(StanzaError.Condition.item_not_found,
|
||||||
targetResponse.getError().getCondition());
|
targetResponse.getError().getCondition());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ public class Socks5ByteStreamRequestTest {
|
||||||
assertTrue(IQ.class.isInstance(targetResponse));
|
assertTrue(IQ.class.isInstance(targetResponse));
|
||||||
assertEquals(initiatorJID, targetResponse.getTo());
|
assertEquals(initiatorJID, targetResponse.getTo());
|
||||||
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
|
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
|
||||||
assertEquals(XMPPError.Condition.item_not_found,
|
assertEquals(StanzaError.Condition.item_not_found,
|
||||||
targetResponse.getError().getCondition());
|
targetResponse.getError().getCondition());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ public class Socks5ByteStreamRequestTest {
|
||||||
assertTrue(IQ.class.isInstance(targetResponse));
|
assertTrue(IQ.class.isInstance(targetResponse));
|
||||||
assertEquals(initiatorJID, targetResponse.getTo());
|
assertEquals(initiatorJID, targetResponse.getTo());
|
||||||
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
|
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
|
||||||
assertEquals(XMPPError.Condition.item_not_found,
|
assertEquals(StanzaError.Condition.item_not_found,
|
||||||
targetResponse.getError().getCondition());
|
targetResponse.getError().getCondition());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ public class Socks5ByteStreamRequestTest {
|
||||||
assertTrue(IQ.class.isInstance(targetResponse));
|
assertTrue(IQ.class.isInstance(targetResponse));
|
||||||
assertEquals(initiatorJID, targetResponse.getTo());
|
assertEquals(initiatorJID, targetResponse.getTo());
|
||||||
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
|
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
|
||||||
assertEquals(XMPPError.Condition.item_not_found,
|
assertEquals(StanzaError.Condition.item_not_found,
|
||||||
targetResponse.getError().getCondition());
|
targetResponse.getError().getCondition());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.packet.EmptyResultIQ;
|
import org.jivesoftware.smack.packet.EmptyResultIQ;
|
||||||
import org.jivesoftware.smack.packet.ErrorIQ;
|
import org.jivesoftware.smack.packet.ErrorIQ;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
||||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.StreamHost;
|
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.StreamHost;
|
||||||
|
@ -205,7 +205,7 @@ public class Socks5ClientForInitiatorTest {
|
||||||
public void shouldFailIfActivateSocks5ProxyFails() throws Exception {
|
public void shouldFailIfActivateSocks5ProxyFails() throws Exception {
|
||||||
|
|
||||||
// build error response as reply to the stream activation
|
// build error response as reply to the stream activation
|
||||||
IQ error = new ErrorIQ(XMPPError.getBuilder(XMPPError.Condition.internal_server_error));
|
IQ error = new ErrorIQ(StanzaError.getBuilder(StanzaError.Condition.internal_server_error));
|
||||||
error.setFrom(proxyJID);
|
error.setFrom(proxyJID);
|
||||||
error.setTo(initiatorJID);
|
error.setTo(initiatorJID);
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ public class Socks5ClientForInitiatorTest {
|
||||||
fail("exception should be thrown");
|
fail("exception should be thrown");
|
||||||
}
|
}
|
||||||
catch (XMPPErrorException e) {
|
catch (XMPPErrorException e) {
|
||||||
assertTrue(XMPPError.Condition.internal_server_error.equals(e.getXMPPError().getCondition()));
|
assertTrue(StanzaError.Condition.internal_server_error.equals(e.getXMPPError().getCondition()));
|
||||||
protocol.verifyAll();
|
protocol.verifyAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@ import org.jivesoftware.smack.ThreadedDummyConnection;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.packet.IQ.Type;
|
import org.jivesoftware.smack.packet.IQ.Type;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smack.packet.XMPPError.Condition;
|
import org.jivesoftware.smack.packet.StanzaError.Condition;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.InitExtensions;
|
import org.jivesoftware.smackx.InitExtensions;
|
||||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||||
|
@ -68,7 +68,7 @@ public class ConfigureFormTest extends InitExtensions {
|
||||||
PubSub errorIq = new PubSub();
|
PubSub errorIq = new PubSub();
|
||||||
errorIq.setType(Type.error);
|
errorIq.setType(Type.error);
|
||||||
errorIq.setFrom(PubSubManagerTest.DUMMY_PUBSUB_SERVICE);
|
errorIq.setFrom(PubSubManagerTest.DUMMY_PUBSUB_SERVICE);
|
||||||
XMPPError.Builder error = XMPPError.getBuilder(Condition.forbidden);
|
StanzaError.Builder error = StanzaError.getBuilder(Condition.forbidden);
|
||||||
errorIq.setError(error);
|
errorIq.setError(error);
|
||||||
con.addIQReply(errorIq);
|
con.addIQReply(errorIq);
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ public class ConfigureFormTest extends InitExtensions {
|
||||||
fail();
|
fail();
|
||||||
}
|
}
|
||||||
catch (XMPPErrorException e) {
|
catch (XMPPErrorException e) {
|
||||||
Assert.assertEquals(XMPPError.Type.AUTH, e.getXMPPError().getType());
|
Assert.assertEquals(StanzaError.Type.AUTH, e.getXMPPError().getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.IQ.Type;
|
import org.jivesoftware.smack.packet.IQ.Type;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.XMPPError.Condition;
|
import org.jivesoftware.smack.packet.StanzaError.Condition;
|
||||||
import org.jivesoftware.smack.roster.SubscribeListener.SubscribeAnswer;
|
import org.jivesoftware.smack.roster.SubscribeListener.SubscribeAnswer;
|
||||||
import org.jivesoftware.smack.roster.packet.RosterPacket;
|
import org.jivesoftware.smack.roster.packet.RosterPacket;
|
||||||
import org.jivesoftware.smack.roster.packet.RosterPacket.Item;
|
import org.jivesoftware.smack.roster.packet.RosterPacket.Item;
|
||||||
|
|
|
@ -38,7 +38,7 @@ import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.IQ.Type;
|
import org.jivesoftware.smack.packet.IQ.Type;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.XMPPError.Condition;
|
import org.jivesoftware.smack.packet.StanzaError.Condition;
|
||||||
import org.jivesoftware.smack.roster.packet.RosterPacket;
|
import org.jivesoftware.smack.roster.packet.RosterPacket;
|
||||||
import org.jivesoftware.smack.roster.packet.RosterPacket.Item;
|
import org.jivesoftware.smack.roster.packet.RosterPacket.Item;
|
||||||
import org.jivesoftware.smack.roster.packet.RosterPacket.ItemType;
|
import org.jivesoftware.smack.roster.packet.RosterPacket.ItemType;
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.jivesoftware.smack.SmackException;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
|
||||||
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
||||||
import org.igniterealtime.smack.inttest.DummySmackIntegrationTestFramework;
|
import org.igniterealtime.smack.inttest.DummySmackIntegrationTestFramework;
|
||||||
|
@ -85,7 +85,7 @@ public class SmackIntegrationTestFrameworkUnitTest {
|
||||||
FailedTest failedTest = failedTests.get(0);
|
FailedTest failedTest = failedTests.get(0);
|
||||||
assertTrue(failedTest.failureReason instanceof XMPPErrorException);
|
assertTrue(failedTest.failureReason instanceof XMPPErrorException);
|
||||||
XMPPErrorException ex = (XMPPErrorException) failedTest.failureReason;
|
XMPPErrorException ex = (XMPPErrorException) failedTest.failureReason;
|
||||||
assertEquals(XMPPError.Condition.bad_request, ex.getXMPPError().getCondition());
|
assertEquals(StanzaError.Condition.bad_request, ex.getXMPPError().getCondition());
|
||||||
assertEquals(ThrowsNonFatalExceptionDummyTest.DESCRIPTIVE_TEXT, ex.getXMPPError().getDescriptiveText());
|
assertEquals(ThrowsNonFatalExceptionDummyTest.DESCRIPTIVE_TEXT, ex.getXMPPError().getDescriptiveText());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ public class SmackIntegrationTestFrameworkUnitTest {
|
||||||
public void throwRuntimeExceptionTest() throws XMPPErrorException {
|
public void throwRuntimeExceptionTest() throws XMPPErrorException {
|
||||||
Message message = new Message();
|
Message message = new Message();
|
||||||
throw new XMPPException.XMPPErrorException(message,
|
throw new XMPPException.XMPPErrorException(message,
|
||||||
XMPPError.from(XMPPError.Condition.bad_request, DESCRIPTIVE_TEXT).build());
|
StanzaError.from(StanzaError.Condition.bad_request, DESCRIPTIVE_TEXT).build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.filter.StanzaFilter;
|
import org.jivesoftware.smack.filter.StanzaFilter;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.jingleold.listeners.JingleListener;
|
import org.jivesoftware.smackx.jingleold.listeners.JingleListener;
|
||||||
import org.jivesoftware.smackx.jingleold.listeners.JingleMediaListener;
|
import org.jivesoftware.smackx.jingleold.listeners.JingleMediaListener;
|
||||||
|
@ -1053,7 +1053,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
||||||
IQ errorPacket = null;
|
IQ errorPacket = null;
|
||||||
if (jingleError != null) {
|
if (jingleError != null) {
|
||||||
// TODO This is wrong according to XEP-166 § 10, but this jingle implementation is deprecated anyways
|
// TODO This is wrong according to XEP-166 § 10, but this jingle implementation is deprecated anyways
|
||||||
XMPPError.Builder builder = XMPPError.getBuilder(XMPPError.Condition.undefined_condition);
|
StanzaError.Builder builder = StanzaError.getBuilder(StanzaError.Condition.undefined_condition);
|
||||||
builder.addExtension(jingleError);
|
builder.addExtension(jingleError);
|
||||||
|
|
||||||
errorPacket = IQ.createErrorResponse(iq, builder);
|
errorPacket = IQ.createErrorResponse(iq, builder);
|
||||||
|
|
|
@ -48,7 +48,7 @@ import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.filter.StanzaFilter;
|
import org.jivesoftware.smack.filter.StanzaFilter;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smack.util.Async;
|
import org.jivesoftware.smack.util.Async;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.carbons.CarbonCopyReceivedListener;
|
import org.jivesoftware.smackx.carbons.CarbonCopyReceivedListener;
|
||||||
|
@ -468,7 +468,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
||||||
|
|
||||||
} catch (XMPPException.XMPPErrorException e) {
|
} catch (XMPPException.XMPPErrorException e) {
|
||||||
|
|
||||||
if (e.getXMPPError().getCondition() == XMPPError.Condition.item_not_found) {
|
if (e.getXMPPError().getCondition() == StanzaError.Condition.item_not_found) {
|
||||||
LOGGER.log(Level.WARNING, "Could not refresh own deviceList, because the node did not exist: "
|
LOGGER.log(Level.WARNING, "Could not refresh own deviceList, because the node did not exist: "
|
||||||
+ e.getMessage());
|
+ e.getMessage());
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright © 2014 Florian Schmaus
|
* Copyright © 2014-2018 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -21,8 +21,8 @@ import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.Nonza;
|
import org.jivesoftware.smack.packet.Nonza;
|
||||||
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smack.packet.StanzaErrorTextElement;
|
import org.jivesoftware.smack.packet.StanzaErrorTextElement;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
public class StreamManagement {
|
public class StreamManagement {
|
||||||
|
@ -193,7 +193,7 @@ public class StreamManagement {
|
||||||
public static class Failed implements Nonza {
|
public static class Failed implements Nonza {
|
||||||
public static final String ELEMENT = "failed";
|
public static final String ELEMENT = "failed";
|
||||||
|
|
||||||
private final XMPPError.Condition condition;
|
private final StanzaError.Condition condition;
|
||||||
|
|
||||||
private final List<StanzaErrorTextElement> textElements;
|
private final List<StanzaErrorTextElement> textElements;
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ public class StreamManagement {
|
||||||
this(null, null);
|
this(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Failed(XMPPError.Condition condition, List<StanzaErrorTextElement> textElements) {
|
public Failed(StanzaError.Condition condition, List<StanzaErrorTextElement> textElements) {
|
||||||
this.condition = condition;
|
this.condition = condition;
|
||||||
if (textElements == null) {
|
if (textElements == null) {
|
||||||
this.textElements = Collections.emptyList();
|
this.textElements = Collections.emptyList();
|
||||||
|
@ -211,7 +211,7 @@ public class StreamManagement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public XMPPError.Condition getXMPPErrorCondition() {
|
public StanzaError.Condition getXMPPErrorCondition() {
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ public class StreamManagement {
|
||||||
if (condition != null) {
|
if (condition != null) {
|
||||||
// TODO This should use StanzaError (formerly XMPPError) in Smack 4.3 (see SMACK-769)
|
// TODO This should use StanzaError (formerly XMPPError) in Smack 4.3 (see SMACK-769)
|
||||||
xml.append(condition.toString());
|
xml.append(condition.toString());
|
||||||
xml.xmlnsAttribute(XMPPError.NAMESPACE);
|
xml.xmlnsAttribute(StanzaError.NAMESPACE);
|
||||||
}
|
}
|
||||||
xml.append(textElements);
|
xml.append(textElements);
|
||||||
xml.closeElement(ELEMENT);
|
xml.closeElement(ELEMENT);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright © 2014-2017 Florian Schmaus
|
* Copyright © 2014-2018 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -21,8 +21,8 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.AbstractTextElement;
|
import org.jivesoftware.smack.packet.AbstractTextElement;
|
||||||
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smack.packet.StanzaErrorTextElement;
|
import org.jivesoftware.smack.packet.StanzaErrorTextElement;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
|
||||||
import org.jivesoftware.smack.sm.packet.StreamManagement.AckAnswer;
|
import org.jivesoftware.smack.sm.packet.StreamManagement.AckAnswer;
|
||||||
import org.jivesoftware.smack.sm.packet.StreamManagement.AckRequest;
|
import org.jivesoftware.smack.sm.packet.StreamManagement.AckRequest;
|
||||||
import org.jivesoftware.smack.sm.packet.StreamManagement.Enabled;
|
import org.jivesoftware.smack.sm.packet.StreamManagement.Enabled;
|
||||||
|
@ -49,7 +49,7 @@ public class ParseStreamManagement {
|
||||||
public static Failed failed(XmlPullParser parser) throws XmlPullParserException, IOException {
|
public static Failed failed(XmlPullParser parser) throws XmlPullParserException, IOException {
|
||||||
ParserUtils.assertAtStartTag(parser);
|
ParserUtils.assertAtStartTag(parser);
|
||||||
String name;
|
String name;
|
||||||
XMPPError.Condition condition = null;
|
StanzaError.Condition condition = null;
|
||||||
List<StanzaErrorTextElement> textElements = new ArrayList<>(4);
|
List<StanzaErrorTextElement> textElements = new ArrayList<>(4);
|
||||||
outerloop:
|
outerloop:
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -58,14 +58,14 @@ public class ParseStreamManagement {
|
||||||
case XmlPullParser.START_TAG:
|
case XmlPullParser.START_TAG:
|
||||||
name = parser.getName();
|
name = parser.getName();
|
||||||
String namespace = parser.getNamespace();
|
String namespace = parser.getNamespace();
|
||||||
if (XMPPError.NAMESPACE.equals(namespace)) {
|
if (StanzaError.NAMESPACE.equals(namespace)) {
|
||||||
if (name.equals(AbstractTextElement.ELEMENT)) {
|
if (name.equals(AbstractTextElement.ELEMENT)) {
|
||||||
String lang = ParserUtils.getXmlLang(parser);
|
String lang = ParserUtils.getXmlLang(parser);
|
||||||
String text = parser.nextText();
|
String text = parser.nextText();
|
||||||
StanzaErrorTextElement stanzaErrorTextElement = new StanzaErrorTextElement(text, lang);
|
StanzaErrorTextElement stanzaErrorTextElement = new StanzaErrorTextElement(text, lang);
|
||||||
textElements.add(stanzaErrorTextElement);
|
textElements.add(stanzaErrorTextElement);
|
||||||
} else {
|
} else {
|
||||||
condition = XMPPError.Condition.fromString(name);
|
condition = StanzaError.Condition.fromString(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2014 Vyacheslav Blinov, 2017 Florian Schmaus
|
* Copyright 2014 Vyacheslav Blinov, 2017-2018 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -14,8 +14,6 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
package org.jivesoftware.smack.sm.provider;
|
package org.jivesoftware.smack.sm.provider;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.equalTo;
|
import static org.hamcrest.CoreMatchers.equalTo;
|
||||||
|
@ -29,8 +27,8 @@ import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smack.packet.StanzaErrorTextElement;
|
import org.jivesoftware.smack.packet.StanzaErrorTextElement;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
|
||||||
import org.jivesoftware.smack.sm.packet.StreamManagement;
|
import org.jivesoftware.smack.sm.packet.StreamManagement;
|
||||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
|
|
||||||
|
@ -92,11 +90,11 @@ public class ParseStreamManagementTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseFailedError() throws Exception {
|
public void testParseFailedError() throws Exception {
|
||||||
XMPPError.Condition errorCondition = XMPPError.Condition.unexpected_request;
|
StanzaError.Condition errorCondition = StanzaError.Condition.unexpected_request;
|
||||||
|
|
||||||
String failedStanza = XMLBuilder.create("failed")
|
String failedStanza = XMLBuilder.create("failed")
|
||||||
.a("xmlns", "urn:xmpp:sm:3")
|
.a("xmlns", "urn:xmpp:sm:3")
|
||||||
.element(errorCondition.toString(), XMPPError.NAMESPACE)
|
.element(errorCondition.toString(), StanzaError.NAMESPACE)
|
||||||
.asString(outputProperties);
|
.asString(outputProperties);
|
||||||
|
|
||||||
StreamManagement.Failed failedPacket = ParseStreamManagement.failed(
|
StreamManagement.Failed failedPacket = ParseStreamManagement.failed(
|
||||||
|
@ -120,7 +118,7 @@ public class ParseStreamManagementTest {
|
||||||
|
|
||||||
StreamManagement.Failed failed = ParseStreamManagement.failed(parser);
|
StreamManagement.Failed failed = ParseStreamManagement.failed(parser);
|
||||||
|
|
||||||
assertEquals(XMPPError.Condition.item_not_found, failed.getXMPPErrorCondition());
|
assertEquals(StanzaError.Condition.item_not_found, failed.getXMPPErrorCondition());
|
||||||
|
|
||||||
List<StanzaErrorTextElement> textElements = failed.getTextElements();
|
List<StanzaErrorTextElement> textElements = failed.getTextElements();
|
||||||
assertEquals(1, textElements.size());
|
assertEquals(1, textElements.size());
|
||||||
|
|
Loading…
Reference in a new issue