From 2efec89050ac51b0c1ac08708221c83f7b8ce49c Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 7 Apr 2018 21:25:40 +0200 Subject: [PATCH] Rename XMPPError to StanzaError Fixes SMACK-769. --- .../smack/bosh/XMPPBOSHConnection.java | 4 +- .../smack/AbstractXMPPConnection.java | 10 ++--- .../org/jivesoftware/smack/XMPPException.java | 22 +++++----- .../jivesoftware/smack/packet/ErrorIQ.java | 4 +- .../org/jivesoftware/smack/packet/IQ.java | 14 +++---- .../org/jivesoftware/smack/packet/Packet.java | 4 +- .../org/jivesoftware/smack/packet/Stanza.java | 12 +++--- .../{XMPPError.java => StanzaError.java} | 21 +++++----- .../smack/packet/StanzaErrorTextElement.java | 2 +- .../smack/util/PacketParserUtils.java | 14 +++---- .../smack/packet/IQResponseTest.java | 4 +- .../smack/packet/XMPPErrorTest.java | 6 +-- .../smack/util/PacketParserUtilsTest.java | 24 +++++------ .../element/FileTooLargeError.java | 4 +- .../element/BlockedErrorExtension.java | 4 +- .../ibb/InBandBytestreamManager.java | 8 ++-- .../ibb/InBandBytestreamSession.java | 6 +-- .../socks5/Socks5BytestreamManager.java | 4 +- .../socks5/Socks5BytestreamRequest.java | 4 +- .../smackx/commands/AdHocCommand.java | 4 +- .../smackx/commands/AdHocCommandManager.java | 42 +++++++++---------- .../provider/AdHocCommandDataProvider.java | 4 +- .../smackx/disco/ServiceDiscoveryManager.java | 6 +-- .../filetransfer/FileTransferManager.java | 6 +-- .../filetransfer/FileTransferNegotiator.java | 6 +-- .../filetransfer/OutgoingFileTransfer.java | 4 +- .../smackx/iqlast/LastActivityManager.java | 2 +- .../smackx/iqprivate/PrivateDataManager.java | 2 +- .../smackx/iqversion/VersionManager.java | 2 +- .../smackx/jingle/JingleUtil.java | 22 +++++----- .../jivesoftware/smackx/ping/PingManager.java | 10 ++--- .../smackx/pubsub/PubSubManager.java | 6 +-- .../smackx/time/EntityTimeManager.java | 2 +- .../bytestreams/ibb/CloseListenerTest.java | 4 +- .../bytestreams/ibb/DataListenerTest.java | 4 +- .../bytestreams/ibb/IBBPacketUtils.java | 6 +-- .../ibb/InBandBytestreamManagerTest.java | 6 +-- .../ibb/InBandBytestreamRequestTest.java | 4 +- .../ibb/InBandBytestreamSessionTest.java | 6 +-- .../ibb/InitiationListenerTest.java | 8 ++-- .../socks5/InitiationListenerTest.java | 6 +-- .../socks5/Socks5ByteStreamManagerTest.java | 4 +- .../socks5/Socks5ByteStreamRequestTest.java | 10 ++--- .../socks5/Socks5ClientForInitiatorTest.java | 6 +-- .../smackx/pubsub/ConfigureFormTest.java | 8 ++-- .../org/jivesoftware/smack/roster/Roster.java | 2 +- .../jivesoftware/smack/roster/RosterTest.java | 2 +- ...SmackIntegrationTestFrameworkUnitTest.java | 6 +-- .../smackx/jingleold/JingleSession.java | 4 +- .../smackx/omemo/OmemoService.java | 4 +- .../smack/sm/packet/StreamManagement.java | 12 +++--- .../sm/provider/ParseStreamManagement.java | 10 ++--- .../provider/ParseStreamManagementTest.java | 12 +++--- 53 files changed, 205 insertions(+), 208 deletions(-) rename smack-core/src/main/java/org/jivesoftware/smack/packet/{XMPPError.java => StanzaError.java} (93%) diff --git a/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java b/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java index 49096704f..e4732bf40 100644 --- a/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java +++ b/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java @@ -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()); } } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java index 61e4c12a0..24f9238dc 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java @@ -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); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/XMPPException.java b/smack-core/src/main/java/org/jivesoftware/smack/XMPPException.java index b85546729..2fe2386a6 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/XMPPException.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/XMPPException.java @@ -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; } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/ErrorIQ.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/ErrorIQ.java index 12cff6e3f..c09a09f38 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/ErrorIQ.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/ErrorIQ.java @@ -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 { *

* @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); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java index c9ddf3345..de06f681a 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java @@ -263,7 +263,7 @@ public abstract class IQ extends Stanza { *
  • The type set to {@link Type#error IQ.Type.error}. *
  • The id set to the id of the originating IQ. *
  • The child element contained in the associated originating IQ. - *
  • The provided {@link XMPPError XMPPError}. + *
  • The provided {@link StanzaError XMPPError}. * * * @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 { *
  • The type set to {@link Type#error IQ.Type.error}. *
  • The id set to the id of the originating IQ. *
  • The child element contained in the associated originating IQ. - *
  • The provided {@link XMPPError XMPPError}. + *
  • The provided {@link StanzaError XMPPError}. * * * @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)); } /** diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java index b26001e17..53672167d 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java @@ -105,13 +105,13 @@ public interface Packet extends TopLevelStreamElement { * * @return the error sub-packet or null 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. diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java index d5693f491..11f4088ad 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java @@ -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 null 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()); } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaError.java similarity index 93% rename from smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java rename to smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaError.java index 654409480..a1db639eb 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaError.java @@ -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 RFC 6120 - 8.3.2 Syntax: The Syntax of XMPP error stanzas */ -// 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_TO_TYPE = new HashMap(); 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 descriptiveTexts, + public StanzaError(Condition condition, String conditionText, String errorGenerator, Type type, Map descriptiveTexts, List 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 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); } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaErrorTextElement.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaErrorTextElement.java index a593ffc9d..2af6d85b9 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaErrorTextElement.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaErrorTextElement.java @@ -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); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java b/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java index da7a9c650..f9dcbc360 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java @@ -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 descriptiveTexts = null; List 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()); } diff --git a/smack-core/src/test/java/org/jivesoftware/smack/packet/IQResponseTest.java b/smack-core/src/test/java/org/jivesoftware/smack/packet/IQResponseTest.java index 993fdb5ce..edc500db3 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/packet/IQResponseTest.java +++ b/smack-core/src/test/java/org/jivesoftware/smack/packet/IQResponseTest.java @@ -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); diff --git a/smack-core/src/test/java/org/jivesoftware/smack/packet/XMPPErrorTest.java b/smack-core/src/test/java/org/jivesoftware/smack/packet/XMPPErrorTest.java index f2e84a3f7..b7ec7479b 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/packet/XMPPErrorTest.java +++ b/smack-core/src/test/java/org/jivesoftware/smack/packet/XMPPErrorTest.java @@ -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 conditionToTypeMap = XMPPError.CONDITION_TO_TYPE; + Map conditionToTypeMap = StanzaError.CONDITION_TO_TYPE; assertEquals("CONDITION_TO_TYPE map is likely out of sync with Condition enum", Condition.values().length, conditionToTypeMap.size()); diff --git a/smack-core/src/test/java/org/jivesoftware/smack/util/PacketParserUtilsTest.java b/smack-core/src/test/java/org/jivesoftware/smack/util/PacketParserUtilsTest.java index 5674a1058..261d1dce2 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/util/PacketParserUtilsTest.java +++ b/smack-core/src/test/java/org/jivesoftware/smack/util/PacketParserUtilsTest.java @@ -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 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 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()); } } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/element/FileTooLargeError.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/element/FileTooLargeError.java index a0fcb7d04..909780e4e 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/element/FileTooLargeError.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/element/FileTooLargeError.java @@ -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; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/element/BlockedErrorExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/element/BlockedErrorExtension.java index 0e04e7f03..2ab93ddeb 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/element/BlockedErrorExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/element/BlockedErrorExtension.java @@ -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; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManager.java index 828405420..1ab8a0447 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManager.java @@ -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); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java index af8169171..a78ea1587 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java @@ -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; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamManager.java index 677302f95..30048a7e8 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamManager.java @@ -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); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamRequest.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamRequest.java index 3182bbda3..3acccf5d0 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamRequest.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamRequest.java @@ -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()); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommand.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommand.java index 48a2ca8c7..37028483d 100755 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommand.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommand.java @@ -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()) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java index 81fd9fbf2..5a7e72125 100755 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java @@ -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; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/provider/AdHocCommandDataProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/provider/AdHocCommandDataProvider.java index 050d31829..bc64d2e78 100755 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/provider/AdHocCommandDataProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/provider/AdHocCommandDataProvider.java @@ -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.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); } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java index d42fc481c..aeee98e8f 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java @@ -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 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 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; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferManager.java index 21b0e4cab..ced4802d9 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferManager.java @@ -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); } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferNegotiator.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferNegotiator.java index 3f618776d..59b1fdf15 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferNegotiator.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferNegotiator.java @@ -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; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/OutgoingFileTransfer.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/OutgoingFileTransfer.java index eb1b2fceb..d4562a42e 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/OutgoingFileTransfer.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/OutgoingFileTransfer.java @@ -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: diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqlast/LastActivityManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqlast/LastActivityManager.java index bbde6c1d1..4d3954b9c 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqlast/LastActivityManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqlast/LastActivityManager.java @@ -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; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java index b9534ac7b..c47db4291 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java @@ -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; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqversion/VersionManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqversion/VersionManager.java index 18727e0c8..8ce82ba11 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqversion/VersionManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqversion/VersionManager.java @@ -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; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleUtil.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleUtil.java index 9cad9a9da..e2292ee0b 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleUtil.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleUtil.java @@ -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) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/ping/PingManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/ping/PingManager.java index b291d3e00..e60bea159 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/ping/PingManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/ping/PingManager.java @@ -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 pingAsync(Jid jid) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java index df7d9320c..94fd03bf9 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java @@ -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; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/time/EntityTimeManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/time/EntityTimeManager.java index 42ae9eb9a..6aed93211 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/time/EntityTimeManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/time/EntityTimeManager.java @@ -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; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/CloseListenerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/CloseListenerTest.java index 2fb886b1c..c93d27a21 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/CloseListenerTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/CloseListenerTest.java @@ -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()); } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/DataListenerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/DataListenerTest.java index bdd4dd495..ebd52489c 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/DataListenerTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/DataListenerTest.java @@ -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()); } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/IBBPacketUtils.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/IBBPacketUtils.java index 164761a27..37a0e3f6d 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/IBBPacketUtils.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/IBBPacketUtils.java @@ -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); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManagerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManagerTest.java index ff9997f89..52bc20deb 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManagerTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManagerTest.java @@ -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()); } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamRequestTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamRequestTest.java index 572bb2c79..75a461e5f 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamRequestTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamRequestTest.java @@ -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()); } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionTest.java index 16620ec52..9282bf18d 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionTest.java @@ -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()); } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InitiationListenerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InitiationListenerTest.java index c91f09960..7947f0a05 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InitiationListenerTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InitiationListenerTest.java @@ -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()); } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/InitiationListenerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/InitiationListenerTest.java index b70acfc4a..bb6eb109d 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/InitiationListenerTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/InitiationListenerTest.java @@ -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()); } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamManagerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamManagerTest.java index 50a0ee505..53dc4b17c 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamManagerTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamManagerTest.java @@ -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); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamRequestTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamRequestTest.java index b21ca8758..bcbe0105d 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamRequestTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamRequestTest.java @@ -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()); } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientForInitiatorTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientForInitiatorTest.java index 54259cd3b..86ea9e48b 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientForInitiatorTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientForInitiatorTest.java @@ -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(); } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ConfigureFormTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ConfigureFormTest.java index 5c2f6119f..852d164f5 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ConfigureFormTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ConfigureFormTest.java @@ -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()); } } diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java index a84e559f9..4693da83b 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java @@ -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; diff --git a/smack-im/src/test/java/org/jivesoftware/smack/roster/RosterTest.java b/smack-im/src/test/java/org/jivesoftware/smack/roster/RosterTest.java index 6372e28d8..a85246082 100644 --- a/smack-im/src/test/java/org/jivesoftware/smack/roster/RosterTest.java +++ b/smack-im/src/test/java/org/jivesoftware/smack/roster/RosterTest.java @@ -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; diff --git a/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/unittest/SmackIntegrationTestFrameworkUnitTest.java b/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/unittest/SmackIntegrationTestFrameworkUnitTest.java index 4ff7501c6..1d54bce4d 100644 --- a/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/unittest/SmackIntegrationTestFrameworkUnitTest.java +++ b/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/unittest/SmackIntegrationTestFrameworkUnitTest.java @@ -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()); } } diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java index 59d67058f..65113b998 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java @@ -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); diff --git a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java index f1c9ac796..e9e0297f3 100644 --- a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java +++ b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java @@ -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 textElements; @@ -202,7 +202,7 @@ public class StreamManagement { this(null, null); } - public Failed(XMPPError.Condition condition, List textElements) { + public Failed(StanzaError.Condition condition, List 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); diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/provider/ParseStreamManagement.java b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/provider/ParseStreamManagement.java index bf832db3d..d88d54fe6 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/provider/ParseStreamManagement.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/provider/ParseStreamManagement.java @@ -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 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; diff --git a/smack-tcp/src/test/java/org/jivesoftware/smack/sm/provider/ParseStreamManagementTest.java b/smack-tcp/src/test/java/org/jivesoftware/smack/sm/provider/ParseStreamManagementTest.java index 845930ca1..15bae3c11 100644 --- a/smack-tcp/src/test/java/org/jivesoftware/smack/sm/provider/ParseStreamManagementTest.java +++ b/smack-tcp/src/test/java/org/jivesoftware/smack/sm/provider/ParseStreamManagementTest.java @@ -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 textElements = failed.getTextElements(); assertEquals(1, textElements.size());