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.Presence;
|
||||
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.Success;
|
||||
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))) {
|
||||
throw new StreamErrorException(PacketParserUtils.parseStreamError(parser));
|
||||
} else {
|
||||
XMPPError.Builder builder = PacketParserUtils.parseError(parser);
|
||||
StanzaError.Builder builder = PacketParserUtils.parseError(parser);
|
||||
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.Session;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.packet.StartTls;
|
||||
import org.jivesoftware.smack.packet.StreamError;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smack.parsing.ParsingExceptionCallback;
|
||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||
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'");
|
||||
}
|
||||
if (iqRequestHandler == null) {
|
||||
XMPPError.Condition replyCondition;
|
||||
StanzaError.Condition replyCondition;
|
||||
switch (unknownIqRequestReplyMode) {
|
||||
case doNotReply:
|
||||
return;
|
||||
case replyFeatureNotImplemented:
|
||||
replyCondition = XMPPError.Condition.feature_not_implemented;
|
||||
replyCondition = StanzaError.Condition.feature_not_implemented;
|
||||
break;
|
||||
case replyServiceUnavailable:
|
||||
replyCondition = XMPPError.Condition.service_unavailable;
|
||||
replyCondition = StanzaError.Condition.service_unavailable;
|
||||
break;
|
||||
default:
|
||||
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
|
||||
// IQ of type 'error' with condition 'service-unavailable'.
|
||||
ErrorIQ errorIQ = IQ.createErrorResponse(iq, XMPPError.getBuilder((
|
||||
ErrorIQ errorIQ = IQ.createErrorResponse(iq, StanzaError.getBuilder((
|
||||
replyCondition)));
|
||||
try {
|
||||
sendStanza(errorIQ);
|
||||
|
|
|
@ -19,8 +19,8 @@ package org.jivesoftware.smack;
|
|||
|
||||
import org.jivesoftware.smack.packet.Nonza;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.packet.StreamError;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
|
||||
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
|
||||
* by the server.
|
||||
*
|
||||
* @see XMPPError
|
||||
* @see StanzaError
|
||||
* @author Matt Tucker
|
||||
*/
|
||||
public abstract class XMPPException extends Exception {
|
||||
|
@ -74,17 +74,17 @@ public abstract class XMPPException extends Exception {
|
|||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 212790389529249604L;
|
||||
private final XMPPError error;
|
||||
private final StanzaError error;
|
||||
private final Stanza stanza;
|
||||
|
||||
/**
|
||||
* Creates a new XMPPErrorException with the given builder.
|
||||
*
|
||||
* @param xmppErrorBuilder
|
||||
* @deprecated Use {@link #XMPPErrorException(Stanza, XMPPError)} instead.
|
||||
* @deprecated Use {@link #XMPPErrorException(Stanza, StanzaError)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public XMPPErrorException(XMPPError.Builder xmppErrorBuilder) {
|
||||
public XMPPErrorException(StanzaError.Builder xmppErrorBuilder) {
|
||||
this(null, xmppErrorBuilder.build());
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ public abstract class XMPPException extends Exception {
|
|||
* @param stanza stanza that contained the exception.
|
||||
* @param error the root cause of the exception.
|
||||
*/
|
||||
public XMPPErrorException(Stanza stanza, XMPPError error) {
|
||||
public XMPPErrorException(Stanza stanza, StanzaError error) {
|
||||
super();
|
||||
this.error = error;
|
||||
this.stanza = stanza;
|
||||
|
@ -106,7 +106,7 @@ public abstract class XMPPException extends Exception {
|
|||
*
|
||||
* @return the XMPPError associated with this exception.
|
||||
*/
|
||||
public XMPPError getXMPPError() {
|
||||
public StanzaError getXMPPError() {
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ public abstract class XMPPException extends Exception {
|
|||
}
|
||||
|
||||
public static void ifHasErrorThenThrow(Stanza packet) throws XMPPErrorException {
|
||||
XMPPError xmppError = packet.getError();
|
||||
StanzaError xmppError = packet.getError();
|
||||
if (xmppError != null) {
|
||||
throw new XMPPErrorException(packet, xmppError);
|
||||
}
|
||||
|
@ -141,16 +141,16 @@ public abstract class XMPPException extends Exception {
|
|||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final XMPPError.Condition condition;
|
||||
private final StanzaError.Condition condition;
|
||||
|
||||
private final Nonza nonza;
|
||||
|
||||
public FailedNonzaException(Nonza nonza, XMPPError.Condition condition) {
|
||||
public FailedNonzaException(Nonza nonza, StanzaError.Condition condition) {
|
||||
this.condition = condition;
|
||||
this.nonza = nonza;
|
||||
}
|
||||
|
||||
public XMPPError.Condition getCondition() {
|
||||
public StanzaError.Condition getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.jivesoftware.smack.util.Objects;
|
|||
|
||||
public class ErrorIQ extends SimpleIQ {
|
||||
|
||||
public static final String ELEMENT = XMPPError.ERROR;
|
||||
public static final String ELEMENT = StanzaError.ERROR;
|
||||
|
||||
/**
|
||||
* Constructs a new error IQ.
|
||||
|
@ -29,7 +29,7 @@ public class ErrorIQ extends SimpleIQ {
|
|||
* </p>
|
||||
* @param xmppErrorBuilder the XMPPError builder (required).
|
||||
*/
|
||||
public ErrorIQ(XMPPError.Builder xmppErrorBuilder) {
|
||||
public ErrorIQ(StanzaError.Builder xmppErrorBuilder) {
|
||||
super(ELEMENT, null);
|
||||
Objects.requireNonNull(xmppErrorBuilder, "xmppErrorBuilder must not be null");
|
||||
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 id set to the id of the 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>
|
||||
*
|
||||
* @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}.
|
||||
* @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)) {
|
||||
throw new IllegalArgumentException(
|
||||
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
|
||||
|
@ -287,8 +287,8 @@ public abstract class IQ extends Stanza {
|
|||
return result;
|
||||
}
|
||||
|
||||
public static ErrorIQ createErrorResponse(final IQ request, final XMPPError.Condition condition) {
|
||||
return createErrorResponse(request, XMPPError.getBuilder(condition));
|
||||
public static ErrorIQ createErrorResponse(final IQ request, final StanzaError.Condition 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 id set to the id of the 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>
|
||||
*
|
||||
* @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}.
|
||||
* @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) {
|
||||
return createErrorResponse(request, XMPPError.getBuilder(error));
|
||||
public static ErrorIQ createErrorResponse(final IQ request, final StanzaError 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.
|
||||
*/
|
||||
XMPPError getError();
|
||||
StanzaError getError();
|
||||
/**
|
||||
* Sets the error for 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.
|
||||
|
|
|
@ -61,7 +61,7 @@ public abstract class Stanza implements TopLevelStreamElement {
|
|||
private String id = null;
|
||||
private Jid to;
|
||||
private Jid from;
|
||||
private XMPPError error = null;
|
||||
private StanzaError error = null;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
public XMPPError getError() {
|
||||
public StanzaError getError() {
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -262,10 +262,10 @@ public abstract class Stanza implements TopLevelStreamElement {
|
|||
* Sets the error for 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
|
||||
public void setError(XMPPError error) {
|
||||
public void setError(StanzaError error) {
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ public abstract class Stanza implements TopLevelStreamElement {
|
|||
*
|
||||
* @param xmppErrorBuilder the error to associate with this stanza.
|
||||
*/
|
||||
public void setError(XMPPError.Builder xmppErrorBuilder) {
|
||||
public void setError(StanzaError.Builder xmppErrorBuilder) {
|
||||
if (xmppErrorBuilder == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -534,7 +534,7 @@ public abstract class Stanza implements TopLevelStreamElement {
|
|||
* @param xml the XmlStringBuilder to append the error to.
|
||||
*/
|
||||
protected void appendErrorIfExists(XmlStringBuilder xml) {
|
||||
XMPPError error = getError();
|
||||
StanzaError error = getError();
|
||||
if (error != null) {
|
||||
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");
|
||||
* 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
|
||||
* @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.
|
||||
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 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 {
|
||||
|
@ -116,7 +115,7 @@ public class XMPPError extends AbstractError {
|
|||
* @param extensions list of stanza extensions
|
||||
* @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) {
|
||||
super(descriptiveTexts, NAMESPACE, extensions);
|
||||
this.condition = Objects.requireNonNull(condition, "condition must not be null");
|
||||
|
@ -227,8 +226,8 @@ public class XMPPError extends AbstractError {
|
|||
return xml;
|
||||
}
|
||||
|
||||
public static XMPPError.Builder from(Condition condition, String descriptiveText) {
|
||||
XMPPError.Builder builder = getBuilder().setCondition(condition);
|
||||
public static StanzaError.Builder from(Condition condition, String descriptiveText) {
|
||||
StanzaError.Builder builder = getBuilder().setCondition(condition);
|
||||
if (descriptiveText != null) {
|
||||
Map<String, String> descriptiveTexts = new HashMap<>();
|
||||
descriptiveTexts.put("en", descriptiveText);
|
||||
|
@ -245,7 +244,7 @@ public class XMPPError extends AbstractError {
|
|||
return getBuilder().setCondition(condition);
|
||||
}
|
||||
|
||||
public static Builder getBuilder(XMPPError xmppError) {
|
||||
public static Builder getBuilder(StanzaError xmppError) {
|
||||
return getBuilder().copyFrom(xmppError);
|
||||
}
|
||||
|
||||
|
@ -284,7 +283,7 @@ public class XMPPError extends AbstractError {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder copyFrom(XMPPError xmppError) {
|
||||
public Builder copyFrom(StanzaError xmppError) {
|
||||
setCondition(xmppError.getCondition());
|
||||
setType(xmppError.getType());
|
||||
setConditionText(xmppError.getConditionText());
|
||||
|
@ -296,8 +295,8 @@ public class XMPPError extends AbstractError {
|
|||
return this;
|
||||
}
|
||||
|
||||
public XMPPError build() {
|
||||
return new XMPPError(condition, conditionText, errorGenerator, type, descriptiveTexts,
|
||||
public StanzaError build() {
|
||||
return new StanzaError(condition, conditionText, errorGenerator, type, descriptiveTexts,
|
||||
extensions, stanza);
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smack.packet;
|
|||
|
||||
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) {
|
||||
super(text, lang);
|
||||
|
|
|
@ -37,10 +37,10 @@ import org.jivesoftware.smack.packet.Message;
|
|||
import org.jivesoftware.smack.packet.Presence;
|
||||
import org.jivesoftware.smack.packet.Session;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.packet.StartTls;
|
||||
import org.jivesoftware.smack.packet.StreamError;
|
||||
import org.jivesoftware.smack.packet.UnparsedIQ;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smack.parsing.StandardExtensionElementProvider;
|
||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||
import org.jivesoftware.smack.provider.IQProvider;
|
||||
|
@ -607,7 +607,7 @@ public class PacketParserUtils {
|
|||
ParserUtils.assertAtStartTag(parser);
|
||||
final int initialDepth = parser.getDepth();
|
||||
IQ iqPacket = null;
|
||||
XMPPError.Builder error = null;
|
||||
StanzaError.Builder error = null;
|
||||
|
||||
final String id = parser.getAttributeValue("", "id");
|
||||
final Jid to = ParserUtils.getJidAttribute(parser, "to");
|
||||
|
@ -854,15 +854,15 @@ public class PacketParserUtils {
|
|||
* @return an error sub-packet.
|
||||
* @throws Exception
|
||||
*/
|
||||
public static XMPPError.Builder parseError(XmlPullParser parser)
|
||||
public static StanzaError.Builder parseError(XmlPullParser parser)
|
||||
throws Exception {
|
||||
final int initialDepth = parser.getDepth();
|
||||
Map<String, String> descriptiveTexts = null;
|
||||
List<ExtensionElement> extensions = new ArrayList<>();
|
||||
XMPPError.Builder builder = XMPPError.getBuilder();
|
||||
StanzaError.Builder builder = StanzaError.getBuilder();
|
||||
|
||||
// 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"));
|
||||
|
||||
outerloop: while (true) {
|
||||
|
@ -872,13 +872,13 @@ public class PacketParserUtils {
|
|||
String name = parser.getName();
|
||||
String namespace = parser.getNamespace();
|
||||
switch (namespace) {
|
||||
case XMPPError.NAMESPACE:
|
||||
case StanzaError.NAMESPACE:
|
||||
switch (name) {
|
||||
case Stanza.TEXT:
|
||||
descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts);
|
||||
break;
|
||||
default:
|
||||
builder.setCondition(XMPPError.Condition.fromString(name));
|
||||
builder.setCondition(StanzaError.Condition.fromString(name));
|
||||
if (!parser.isEmptyElementTag()) {
|
||||
builder.setConditionText(parser.nextText());
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class IQResponseTest {
|
|||
*/
|
||||
@Test
|
||||
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);
|
||||
|
||||
request.setType(IQ.Type.set);
|
||||
|
@ -110,7 +110,7 @@ public class IQResponseTest {
|
|||
*/
|
||||
@Test
|
||||
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);
|
||||
|
||||
request.setType(IQ.Type.error);
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
*/
|
||||
package org.jivesoftware.smack.packet;
|
||||
|
||||
import static org.jivesoftware.smack.packet.XMPPError.Condition;
|
||||
import static org.jivesoftware.smack.packet.XMPPError.Type;
|
||||
import static org.jivesoftware.smack.packet.StanzaError.Condition;
|
||||
import static org.jivesoftware.smack.packet.StanzaError.Type;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -27,7 +27,7 @@ import org.junit.Test;
|
|||
public class XMPPErrorTest {
|
||||
@Test
|
||||
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",
|
||||
Condition.values().length,
|
||||
conditionToTypeMap.size());
|
||||
|
|
|
@ -37,7 +37,7 @@ import javax.xml.transform.TransformerException;
|
|||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.packet.Presence;
|
||||
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.packet.SaslStreamElements;
|
||||
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.SASLFailure;
|
||||
|
@ -875,8 +875,8 @@ public class PacketParserUtilsTest {
|
|||
final String text = "Dummy descriptive text";
|
||||
Map<String, String> texts = new HashMap<>();
|
||||
texts.put(null, text);
|
||||
XMPPError
|
||||
.getBuilder(XMPPError.Condition.internal_server_error)
|
||||
StanzaError
|
||||
.getBuilder(StanzaError.Condition.internal_server_error)
|
||||
.setDescriptiveTexts(texts)
|
||||
.build();
|
||||
}
|
||||
|
@ -886,14 +886,14 @@ public class PacketParserUtilsTest {
|
|||
final String text = "Dummy descriptive text";
|
||||
Map<String, String> texts = new HashMap<>();
|
||||
texts.put("", text);
|
||||
XMPPError error = XMPPError
|
||||
.getBuilder(XMPPError.Condition.internal_server_error)
|
||||
StanzaError error = StanzaError
|
||||
.getBuilder(StanzaError.Condition.internal_server_error)
|
||||
.setDescriptiveTexts(texts)
|
||||
.build();
|
||||
final String errorXml = XMLBuilder
|
||||
.create(XMPPError.ERROR).a("type", "cancel").up()
|
||||
.element("internal-server-error", XMPPError.NAMESPACE).up()
|
||||
.element("text", XMPPError.NAMESPACE).t(text).up()
|
||||
.create(StanzaError.ERROR).a("type", "cancel").up()
|
||||
.element("internal-server-error", StanzaError.NAMESPACE).up()
|
||||
.element("text", StanzaError.NAMESPACE).t(text).up()
|
||||
.asString();
|
||||
XmlUnitUtils.assertSimilar(errorXml, error.toXML());
|
||||
}
|
||||
|
@ -902,12 +902,12 @@ public class PacketParserUtilsTest {
|
|||
public void ensureNoNullLangInParsedDescriptiveTexts() throws Exception {
|
||||
final String text = "Dummy descriptive text";
|
||||
final String errorXml = XMLBuilder
|
||||
.create(XMPPError.ERROR).a("type", "cancel").up()
|
||||
.element("internal-server-error", XMPPError.NAMESPACE).up()
|
||||
.element("text", XMPPError.NAMESPACE).t(text).up()
|
||||
.create(StanzaError.ERROR).a("type", "cancel").up()
|
||||
.element("internal-server-error", StanzaError.NAMESPACE).up()
|
||||
.element("text", StanzaError.NAMESPACE).t(text).up()
|
||||
.asString();
|
||||
XmlPullParser parser = TestUtils.getParser(errorXml);
|
||||
XMPPError error = PacketParserUtils.parseError(parser).build();
|
||||
StanzaError error = PacketParserUtils.parseError(parser).build();
|
||||
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.IQ;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||
|
||||
/**
|
||||
|
@ -67,7 +67,7 @@ public class FileTooLargeError implements ExtensionElement {
|
|||
}
|
||||
|
||||
public static FileTooLargeError from(IQ iq) {
|
||||
XMPPError error = iq.getError();
|
||||
StanzaError error = iq.getError();
|
||||
if (error == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smackx.blocking.element;
|
|||
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
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.smackx.blocking.BlockingCommandManager;
|
||||
|
@ -53,7 +53,7 @@ public class BlockedErrorExtension implements ExtensionElement {
|
|||
}
|
||||
|
||||
public static BlockedErrorExtension from(Message message) {
|
||||
XMPPError error = message.getError();
|
||||
StanzaError error = message.getError();
|
||||
if (error == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.jivesoftware.smack.XMPPConnectionRegistry;
|
|||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
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.BytestreamManager;
|
||||
|
@ -452,7 +452,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
* @throws 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);
|
||||
}
|
||||
|
||||
|
@ -465,7 +465,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
* @throws 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);
|
||||
}
|
||||
|
||||
|
@ -478,7 +478,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
* @throws 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.jivesoftware.smack.filter.StanzaTypeFilter;
|
|||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
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.smackx.bytestreams.BytestreamSession;
|
||||
|
@ -476,7 +476,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
*/
|
||||
if (data.getSeq() <= this.lastSequence) {
|
||||
IQ unexpectedRequest = IQ.createErrorResponse((IQ) packet,
|
||||
XMPPError.Condition.unexpected_request);
|
||||
StanzaError.Condition.unexpected_request);
|
||||
connection.sendStanza(unexpectedRequest);
|
||||
return;
|
||||
|
||||
|
@ -486,7 +486,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
if (data.getDecodedData() == null) {
|
||||
// data is invalid; respond with bad-request error
|
||||
IQ badRequest = IQ.createErrorResponse((IQ) packet,
|
||||
XMPPError.Condition.bad_request);
|
||||
StanzaError.Condition.bad_request);
|
||||
connection.sendStanza(badRequest);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.jivesoftware.smack.XMPPException;
|
|||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
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.BytestreamManager;
|
||||
|
@ -699,7 +699,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
* @throws 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);
|
||||
connection().sendStanza(errorIQ);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
|
|||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
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.socks5.packet.Bytestream;
|
||||
|
@ -283,7 +283,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
|||
*/
|
||||
private void cancelRequest() throws XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
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);
|
||||
this.manager.getConnection().sendStanza(errorIQ);
|
||||
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.NotConnectedException;
|
||||
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.xdata.Form;
|
||||
|
@ -94,7 +94,7 @@ public abstract class AdHocCommand {
|
|||
* @return the specific condition of this error, or null if it doesn't have
|
||||
* 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
|
||||
// extension of the XMPPError.
|
||||
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.IQRequestHandler.Mode;
|
||||
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.smackx.commands.AdHocCommand.Action;
|
||||
|
@ -349,7 +349,7 @@ public final class AdHocCommandManager extends Manager {
|
|||
if (!commands.containsKey(commandNode)) {
|
||||
// Requested command does not exist so return
|
||||
// item_not_found error.
|
||||
return respondError(response, XMPPError.Condition.item_not_found);
|
||||
return respondError(response, StanzaError.Condition.item_not_found);
|
||||
}
|
||||
|
||||
// Create new session ID
|
||||
|
@ -364,7 +364,7 @@ public final class AdHocCommandManager extends Manager {
|
|||
}
|
||||
catch (InstantiationException | IllegalAccessException | IllegalArgumentException
|
||||
| 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);
|
||||
}
|
||||
|
||||
|
@ -375,20 +375,20 @@ public final class AdHocCommandManager extends Manager {
|
|||
// Answer forbidden error if requester permissions are not
|
||||
// enough to execute the requested command
|
||||
if (!command.hasPermission(requestData.getFrom())) {
|
||||
return respondError(response, XMPPError.Condition.forbidden);
|
||||
return respondError(response, StanzaError.Condition.forbidden);
|
||||
}
|
||||
|
||||
Action action = requestData.getAction();
|
||||
|
||||
// If the action is unknown then respond an error.
|
||||
if (action != null && action.equals(Action.unknown)) {
|
||||
return respondError(response, XMPPError.Condition.bad_request,
|
||||
return respondError(response, StanzaError.Condition.bad_request,
|
||||
AdHocCommand.SpecificErrorCondition.malformedAction);
|
||||
}
|
||||
|
||||
// If the action is not execute, then it is an invalid action.
|
||||
if (action != null && !action.equals(Action.execute)) {
|
||||
return respondError(response, XMPPError.Condition.bad_request,
|
||||
return respondError(response, StanzaError.Condition.bad_request,
|
||||
AdHocCommand.SpecificErrorCondition.badAction);
|
||||
}
|
||||
|
||||
|
@ -460,16 +460,16 @@ public final class AdHocCommandManager extends Manager {
|
|||
// If there is an exception caused by the next, complete,
|
||||
// prev or cancel method, then that error is returned to the
|
||||
// requester.
|
||||
XMPPError error = e.getXMPPError();
|
||||
StanzaError error = e.getXMPPError();
|
||||
|
||||
// If the error type is cancel, then the execution is
|
||||
// canceled therefore the status must show that, and the
|
||||
// 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);
|
||||
executingCommands.remove(sessionId);
|
||||
}
|
||||
return respondError(response, XMPPError.getBuilder(error));
|
||||
return respondError(response, StanzaError.getBuilder(error));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -479,7 +479,7 @@ public final class AdHocCommandManager extends Manager {
|
|||
// This also handles if the command was removed in the meanwhile
|
||||
// of getting the key and the value of the map.
|
||||
if (command == null) {
|
||||
return respondError(response, XMPPError.Condition.bad_request,
|
||||
return respondError(response, StanzaError.Condition.bad_request,
|
||||
AdHocCommand.SpecificErrorCondition.badSessionid);
|
||||
}
|
||||
|
||||
|
@ -490,7 +490,7 @@ public final class AdHocCommandManager extends Manager {
|
|||
executingCommands.remove(sessionId);
|
||||
|
||||
// Answer a not_allowed error (session-expired)
|
||||
return respondError(response, XMPPError.Condition.not_allowed,
|
||||
return respondError(response, StanzaError.Condition.not_allowed,
|
||||
AdHocCommand.SpecificErrorCondition.sessionExpired);
|
||||
}
|
||||
|
||||
|
@ -504,7 +504,7 @@ public final class AdHocCommandManager extends Manager {
|
|||
|
||||
// If the action is unknown the respond an error
|
||||
if (action != null && action.equals(Action.unknown)) {
|
||||
return respondError(response, XMPPError.Condition.bad_request,
|
||||
return respondError(response, StanzaError.Condition.bad_request,
|
||||
AdHocCommand.SpecificErrorCondition.malformedAction);
|
||||
}
|
||||
|
||||
|
@ -517,7 +517,7 @@ public final class AdHocCommandManager extends Manager {
|
|||
// Check that the specified action was previously
|
||||
// offered
|
||||
if (!command.isValidAction(action)) {
|
||||
return respondError(response, XMPPError.Condition.bad_request,
|
||||
return respondError(response, StanzaError.Condition.bad_request,
|
||||
AdHocCommand.SpecificErrorCondition.badAction);
|
||||
}
|
||||
|
||||
|
@ -570,16 +570,16 @@ public final class AdHocCommandManager extends Manager {
|
|||
// If there is an exception caused by the next, complete,
|
||||
// prev or cancel method, then that error is returned to the
|
||||
// requester.
|
||||
XMPPError error = e.getXMPPError();
|
||||
StanzaError error = e.getXMPPError();
|
||||
|
||||
// If the error type is cancel, then the execution is
|
||||
// canceled therefore the status must show that, and the
|
||||
// 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);
|
||||
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
|
||||
*/
|
||||
private static IQ respondError(AdHocCommandData response,
|
||||
XMPPError.Condition condition) {
|
||||
return respondError(response, XMPPError.getBuilder(condition));
|
||||
StanzaError.Condition condition) {
|
||||
return respondError(response, StanzaError.getBuilder(condition));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -605,9 +605,9 @@ public final class AdHocCommandManager extends Manager {
|
|||
* @param specificCondition the adhoc command error condition.
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
private static IQ respondError(AdHocCommandData response, XMPPError.Condition condition,
|
||||
private static IQ respondError(AdHocCommandData response, StanzaError.Condition condition,
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -618,7 +618,7 @@ public final class AdHocCommandManager extends Manager {
|
|||
* @param error the error to send.
|
||||
* @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.setError(error);
|
||||
return response;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
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.IQProvider;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
@ -109,7 +109,7 @@ public class AdHocCommandDataProvider extends IQProvider<AdHocCommandData> {
|
|||
adHocCommandData.addNote(new AdHocCommandNote(type, value));
|
||||
}
|
||||
else if (parser.getName().equals("error")) {
|
||||
XMPPError.Builder error = PacketParserUtils.parseError(parser);
|
||||
StanzaError.Builder error = PacketParserUtils.parseError(parser);
|
||||
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.IQ;
|
||||
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.StringUtils;
|
||||
|
||||
|
@ -144,7 +144,7 @@ public final class ServiceDiscoveryManager extends Manager {
|
|||
// Return <item-not-found/> error since client doesn't contain
|
||||
// the specified node
|
||||
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;
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ public final class ServiceDiscoveryManager extends Manager {
|
|||
} else {
|
||||
// Return <item-not-found/> error since specified node was not found
|
||||
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;
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.jivesoftware.smack.XMPPConnection;
|
|||
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
|
||||
import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
||||
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;
|
||||
|
||||
|
@ -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
|
||||
// 'not-acceptable' should be returned. This is done by Smack in
|
||||
// Socks5BytestreamManager.replyRejectPacket(IQ).
|
||||
IQ rejection = IQ.createErrorResponse(initiation, XMPPError.getBuilder(
|
||||
XMPPError.Condition.forbidden));
|
||||
IQ rejection = IQ.createErrorResponse(initiation, StanzaError.getBuilder(
|
||||
StanzaError.Condition.forbidden));
|
||||
connection().sendStanza(rejection);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.jivesoftware.smack.XMPPConnection;
|
|||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
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.socks5.packet.Bytestream;
|
||||
|
@ -194,7 +194,7 @@ public final class FileTransferNegotiator extends Manager {
|
|||
|
||||
if (streamMethodField == null) {
|
||||
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);
|
||||
connection().sendStanza(iqPacket);
|
||||
throw new FileTransferException.NoStreamMethodsOfferedException();
|
||||
|
@ -206,7 +206,7 @@ public final class FileTransferNegotiator extends Manager {
|
|||
selectedStreamNegotiator = getNegotiator(streamMethodField);
|
||||
}
|
||||
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);
|
||||
throw e;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.jivesoftware.smack.SmackException;
|
|||
import org.jivesoftware.smack.SmackException.IllegalStateChangeException;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
|
||||
import org.jxmpp.jid.Jid;
|
||||
|
||||
|
@ -344,7 +344,7 @@ public class OutgoingFileTransfer extends FileTransfer {
|
|||
}
|
||||
|
||||
private void handleXMPPException(XMPPErrorException e) {
|
||||
XMPPError error = e.getXMPPError();
|
||||
StanzaError error = e.getXMPPError();
|
||||
if (error != null) {
|
||||
switch (error.getCondition()) {
|
||||
case forbidden:
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.jivesoftware.smack.packet.IQ.Type;
|
|||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.packet.Presence;
|
||||
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.iqlast.packet.LastActivity;
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
|
|||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
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.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.IQRequestHandler.Mode;
|
||||
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.iqversion.packet.Version;
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.jivesoftware.smack.SmackException;
|
|||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
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.JingleAction;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||
|
@ -423,8 +423,8 @@ public class JingleUtil {
|
|||
*/
|
||||
|
||||
public IQ createErrorUnknownSession(Jingle request) {
|
||||
XMPPError.Builder error = XMPPError.getBuilder();
|
||||
error.setCondition(XMPPError.Condition.item_not_found)
|
||||
StanzaError.Builder error = StanzaError.getBuilder();
|
||||
error.setCondition(StanzaError.Condition.item_not_found)
|
||||
.addExtension(JingleError.UNKNOWN_SESSION);
|
||||
return IQ.createErrorResponse(request, error);
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ public class JingleUtil {
|
|||
}
|
||||
|
||||
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)
|
||||
|
@ -444,8 +444,8 @@ public class JingleUtil {
|
|||
}
|
||||
|
||||
public IQ createErrorUnsupportedInfo(Jingle request) {
|
||||
XMPPError.Builder error = XMPPError.getBuilder();
|
||||
error.setCondition(XMPPError.Condition.feature_not_implemented)
|
||||
StanzaError.Builder error = StanzaError.getBuilder();
|
||||
error.setCondition(StanzaError.Condition.feature_not_implemented)
|
||||
.addExtension(JingleError.UNSUPPORTED_INFO);
|
||||
return IQ.createErrorResponse(request, error);
|
||||
}
|
||||
|
@ -456,8 +456,8 @@ public class JingleUtil {
|
|||
}
|
||||
|
||||
public IQ createErrorTieBreak(Jingle request) {
|
||||
XMPPError.Builder error = XMPPError.getBuilder();
|
||||
error.setCondition(XMPPError.Condition.conflict)
|
||||
StanzaError.Builder error = StanzaError.getBuilder();
|
||||
error.setCondition(StanzaError.Condition.conflict)
|
||||
.addExtension(JingleError.TIE_BREAK);
|
||||
return IQ.createErrorResponse(request, error);
|
||||
}
|
||||
|
@ -468,8 +468,8 @@ public class JingleUtil {
|
|||
}
|
||||
|
||||
public IQ createErrorOutOfOrder(Jingle request) {
|
||||
XMPPError.Builder error = XMPPError.getBuilder();
|
||||
error.setCondition(XMPPError.Condition.unexpected_request)
|
||||
StanzaError.Builder error = StanzaError.getBuilder();
|
||||
error.setCondition(StanzaError.Condition.unexpected_request)
|
||||
.addExtension(JingleError.OUT_OF_ORDER);
|
||||
return IQ.createErrorResponse(request, error);
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ public class JingleUtil {
|
|||
}
|
||||
|
||||
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)
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
|||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.IQ.Type;
|
||||
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.SuccessCallback;
|
||||
|
||||
|
@ -149,7 +149,7 @@ public final class PingManager extends Manager {
|
|||
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
|
||||
// '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',
|
||||
// which allows us to consider this response as valid "error response" pong.
|
||||
XMPPError.Type type = xmppError.getType();
|
||||
XMPPError.Condition condition = xmppError.getCondition();
|
||||
return type == XMPPError.Type.CANCEL && condition == XMPPError.Condition.feature_not_implemented;
|
||||
StanzaError.Type type = xmppError.getType();
|
||||
StanzaError.Condition condition = xmppError.getCondition();
|
||||
return type == StanzaError.Type.CANCEL && condition == StanzaError.Condition.feature_not_implemented;
|
||||
}
|
||||
|
||||
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.Type;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smack.packet.XMPPError.Condition;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.packet.StanzaError.Condition;
|
||||
|
||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||
|
@ -556,7 +556,7 @@ public final class PubSubManager extends Manager {
|
|||
leafNode = createNode();
|
||||
}
|
||||
catch (XMPPErrorException e) {
|
||||
if (e.getXMPPError().getCondition() == XMPPError.Condition.forbidden) {
|
||||
if (e.getXMPPError().getCondition() == StanzaError.Condition.forbidden) {
|
||||
return false;
|
||||
}
|
||||
throw e;
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
|
|||
import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
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.time.packet.Time;
|
||||
|
|
|
@ -22,7 +22,7 @@ import static org.mockito.Mockito.verify;
|
|||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
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.bytestreams.ibb.packet.Close;
|
||||
|
@ -78,7 +78,7 @@ public class CloseListenerTest extends InitExtensions {
|
|||
// assert that reply is the correct error packet
|
||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||
assertEquals(XMPPError.Condition.item_not_found,
|
||||
assertEquals(StanzaError.Condition.item_not_found,
|
||||
argument.getValue().getError().getCondition());
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import static org.mockito.Mockito.verify;
|
|||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
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.bytestreams.ibb.packet.Data;
|
||||
|
@ -80,7 +80,7 @@ public class DataListenerTest extends InitExtensions {
|
|||
// assert that reply is the correct error packet
|
||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||
assertEquals(XMPPError.Condition.item_not_found,
|
||||
assertEquals(StanzaError.Condition.item_not_found,
|
||||
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.ErrorIQ;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
|
||||
import org.jxmpp.jid.Jid;
|
||||
|
||||
|
@ -38,8 +38,8 @@ public class IBBPacketUtils {
|
|||
* @param condition the XMPP error condition
|
||||
* @return an error IQ
|
||||
*/
|
||||
public static IQ createErrorIQ(Jid from, Jid to, XMPPError.Condition condition) {
|
||||
XMPPError.Builder xmppError = XMPPError.getBuilder(condition);
|
||||
public static IQ createErrorIQ(Jid from, Jid to, StanzaError.Condition condition) {
|
||||
StanzaError.Builder xmppError = StanzaError.getBuilder(condition);
|
||||
IQ errorIQ = new ErrorIQ(xmppError);
|
||||
errorIQ.setType(IQ.Type.error);
|
||||
errorIQ.setFrom(from);
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.jivesoftware.smack.XMPPConnection;
|
|||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
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.bytestreams.ibb.InBandBytestreamManager.StanzaType;
|
||||
|
@ -118,7 +118,7 @@ public class InBandBytestreamManagerTest extends InitExtensions {
|
|||
|
||||
try {
|
||||
IQ errorIQ = IBBPacketUtils.createErrorIQ(targetJID, initiatorJID,
|
||||
XMPPError.Condition.feature_not_implemented);
|
||||
StanzaError.Condition.feature_not_implemented);
|
||||
protocol.addResponse(errorIQ);
|
||||
|
||||
// start In-Band Bytestream
|
||||
|
@ -127,7 +127,7 @@ public class InBandBytestreamManagerTest extends InitExtensions {
|
|||
fail("exception should be thrown");
|
||||
}
|
||||
catch (XMPPErrorException e) {
|
||||
assertEquals(XMPPError.Condition.feature_not_implemented,
|
||||
assertEquals(StanzaError.Condition.feature_not_implemented,
|
||||
e.getXMPPError().getCondition());
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import static org.mockito.Mockito.verify;
|
|||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
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.bytestreams.ibb.packet.Open;
|
||||
|
@ -89,7 +89,7 @@ public class InBandBytestreamRequestTest extends InitExtensions {
|
|||
// assert that reply is the correct error packet
|
||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||
assertEquals(XMPPError.Condition.not_acceptable,
|
||||
assertEquals(StanzaError.Condition.not_acceptable,
|
||||
argument.getValue().getError().getCondition());
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.jivesoftware.smack.StanzaListener;
|
|||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
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.smackx.InitExtensions;
|
||||
|
@ -378,7 +378,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
|
||||
@Override
|
||||
public void verify(IQ request, IQ response) {
|
||||
assertEquals(XMPPError.Condition.unexpected_request,
|
||||
assertEquals(StanzaError.Condition.unexpected_request,
|
||||
request.getError().getCondition());
|
||||
}
|
||||
|
||||
|
@ -417,7 +417,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
|
||||
@Override
|
||||
public void verify(IQ request, IQ response) {
|
||||
assertEquals(XMPPError.Condition.bad_request,
|
||||
assertEquals(StanzaError.Condition.bad_request,
|
||||
request.getError().getCondition());
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import static org.mockito.Mockito.verify;
|
|||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
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.bytestreams.BytestreamRequest;
|
||||
|
@ -97,7 +97,7 @@ public class InitiationListenerTest extends InitExtensions {
|
|||
// assert that reply is the correct error packet
|
||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||
assertEquals(XMPPError.Condition.not_acceptable,
|
||||
assertEquals(StanzaError.Condition.not_acceptable,
|
||||
argument.getValue().getError().getCondition());
|
||||
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ public class InitiationListenerTest extends InitExtensions {
|
|||
// assert that reply is the correct error packet
|
||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||
assertEquals(XMPPError.Condition.resource_constraint,
|
||||
assertEquals(StanzaError.Condition.resource_constraint,
|
||||
argument.getValue().getError().getCondition());
|
||||
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ public class InitiationListenerTest extends InitExtensions {
|
|||
// assert that reply is the correct error packet
|
||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||
assertEquals(XMPPError.Condition.not_acceptable,
|
||||
assertEquals(StanzaError.Condition.not_acceptable,
|
||||
argument.getValue().getError().getCondition());
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import static org.mockito.Mockito.verify;
|
|||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
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.socks5.packet.Bytestream;
|
||||
|
@ -104,7 +104,7 @@ public class InitiationListenerTest {
|
|||
// assert that reply is the correct error packet
|
||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||
assertEquals(XMPPError.Condition.not_acceptable,
|
||||
assertEquals(StanzaError.Condition.not_acceptable,
|
||||
argument.getValue().getError().getCondition());
|
||||
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ public class InitiationListenerTest {
|
|||
// assert that reply is the correct error packet
|
||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||
assertEquals(XMPPError.Condition.not_acceptable,
|
||||
assertEquals(StanzaError.Condition.not_acceptable,
|
||||
argument.getValue().getError().getCondition());
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.jivesoftware.smack.XMPPException;
|
|||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.ErrorIQ;
|
||||
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.StreamHost;
|
||||
|
@ -433,7 +433,7 @@ public class Socks5ByteStreamManagerTest {
|
|||
Verification.requestTypeGET);
|
||||
|
||||
// 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);
|
||||
rejectPacket.setFrom(targetJID);
|
||||
rejectPacket.setTo(initiatorJID);
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.jivesoftware.smack.XMPPException;
|
|||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
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;
|
||||
|
||||
|
@ -120,7 +120,7 @@ public class Socks5ByteStreamRequestTest {
|
|||
assertTrue(IQ.class.isInstance(targetResponse));
|
||||
assertEquals(initiatorJID, targetResponse.getTo());
|
||||
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
|
||||
assertEquals(XMPPError.Condition.item_not_found,
|
||||
assertEquals(StanzaError.Condition.item_not_found,
|
||||
targetResponse.getError().getCondition());
|
||||
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ public class Socks5ByteStreamRequestTest {
|
|||
assertTrue(IQ.class.isInstance(targetResponse));
|
||||
assertEquals(initiatorJID, targetResponse.getTo());
|
||||
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
|
||||
assertEquals(XMPPError.Condition.item_not_found,
|
||||
assertEquals(StanzaError.Condition.item_not_found,
|
||||
targetResponse.getError().getCondition());
|
||||
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ public class Socks5ByteStreamRequestTest {
|
|||
assertTrue(IQ.class.isInstance(targetResponse));
|
||||
assertEquals(initiatorJID, targetResponse.getTo());
|
||||
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
|
||||
assertEquals(XMPPError.Condition.item_not_found,
|
||||
assertEquals(StanzaError.Condition.item_not_found,
|
||||
targetResponse.getError().getCondition());
|
||||
}
|
||||
|
||||
|
@ -304,7 +304,7 @@ public class Socks5ByteStreamRequestTest {
|
|||
assertTrue(IQ.class.isInstance(targetResponse));
|
||||
assertEquals(initiatorJID, targetResponse.getTo());
|
||||
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
|
||||
assertEquals(XMPPError.Condition.item_not_found,
|
||||
assertEquals(StanzaError.Condition.item_not_found,
|
||||
targetResponse.getError().getCondition());
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
|||
import org.jivesoftware.smack.packet.EmptyResultIQ;
|
||||
import org.jivesoftware.smack.packet.ErrorIQ;
|
||||
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.StreamHost;
|
||||
|
@ -205,7 +205,7 @@ public class Socks5ClientForInitiatorTest {
|
|||
public void shouldFailIfActivateSocks5ProxyFails() throws Exception {
|
||||
|
||||
// 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.setTo(initiatorJID);
|
||||
|
||||
|
@ -232,7 +232,7 @@ public class Socks5ClientForInitiatorTest {
|
|||
fail("exception should be thrown");
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ import org.jivesoftware.smack.ThreadedDummyConnection;
|
|||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.IQ.Type;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smack.packet.XMPPError.Condition;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.packet.StanzaError.Condition;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||
|
@ -68,7 +68,7 @@ public class ConfigureFormTest extends InitExtensions {
|
|||
PubSub errorIq = new PubSub();
|
||||
errorIq.setType(Type.error);
|
||||
errorIq.setFrom(PubSubManagerTest.DUMMY_PUBSUB_SERVICE);
|
||||
XMPPError.Builder error = XMPPError.getBuilder(Condition.forbidden);
|
||||
StanzaError.Builder error = StanzaError.getBuilder(Condition.forbidden);
|
||||
errorIq.setError(error);
|
||||
con.addIQReply(errorIq);
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class ConfigureFormTest extends InitExtensions {
|
|||
fail();
|
||||
}
|
||||
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.Presence;
|
||||
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.packet.RosterPacket;
|
||||
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.Presence;
|
||||
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.Item;
|
||||
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.XMPPErrorException;
|
||||
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.DummySmackIntegrationTestFramework;
|
||||
|
@ -85,7 +85,7 @@ public class SmackIntegrationTestFrameworkUnitTest {
|
|||
FailedTest failedTest = failedTests.get(0);
|
||||
assertTrue(failedTest.failureReason instanceof XMPPErrorException);
|
||||
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());
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class SmackIntegrationTestFrameworkUnitTest {
|
|||
public void throwRuntimeExceptionTest() throws XMPPErrorException {
|
||||
Message message = new 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.packet.IQ;
|
||||
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.JingleMediaListener;
|
||||
|
@ -1053,7 +1053,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
IQ errorPacket = null;
|
||||
if (jingleError != null) {
|
||||
// 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);
|
||||
|
||||
errorPacket = IQ.createErrorResponse(iq, builder);
|
||||
|
|
|
@ -48,7 +48,7 @@ import org.jivesoftware.smack.XMPPException;
|
|||
import org.jivesoftware.smack.filter.StanzaFilter;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
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.smackx.carbons.CarbonCopyReceivedListener;
|
||||
|
@ -468,7 +468,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
|
||||
} 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: "
|
||||
+ e.getMessage());
|
||||
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");
|
||||
* 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.Nonza;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.packet.StanzaErrorTextElement;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||
|
||||
public class StreamManagement {
|
||||
|
@ -193,7 +193,7 @@ public class StreamManagement {
|
|||
public static class Failed implements Nonza {
|
||||
public static final String ELEMENT = "failed";
|
||||
|
||||
private final XMPPError.Condition condition;
|
||||
private final StanzaError.Condition condition;
|
||||
|
||||
private final List<StanzaErrorTextElement> textElements;
|
||||
|
||||
|
@ -202,7 +202,7 @@ public class StreamManagement {
|
|||
this(null, null);
|
||||
}
|
||||
|
||||
public Failed(XMPPError.Condition condition, List<StanzaErrorTextElement> textElements) {
|
||||
public Failed(StanzaError.Condition condition, List<StanzaErrorTextElement> textElements) {
|
||||
this.condition = condition;
|
||||
if (textElements == null) {
|
||||
this.textElements = Collections.emptyList();
|
||||
|
@ -211,7 +211,7 @@ public class StreamManagement {
|
|||
}
|
||||
}
|
||||
|
||||
public XMPPError.Condition getXMPPErrorCondition() {
|
||||
public StanzaError.Condition getXMPPErrorCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ public class StreamManagement {
|
|||
if (condition != null) {
|
||||
// TODO This should use StanzaError (formerly XMPPError) in Smack 4.3 (see SMACK-769)
|
||||
xml.append(condition.toString());
|
||||
xml.xmlnsAttribute(XMPPError.NAMESPACE);
|
||||
xml.xmlnsAttribute(StanzaError.NAMESPACE);
|
||||
}
|
||||
xml.append(textElements);
|
||||
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");
|
||||
* 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 org.jivesoftware.smack.packet.AbstractTextElement;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
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.AckRequest;
|
||||
import org.jivesoftware.smack.sm.packet.StreamManagement.Enabled;
|
||||
|
@ -49,7 +49,7 @@ public class ParseStreamManagement {
|
|||
public static Failed failed(XmlPullParser parser) throws XmlPullParserException, IOException {
|
||||
ParserUtils.assertAtStartTag(parser);
|
||||
String name;
|
||||
XMPPError.Condition condition = null;
|
||||
StanzaError.Condition condition = null;
|
||||
List<StanzaErrorTextElement> textElements = new ArrayList<>(4);
|
||||
outerloop:
|
||||
while (true) {
|
||||
|
@ -58,14 +58,14 @@ public class ParseStreamManagement {
|
|||
case XmlPullParser.START_TAG:
|
||||
name = parser.getName();
|
||||
String namespace = parser.getNamespace();
|
||||
if (XMPPError.NAMESPACE.equals(namespace)) {
|
||||
if (StanzaError.NAMESPACE.equals(namespace)) {
|
||||
if (name.equals(AbstractTextElement.ELEMENT)) {
|
||||
String lang = ParserUtils.getXmlLang(parser);
|
||||
String text = parser.nextText();
|
||||
StanzaErrorTextElement stanzaErrorTextElement = new StanzaErrorTextElement(text, lang);
|
||||
textElements.add(stanzaErrorTextElement);
|
||||
} else {
|
||||
condition = XMPPError.Condition.fromString(name);
|
||||
condition = StanzaError.Condition.fromString(name);
|
||||
}
|
||||
}
|
||||
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");
|
||||
* 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
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.jivesoftware.smack.sm.provider;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
|
@ -29,8 +27,8 @@ import java.io.IOException;
|
|||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.packet.StanzaErrorTextElement;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smack.sm.packet.StreamManagement;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
||||
|
@ -92,11 +90,11 @@ public class ParseStreamManagementTest {
|
|||
|
||||
@Test
|
||||
public void testParseFailedError() throws Exception {
|
||||
XMPPError.Condition errorCondition = XMPPError.Condition.unexpected_request;
|
||||
StanzaError.Condition errorCondition = StanzaError.Condition.unexpected_request;
|
||||
|
||||
String failedStanza = XMLBuilder.create("failed")
|
||||
.a("xmlns", "urn:xmpp:sm:3")
|
||||
.element(errorCondition.toString(), XMPPError.NAMESPACE)
|
||||
.element(errorCondition.toString(), StanzaError.NAMESPACE)
|
||||
.asString(outputProperties);
|
||||
|
||||
StreamManagement.Failed failedPacket = ParseStreamManagement.failed(
|
||||
|
@ -120,7 +118,7 @@ public class ParseStreamManagementTest {
|
|||
|
||||
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();
|
||||
assertEquals(1, textElements.size());
|
||||
|
|
Loading…
Reference in a new issue