1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-24 21:12:05 +01:00

Use XmlEnvironment in parsing/provider subsystem

This commit is contained in:
Florian Schmaus 2019-02-15 23:21:30 +01:00
parent 43bb418d99
commit 8df69bd3ce
188 changed files with 486 additions and 264 deletions

View file

@ -104,6 +104,7 @@ import org.jivesoftware.smack.packet.StartTls;
import org.jivesoftware.smack.packet.StreamError;
import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smack.packet.TopLevelStreamElement;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.ParsingExceptionCallback;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
@ -226,6 +227,8 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
private final Map<StanzaListener, InterceptorWrapper> interceptors =
new HashMap<>();
private XmlEnvironment incomingStreamXmlEnvironment;
final Map<String, NonzaCallback> nonzaCallbacks = new HashMap<>();
protected final Lock connectionLock = new ReentrantLock();
@ -1187,7 +1190,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
return;
}
Nonza nonza = nonzaProvider.parse(parser);
Nonza nonza = nonzaProvider.parse(parser, incomingStreamXmlEnvironment);
nonzaCallback.onNonzaReceived(nonza);
}
@ -1198,7 +1201,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
int parserDepth = parser.getDepth();
Stanza stanza = null;
try {
stanza = PacketParserUtils.parseStanza(parser);
stanza = PacketParserUtils.parseStanza(parser, incomingStreamXmlEnvironment);
}
catch (Exception e) {
CharSequence content = PacketParserUtils.parseContentDepth(parser,
@ -1596,7 +1599,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
default:
ExtensionElementProvider<ExtensionElement> provider = ProviderManager.getStreamFeatureProvider(name, namespace);
if (provider != null) {
streamFeature = provider.parse(parser);
streamFeature = provider.parse(parser, incomingStreamXmlEnvironment);
}
break;
}
@ -1844,6 +1847,8 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
// We found an opening stream.
if ("jabber:client".equals(parser.getNamespace(null))) {
streamId = parser.getAttributeValue("", "id");
incomingStreamXmlEnvironment = XmlEnvironment.from(parser);
String reportedServerDomain = parser.getAttributeValue("", "from");
assert (config.getXMPPServiceDomain().equals(reportedServerDomain));
}

View file

@ -17,6 +17,7 @@
package org.jivesoftware.smack.compress.provider;
import org.jivesoftware.smack.compress.packet.Compressed;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.NonzaProvider;
import org.xmlpull.v1.XmlPullParser;
@ -29,7 +30,7 @@ public final class CompressedProvider extends NonzaProvider<Compressed> {
}
@Override
public Compressed parse(XmlPullParser parser, int initialDepth) {
public Compressed parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return Compressed.INSTANCE;
}

View file

@ -22,6 +22,7 @@ import java.util.logging.Logger;
import org.jivesoftware.smack.compress.packet.Failure;
import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.NonzaProvider;
import org.jivesoftware.smack.util.PacketParserUtils;
@ -39,9 +40,10 @@ public final class FailureProvider extends NonzaProvider<Failure> {
}
@Override
public Failure parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
public Failure parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
Failure.CompressFailureError compressFailureError = null;
StanzaError stanzaError = null;
XmlEnvironment failureXmlEnvironment = XmlEnvironment.from(parser, xmlEnvironment);
outerloop: while (true) {
int eventType = parser.next();
@ -60,7 +62,7 @@ public final class FailureProvider extends NonzaProvider<Failure> {
case StreamOpen.SERVER_NAMESPACE:
switch (name) {
case StanzaError.ERROR:
StanzaError.Builder stanzaErrorBuilder = PacketParserUtils.parseError(parser);
StanzaError.Builder stanzaErrorBuilder = PacketParserUtils.parseError(parser, failureXmlEnvironment);
stanzaError = stanzaErrorBuilder.build();
break;
default:

View file

@ -328,7 +328,7 @@ public abstract class AbstractXmppStateMachineConnection extends AbstractXMPPCon
}
break;
case "error":
StreamError streamError = PacketParserUtils.parseStreamError(parser);
StreamError streamError = PacketParserUtils.parseStreamError(parser, null);
saslFeatureReceived.reportFailure(new StreamErrorException(streamError));
throw new StreamErrorException(streamError);
case "features":

View file

@ -16,8 +16,11 @@
*/
package org.jivesoftware.smack.packet;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.util.StringUtils;
import org.xmlpull.v1.XmlPullParser;
public class XmlEnvironment {
public static final XmlEnvironment EMPTY = new XmlEnvironment((String) null);
@ -43,7 +46,7 @@ public class XmlEnvironment {
this(builder.namespace, builder.language, builder.next);
}
private XmlEnvironment(String namespace, String language, XmlEnvironment next) {
public XmlEnvironment(String namespace, String language, XmlEnvironment next) {
this.namespace = namespace;
this.language = language;
this.next = next;
@ -103,6 +106,16 @@ public class XmlEnvironment {
return effectiveLanguage;
}
public static XmlEnvironment from(XmlPullParser parser) {
return from(parser, null);
}
public static XmlEnvironment from(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) {
String namespace = parser.getNamespace();
String xmlLang = ParserUtils.getXmlLang(parser);
return new XmlEnvironment(namespace, xmlLang, outerXmlEnvironment);
}
public static Builder builder() {
return new Builder();
}

View file

@ -21,6 +21,7 @@ import java.util.LinkedHashMap;
import java.util.Map;
import org.jivesoftware.smack.packet.StandardExtensionElement;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.util.StringUtils;
@ -39,7 +40,7 @@ public class StandardExtensionElementProvider extends ExtensionElementProvider<S
public static StandardExtensionElementProvider INSTANCE = new StandardExtensionElementProvider();
@Override
public StandardExtensionElement parse(final XmlPullParser parser, final int initialDepth)
public StandardExtensionElement parse(final XmlPullParser parser, final int initialDepth, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException {
// Unlike most (all?) other providers, we don't know the name and namespace of the element
// we are parsing here.
@ -79,7 +80,7 @@ public class StandardExtensionElementProvider extends ExtensionElementProvider<S
int event = parser.next();
switch (event) {
case XmlPullParser.START_TAG:
builder.addElement(parse(parser, parser.getDepth()));
builder.addElement(parse(parser, parser.getDepth(), xmlEnvironment));
break;
case XmlPullParser.TEXT:
builder.setText(parser.getText());

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smack.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.Bind;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jxmpp.jid.EntityFullJid;
import org.jxmpp.jid.impl.JidCreate;
@ -29,7 +30,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class BindIQProvider extends IQProvider<Bind> {
@Override
public Bind parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public Bind parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
String name;
Bind bind = null;
outerloop: while (true) {

View file

@ -21,6 +21,7 @@ import static org.jivesoftware.smack.util.PacketParserUtils.parseElementText;
import java.io.IOException;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.util.ParserUtils;
import org.xmlpull.v1.XmlPullParser;
@ -29,7 +30,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class BodyElementProvider extends ExtensionElementProvider<Message.Body> {
@Override
public Message.Body parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public Message.Body parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
String xmlLang = ParserUtils.getXmlLang(parser);
String body = parseElementText(parser);

View file

@ -23,6 +23,7 @@ import java.util.List;
import java.util.Map;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.util.PacketParserUtils;
@ -85,7 +86,7 @@ import org.xmlpull.v1.XmlPullParserException;
public abstract class EmbeddedExtensionProvider<PE extends ExtensionElement> extends ExtensionElementProvider<PE> {
@Override
public final PE parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
public final PE parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
final String namespace = parser.getNamespace();
final String name = parser.getName();
final int attributeCount = parser.getAttributeCount();
@ -101,7 +102,7 @@ public abstract class EmbeddedExtensionProvider<PE extends ExtensionElement> ext
event = parser.next();
if (event == XmlPullParser.START_TAG)
PacketParserUtils.addExtensionElement(extensions, parser);
PacketParserUtils.addExtensionElement(extensions, parser, xmlEnvironment);
}
while (!(event == XmlPullParser.END_TAG && parser.getDepth() == initialDepth));

View file

@ -21,6 +21,7 @@ import java.lang.reflect.InvocationTargetException;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.util.ParserUtils;
import org.xmlpull.v1.XmlPullParser;
@ -39,7 +40,7 @@ public class IntrospectionProvider{
@SuppressWarnings("unchecked")
@Override
public I parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public I parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
try {
return (I) parseWithIntrospection(elementClass, parser, initialDepth);
}
@ -60,7 +61,7 @@ public class IntrospectionProvider{
@SuppressWarnings("unchecked")
@Override
public PE parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public PE parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
try {
return (PE) parseWithIntrospection(elementClass, parser, initialDepth);
}

View file

@ -22,6 +22,7 @@ import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import org.jivesoftware.smack.packet.Element;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.util.ParserUtils;
@ -31,7 +32,7 @@ import org.xmlpull.v1.XmlPullParserException;
/**
* Smack provider are the parsers used to deserialize raw XMPP into the according Java {@link Element}s.
* <p>
* At any time when {@link #parse(XmlPullParser, int)} is invoked any type of exception can be thrown. If the parsed
* At any time when {@link #parse(XmlPullParser, int, XmlEnvironment)} is invoked any type of exception can be thrown. If the parsed
* element does not follow the specification, for example by putting a string where only integers are allowed, then a
* {@link org.jivesoftware.smack.SmackException} should be thrown.
* </p>
@ -62,16 +63,22 @@ public abstract class Provider<E extends Element> {
}
public final E parse(XmlPullParser parser) throws IOException, XmlPullParserException, SmackParsingException {
return parse(parser, null);
}
public final E parse(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws IOException, XmlPullParserException, SmackParsingException {
// XPP3 calling convention assert: Parser should be at start tag
ParserUtils.assertAtStartTag(parser);
final int initialDepth = parser.getDepth();
E e = parse(parser, initialDepth);
final XmlEnvironment xmlEnvironment = XmlEnvironment.from(parser, outerXmlEnvironment);
E e = parse(parser, initialDepth, xmlEnvironment);
// XPP3 calling convention assert: Parser should be at end tag of the consumed/parsed element
ParserUtils.forwardToEndTagOfDepth(parser, initialDepth);
return e;
}
public abstract E parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException;
public abstract E parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException;
}

View file

@ -17,6 +17,7 @@
package org.jivesoftware.smack.provider;
import org.jivesoftware.smack.packet.TlsProceed;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.xmlpull.v1.XmlPullParser;
@ -28,7 +29,7 @@ public final class TlsFailureProvider extends NonzaProvider<TlsProceed> {
}
@Override
public TlsProceed parse(XmlPullParser parser, int initialDepth) {
public TlsProceed parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return TlsProceed.INSTANCE;
}

View file

@ -17,6 +17,7 @@
package org.jivesoftware.smack.provider;
import org.jivesoftware.smack.packet.TlsFailure;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.xmlpull.v1.XmlPullParser;
@ -28,7 +29,7 @@ public final class TlsProceedProvider extends NonzaProvider<TlsFailure> {
}
@Override
public TlsFailure parse(XmlPullParser parser, int initialDepth) {
public TlsFailure parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return TlsFailure.INSTANCE;
}

View file

@ -42,6 +42,7 @@ 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.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.parsing.StandardExtensionElementProvider;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
@ -137,7 +138,7 @@ public class PacketParserUtils {
@SuppressWarnings("unchecked")
public static <S extends Stanza> S parseStanza(String stanza) throws Exception {
return (S) parseStanza(getParserFor(stanza));
return (S) parseStanza(getParserFor(stanza), null);
}
/**
@ -146,19 +147,20 @@ public class PacketParserUtils {
* connection is optional and is used to return feature-not-implemented errors for unknown IQ stanzas.
*
* @param parser
* @param outerXmlEnvironment the outer XML environment (optional).
* @return a stanza which is either a Message, IQ or Presence.
* @throws Exception
*/
public static Stanza parseStanza(XmlPullParser parser) throws Exception {
public static Stanza parseStanza(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws Exception {
ParserUtils.assertAtStartTag(parser);
final String name = parser.getName();
switch (name) {
case Message.ELEMENT:
return parseMessage(parser);
return parseMessage(parser, outerXmlEnvironment);
case IQ.IQ_ELEMENT:
return parseIQ(parser);
return parseIQ(parser, outerXmlEnvironment);
case Presence.ELEMENT:
return parsePresence(parser);
return parsePresence(parser, outerXmlEnvironment);
default:
throw new IllegalArgumentException("Can only parse message, iq or presence, not " + name);
}
@ -211,19 +213,25 @@ public class PacketParserUtils {
return parser;
}
public static Message parseMessage(XmlPullParser parser) throws XmlPullParserException, IOException, SmackParsingException {
return parseMessage(parser, null);
}
/**
* Parses a message packet.
*
* @param parser the XML parser, positioned at the start of a message packet.
* @param outerXmlEnvironment the outer XML environment (optional).
* @return a Message packet.
* @throws XmlPullParserException
* @throws IOException
* @throws SmackParsingException
*/
public static Message parseMessage(XmlPullParser parser) throws XmlPullParserException, IOException, SmackParsingException {
public static Message parseMessage(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
ParserUtils.assertAtStartTag(parser);
assert (parser.getName().equals(Message.ELEMENT));
XmlEnvironment messageXmlEnvironment = XmlEnvironment.from(parser, outerXmlEnvironment);
final int initialDepth = parser.getDepth();
Message message = new Message();
message.setStanzaId(parser.getAttributeValue("", "id"));
@ -261,10 +269,10 @@ public class PacketParserUtils {
}
break;
case "error":
message.setError(parseError(parser));
message.setError(parseError(parser, messageXmlEnvironment));
break;
default:
PacketParserUtils.addExtensionElement(message, parser, elementName, namespace);
PacketParserUtils.addExtensionElement(message, parser, elementName, namespace, messageXmlEnvironment);
break;
}
break;
@ -497,18 +505,24 @@ public class PacketParserUtils {
return sb;
}
public static Presence parsePresence(XmlPullParser parser) throws XmlPullParserException, IOException, SmackParsingException {
return parsePresence(parser, null);
}
/**
* Parses a presence packet.
*
* @param parser the XML parser, positioned at the start of a presence packet.
* @param outerXmlEnvironment the outer XML environment (optional).
* @return a Presence packet.
* @throws IOException
* @throws XmlPullParserException
* @throws SmackParsingException
*/
public static Presence parsePresence(XmlPullParser parser) throws XmlPullParserException, IOException, SmackParsingException {
public static Presence parsePresence(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
ParserUtils.assertAtStartTag(parser);
final int initialDepth = parser.getDepth();
XmlEnvironment presenceXmlEnvironment = XmlEnvironment.from(parser, outerXmlEnvironment);
Presence.Type type = Presence.Type.available;
String typeString = parser.getAttributeValue("", "type");
@ -558,14 +572,14 @@ public class PacketParserUtils {
}
break;
case "error":
presence.setError(parseError(parser));
presence.setError(parseError(parser, presenceXmlEnvironment));
break;
default:
// Otherwise, it must be a packet extension.
// Be extra robust: Skip PacketExtensions that cause Exceptions, instead of
// failing completely here. See SMACK-390 for more information.
try {
PacketParserUtils.addExtensionElement(presence, parser, elementName, namespace);
PacketParserUtils.addExtensionElement(presence, parser, elementName, namespace, presenceXmlEnvironment);
} catch (Exception e) {
LOGGER.warning("Failed to parse extension element in Presence stanza: \"" + e + "\" from: '"
+ presence.getFrom() + " id: '" + presence.getStanzaId() + "'");
@ -583,16 +597,22 @@ public class PacketParserUtils {
return presence;
}
public static IQ parseIQ(XmlPullParser parser) throws Exception {
return parseIQ(parser, null);
}
/**
* Parses an IQ packet.
*
* @param parser the XML parser, positioned at the start of an IQ packet.
* @param outerXmlEnvironment the outer XML environment (optional).
* @return an IQ object.
* @throws Exception
*/
public static IQ parseIQ(XmlPullParser parser) throws Exception {
public static IQ parseIQ(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws Exception {
ParserUtils.assertAtStartTag(parser);
final int initialDepth = parser.getDepth();
XmlEnvironment iqXmlEnvironment = XmlEnvironment.from(parser, outerXmlEnvironment);
IQ iqPacket = null;
StanzaError.Builder error = null;
@ -610,14 +630,14 @@ public class PacketParserUtils {
String namespace = parser.getNamespace();
switch (elementName) {
case "error":
error = PacketParserUtils.parseError(parser);
error = PacketParserUtils.parseError(parser, iqXmlEnvironment);
break;
// Otherwise, see if there is a registered provider for
// this element name and namespace.
default:
IQProvider<IQ> provider = ProviderManager.getIQProvider(elementName, namespace);
if (provider != null) {
iqPacket = provider.parse(parser);
iqPacket = provider.parse(parser, outerXmlEnvironment);
}
// Note that if we reach this code, it is guranteed that the result IQ contained a child element
// (RFC 6120 § 8.2.3 6) because otherwhise we would have reached the END_TAG first.
@ -784,21 +804,27 @@ public class PacketParserUtils {
return new SASLFailure(condition, descriptiveTexts);
}
public static StreamError parseStreamError(XmlPullParser parser) throws XmlPullParserException, IOException, SmackParsingException {
return parseStreamError(parser, null);
}
/**
* Parses stream error packets.
*
* @param parser the XML parser.
* @param outerXmlEnvironment the outer XML environment (optional).
* @return an stream error packet.
* @throws IOException
* @throws XmlPullParserException
* @throws SmackParsingException
*/
public static StreamError parseStreamError(XmlPullParser parser) throws XmlPullParserException, IOException, SmackParsingException {
public static StreamError parseStreamError(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
final int initialDepth = parser.getDepth();
List<ExtensionElement> extensions = new ArrayList<>();
Map<String, String> descriptiveTexts = null;
StreamError.Condition condition = null;
String conditionText = null;
XmlEnvironment streamErrorXmlEnvironment = XmlEnvironment.from(parser, outerXmlEnvironment);
outerloop: while (true) {
int eventType = parser.next();
switch (eventType) {
@ -822,7 +848,7 @@ public class PacketParserUtils {
}
break;
default:
PacketParserUtils.addExtensionElement(extensions, parser, name, namespace);
PacketParserUtils.addExtensionElement(extensions, parser, name, namespace, streamErrorXmlEnvironment);
break;
}
break;
@ -836,18 +862,24 @@ public class PacketParserUtils {
return new StreamError(condition, conditionText, descriptiveTexts, extensions);
}
public static StanzaError.Builder parseError(XmlPullParser parser) throws XmlPullParserException, IOException, SmackParsingException {
return parseError(parser, null);
}
/**
* Parses error sub-packets.
*
* @param parser the XML parser.
* @param outerXmlEnvironment the outer XML environment (optional).
* @return an error sub-packet.
* @throws IOException
* @throws XmlPullParserException
* @throws SmackParsingException
*/
public static StanzaError.Builder parseError(XmlPullParser parser) throws XmlPullParserException, IOException, SmackParsingException {
public static StanzaError.Builder parseError(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
final int initialDepth = parser.getDepth();
Map<String, String> descriptiveTexts = null;
XmlEnvironment stanzaErrorXmlEnvironment = XmlEnvironment.from(parser, outerXmlEnvironment);
List<ExtensionElement> extensions = new ArrayList<>();
StanzaError.Builder builder = StanzaError.getBuilder();
@ -876,7 +908,7 @@ public class PacketParserUtils {
}
break;
default:
PacketParserUtils.addExtensionElement(extensions, parser, name, namespace);
PacketParserUtils.addExtensionElement(extensions, parser, name, namespace, stanzaErrorXmlEnvironment);
}
break;
case XmlPullParser.END_TAG:
@ -895,23 +927,7 @@ public class PacketParserUtils {
* @param elementName the XML element name of the extension element.
* @param namespace the XML namespace of the stanza extension.
* @param parser the XML parser, positioned at the starting element of the extension.
*
* @return an extension element.
* @throws Exception when an error occurs during parsing.
* @deprecated use {@link #parseExtensionElement(String, String, XmlPullParser)} instead.
*/
@Deprecated
public static ExtensionElement parsePacketExtension(String elementName, String namespace,
XmlPullParser parser) throws Exception {
return parseExtensionElement(elementName, namespace, parser);
}
/**
* Parses an extension element.
*
* @param elementName the XML element name of the extension element.
* @param namespace the XML namespace of the stanza extension.
* @param parser the XML parser, positioned at the starting element of the extension.
* @param outerXmlEnvironment the outer XML environment (optional).
*
* @return an extension element.
* @throws XmlPullParserException
@ -919,16 +935,16 @@ public class PacketParserUtils {
* @throws SmackParsingException
*/
public static ExtensionElement parseExtensionElement(String elementName, String namespace,
XmlPullParser parser) throws XmlPullParserException, IOException, SmackParsingException {
XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
ParserUtils.assertAtStartTag(parser);
// See if a provider is registered to handle the extension.
ExtensionElementProvider<ExtensionElement> provider = ProviderManager.getExtensionProvider(elementName, namespace);
if (provider != null) {
return provider.parse(parser);
return provider.parse(parser, outerXmlEnvironment);
}
// No providers registered, so use a default extension.
return StandardExtensionElementProvider.INSTANCE.parse(parser);
return StandardExtensionElementProvider.INSTANCE.parse(parser, outerXmlEnvironment);
}
public static StartTls parseStartTlsFeature(XmlPullParser parser)
@ -987,26 +1003,26 @@ public class PacketParserUtils {
return new Session.Feature(optional);
}
public static void addExtensionElement(Stanza packet, XmlPullParser parser)
public static void addExtensionElement(Stanza packet, XmlPullParser parser, XmlEnvironment outerXmlEnvironment)
throws XmlPullParserException, IOException, SmackParsingException {
ParserUtils.assertAtStartTag(parser);
addExtensionElement(packet, parser, parser.getName(), parser.getNamespace());
addExtensionElement(packet, parser, parser.getName(), parser.getNamespace(), outerXmlEnvironment);
}
public static void addExtensionElement(Stanza packet, XmlPullParser parser, String elementName,
String namespace) throws XmlPullParserException, IOException, SmackParsingException {
ExtensionElement packetExtension = parseExtensionElement(elementName, namespace, parser);
String namespace, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
ExtensionElement packetExtension = parseExtensionElement(elementName, namespace, parser, outerXmlEnvironment);
packet.addExtension(packetExtension);
}
public static void addExtensionElement(Collection<ExtensionElement> collection, XmlPullParser parser)
public static void addExtensionElement(Collection<ExtensionElement> collection, XmlPullParser parser, XmlEnvironment outerXmlEnvironment)
throws XmlPullParserException, IOException, SmackParsingException {
addExtensionElement(collection, parser, parser.getName(), parser.getNamespace());
addExtensionElement(collection, parser, parser.getName(), parser.getNamespace(), outerXmlEnvironment);
}
public static void addExtensionElement(Collection<ExtensionElement> collection, XmlPullParser parser,
String elementName, String namespace) throws XmlPullParserException, IOException, SmackParsingException {
ExtensionElement packetExtension = parseExtensionElement(elementName, namespace, parser);
String elementName, String namespace, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
ExtensionElement packetExtension = parseExtensionElement(elementName, namespace, parser, outerXmlEnvironment);
collection.add(packetExtension);
}
}

View file

@ -22,6 +22,7 @@ import static org.junit.Assert.assertThat;
import java.io.IOException;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.provider.ProviderManager;
import org.jivesoftware.smack.test.util.TestUtils;
@ -79,7 +80,7 @@ public class ParsingExceptionTest {
public static final String NAMESPACE = "http://smack.jivesoftware.org/exception";
@Override
public ExtensionElement parse(XmlPullParser parser, int initialDepth) throws IOException {
public ExtensionElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws IOException {
throw new IOException("Test Exception");
}

View file

@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.Collection;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.util.FileUtils;
import org.junit.Assert;
@ -62,7 +63,7 @@ public class ProviderConfigTest {
public static class TestIQProvider extends IQProvider<IQ> {
@Override
public IQ parse(XmlPullParser parser, int initialDepth) {
public IQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return null;
}

View file

@ -1,6 +1,6 @@
/**
*
* Copyright © 2014 Florian Schmaus
* Copyright © 2014-2019 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -20,6 +20,7 @@ import static org.junit.Assert.assertTrue;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.junit.Test;
import org.xmlpull.v1.XmlPullParser;
@ -38,7 +39,7 @@ public class ProviderManagerTest {
public static class TestIQProvider extends IQProvider<IQ> {
@Override
public IQ parse(XmlPullParser parser, int initialDepth) {
public IQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return null;
}

View file

@ -21,6 +21,7 @@ import java.io.Reader;
import java.io.StringReader;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.util.ParserUtils;
@ -80,15 +81,15 @@ public final class TestUtils {
public static <EE extends ExtensionElement> EE parseExtensionElement(String elementString)
throws Exception {
return parseExtensionElement(getParser(elementString));
return parseExtensionElement(getParser(elementString), null);
}
@SuppressWarnings("unchecked")
public static <EE extends ExtensionElement> EE parseExtensionElement(XmlPullParser parser)
public static <EE extends ExtensionElement> EE parseExtensionElement(XmlPullParser parser, XmlEnvironment outerXmlEnvironment)
throws Exception {
ParserUtils.assertAtStartTag(parser);
final String elementName = parser.getName();
final String namespace = parser.getNamespace();
return (EE) PacketParserUtils.parseExtensionElement(elementName, namespace, parser);
return (EE) PacketParserUtils.parseExtensionElement(elementName, namespace, parser, outerXmlEnvironment);
}
}

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.carbons.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
@ -41,7 +42,7 @@ public class CarbonManagerProvider extends ExtensionElementProvider<CarbonExtens
private static final ForwardedProvider FORWARDED_PROVIDER = new ForwardedProvider();
@Override
public CarbonExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
public CarbonExtension parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
Direction dir = Direction.valueOf(parser.getName());
Forwarded fwd = null;

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.chat_markers.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.chat_markers.element.ChatMarkersElements.AcknowledgedExtension;
@ -33,7 +34,7 @@ import org.xmlpull.v1.XmlPullParser;
public class AcknowledgedProvider extends ExtensionElementProvider<AcknowledgedExtension> {
@Override
public AcknowledgedExtension parse(XmlPullParser parser, int initialDepth) {
public AcknowledgedExtension parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
String id = parser.getAttributeValue("", "id");
return new AcknowledgedExtension(id);
}

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.chat_markers.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.chat_markers.element.ChatMarkersElements.DisplayedExtension;
@ -33,7 +34,7 @@ import org.xmlpull.v1.XmlPullParser;
public class DisplayedProvider extends ExtensionElementProvider<DisplayedExtension> {
@Override
public DisplayedExtension parse(XmlPullParser parser, int initialDepth) {
public DisplayedExtension parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
String id = parser.getAttributeValue("", "id");
return new DisplayedExtension(id);
}

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.chat_markers.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.chat_markers.element.ChatMarkersElements.MarkableExtension;
@ -33,7 +34,7 @@ import org.xmlpull.v1.XmlPullParser;
public class MarkableProvider extends ExtensionElementProvider<MarkableExtension> {
@Override
public MarkableExtension parse(XmlPullParser parser, int initialDepth) {
public MarkableExtension parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return MarkableExtension.INSTANCE;
}

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.chat_markers.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.chat_markers.element.ChatMarkersElements.ReceivedExtension;
@ -33,7 +34,7 @@ import org.xmlpull.v1.XmlPullParser;
public class ReceivedProvider extends ExtensionElementProvider<ReceivedExtension> {
@Override
public ReceivedExtension parse(XmlPullParser parser, int initialDepth) {
public ReceivedExtension parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
String id = parser.getAttributeValue("", "id");
return new ReceivedExtension(id);
}

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.csi.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.csi.packet.ClientStateIndication;
@ -28,7 +29,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class ClientStateIndicationFeatureProvider extends ExtensionElementProvider<ClientStateIndication.Feature> {
@Override
public ClientStateIndication.Feature parse(XmlPullParser parser, int initialDepth)
public ClientStateIndication.Feature parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException {
return ClientStateIndication.Feature.INSTANCE;
}

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.eme.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.eme.element.ExplicitMessageEncryptionElement;
@ -25,7 +26,7 @@ import org.xmlpull.v1.XmlPullParser;
public class ExplicitMessageEncryptionProvider extends ExtensionElementProvider<ExplicitMessageEncryptionElement> {
@Override
public ExplicitMessageEncryptionElement parse(XmlPullParser parser, int initialDepth) {
public ExplicitMessageEncryptionElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
String namespace = parser.getAttributeValue(null, "namespace");
String name = parser.getAttributeValue(null, "name");
return new ExplicitMessageEncryptionElement(namespace, name);

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.hashes.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.hashes.HashManager;
@ -32,7 +33,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class HashElementProvider extends ExtensionElementProvider<HashElement> {
@Override
public HashElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public HashElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
String algo = parser.getAttributeValue(null, HashElement.ATTR_ALGO);
String hashB64 = parser.nextText();
return new HashElement(HashManager.ALGORITHM.valueOfName(algo), hashB64);

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.hints.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.hints.element.MessageProcessingHint;
@ -25,7 +26,7 @@ import org.xmlpull.v1.XmlPullParser;
public abstract class MessageProcessingHintProvider<H extends MessageProcessingHint> extends ExtensionElementProvider<H> {
@Override
public H parse(XmlPullParser parser, int initialDepth) {
public H parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return getHint();
}

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.hoxt.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.hoxt.packet.Base64BinaryChunk;
@ -34,7 +35,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class Base64BinaryChunkProvider extends ExtensionElementProvider<Base64BinaryChunk> {
@Override
public Base64BinaryChunk parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public Base64BinaryChunk parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
String streamId = parser.getAttributeValue("", Base64BinaryChunk.ATTRIBUTE_STREAM_ID);
String nrString = parser.getAttributeValue("", Base64BinaryChunk.ATTRIBUTE_NR);
String lastString = parser.getAttributeValue("", Base64BinaryChunk.ATTRIBUTE_LAST);

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.hoxt.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.util.ParserUtils;
@ -40,7 +41,7 @@ public class HttpOverXmppReqProvider extends AbstractHttpOverXmppProvider<HttpOv
private static final String ATTRIBUTE_MAX_CHUNK_SIZE = "maxChunkSize";
@Override
public HttpOverXmppReq parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException, SmackParsingException {
public HttpOverXmppReq parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws IOException, XmlPullParserException, SmackParsingException {
HttpOverXmppReq.Builder builder = HttpOverXmppReq.builder();
builder.setResource(parser.getAttributeValue("", ATTRIBUTE_RESOURCE));
builder.setVersion(parser.getAttributeValue("", ATTRIBUTE_VERSION));

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.hoxt.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smackx.hoxt.packet.AbstractHttpOverXmpp;
import org.jivesoftware.smackx.hoxt.packet.HttpOverXmppResp;
@ -38,7 +39,7 @@ public class HttpOverXmppRespProvider extends AbstractHttpOverXmppProvider<HttpO
private static final String ATTRIBUTE_STATUS_CODE = "statusCode";
@Override
public HttpOverXmppResp parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException, SmackParsingException {
public HttpOverXmppResp parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws IOException, XmlPullParserException, SmackParsingException {
String version = parser.getAttributeValue("", ATTRIBUTE_VERSION);
String statusMessage = parser.getAttributeValue("", ATTRIBUTE_STATUS_MESSAGE);
String statusCodeString = parser.getAttributeValue("", ATTRIBUTE_STATUS_CODE);

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.httpfileupload.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.httpfileupload.element.FileTooLargeError;
@ -35,7 +36,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class FileTooLargeErrorProvider extends ExtensionElementProvider<FileTooLargeError> {
@Override
public FileTooLargeError parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public FileTooLargeError parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
final String namespace = parser.getNamespace();
Long maxFileSize = null;

View file

@ -21,6 +21,7 @@ import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils;
@ -41,7 +42,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class SlotProvider extends IQProvider<Slot> {
@Override
public Slot parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public Slot parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
final String namespace = parser.getNamespace();
final UploadService.Version version = HttpFileUploadManager.namespaceToVersion(namespace);

View file

@ -20,6 +20,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.iot.control.element.IoTSetRequest;
@ -35,7 +36,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class IoTSetRequestProvider extends IQProvider<IoTSetRequest> {
@Override
public IoTSetRequest parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public IoTSetRequest parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
List<SetData> data = new ArrayList<>(4);
outerloop: while (true) {
final int eventType = parser.next();

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.iot.control.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.iot.control.element.IoTSetResponse;
@ -25,7 +26,7 @@ import org.xmlpull.v1.XmlPullParser;
public class IoTSetResponseProvider extends IQProvider<IoTSetResponse> {
@Override
public IoTSetResponse parse(XmlPullParser parser, int initialDepth) {
public IoTSetResponse parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return new IoTSetResponse();
}

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.iot.data.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils;
@ -28,7 +29,7 @@ import org.xmlpull.v1.XmlPullParser;
public class IoTDataReadOutAcceptedProvider extends IQProvider<IoTDataReadOutAccepted> {
@Override
public IoTDataReadOutAccepted parse(XmlPullParser parser, int initialDepth) throws IOException {
public IoTDataReadOutAccepted parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws IOException {
int seqNr = ParserUtils.getIntegerAttributeOrThrow(parser, "seqnr", "IoT data request <accepted/> without sequence number");
boolean queued = ParserUtils.getBooleanAttribute(parser, "queued", false);
return new IoTDataReadOutAccepted(seqNr, queued);

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.iot.data.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils;
@ -28,7 +29,7 @@ import org.xmlpull.v1.XmlPullParser;
public class IoTDataRequestProvider extends IQProvider<IoTDataRequest> {
@Override
public IoTDataRequest parse(XmlPullParser parser, int initialDepth) throws IOException {
public IoTDataRequest parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws IOException {
int seqNr = ParserUtils.getIntegerAttributeOrThrow(parser, "seqnr", "IoT data request without sequence number");
boolean momentary = ParserUtils.getBooleanAttribute(parser, "momentary", false);
return new IoTDataRequest(seqNr, momentary);

View file

@ -23,6 +23,7 @@ import java.util.Date;
import java.util.List;
import java.util.logging.Logger;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
@ -44,7 +45,7 @@ public class IoTFieldsExtensionProvider extends ExtensionElementProvider<IoTFiel
private static final Logger LOGGER = Logger.getLogger(IoTFieldsExtensionProvider.class.getName());
@Override
public IoTFieldsExtension parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException, SmackTextParseException {
public IoTFieldsExtension parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws IOException, XmlPullParserException, SmackTextParseException {
int seqNr = ParserUtils.getIntegerAttributeOrThrow(parser, "seqnr", "IoT data request <accepted/> without sequence number");
boolean done = ParserUtils.getBooleanAttribute(parser, "done", false);
List<NodeElement> nodes = new ArrayList<>();

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.iot.discovery.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils;
@ -30,7 +31,7 @@ import org.xmlpull.v1.XmlPullParser;
public class IoTClaimedProvider extends IQProvider<IoTClaimed> {
@Override
public IoTClaimed parse(XmlPullParser parser, int initialDepth) throws XmppStringprepException {
public IoTClaimed parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmppStringprepException {
Jid jid = ParserUtils.getJidAttribute(parser);
NodeInfo nodeInfo = NodeInfoParser.parse(parser);
return new IoTClaimed(jid, nodeInfo);

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.iot.discovery.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils;
@ -30,7 +31,7 @@ import org.xmlpull.v1.XmlPullParser;
public class IoTDisownProvider extends IQProvider<IoTDisown> {
@Override
public IoTDisown parse(XmlPullParser parser, int initialDepth) throws XmppStringprepException {
public IoTDisown parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmppStringprepException {
Jid jid = ParserUtils.getJidAttribute(parser);
NodeInfo nodeInfo = NodeInfoParser.parse(parser);
return new IoTDisown(jid, nodeInfo);

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.iot.discovery.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.iot.discovery.element.IoTDisowned;
@ -27,7 +28,7 @@ import org.xmlpull.v1.XmlPullParser;
public class IoTDisownedProvider extends IQProvider<IoTDisowned> {
@Override
public IoTDisowned parse(XmlPullParser parser, int initialDepth) {
public IoTDisowned parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
NodeInfo nodeInfo = NodeInfoParser.parse(parser);
return new IoTDisowned(nodeInfo);
}

View file

@ -20,6 +20,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils;
@ -34,7 +35,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class IoTRegisterProvider extends IQProvider<IoTRegister> {
@Override
public IoTRegister parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public IoTRegister parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
boolean selfOwned = ParserUtils.getBooleanAttribute(parser, "selfOwned", false);
NodeInfo nodeInfo = NodeInfoParser.parse(parser);
List<Tag> tags = new ArrayList<>();

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.iot.discovery.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils;
@ -32,7 +33,7 @@ import org.xmlpull.v1.XmlPullParser;
public class IoTRemoveProvider extends IQProvider<IoTRemove> {
@Override
public IoTRemove parse(XmlPullParser parser, int initialDepth) throws IOException {
public IoTRemove parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws IOException {
Jid jid = ParserUtils.getJidAttribute(parser);
if (jid.hasResource()) {
// TODO: Should be SmackParseException.

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.iot.discovery.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.iot.discovery.element.IoTRemoved;
@ -27,7 +28,7 @@ import org.xmlpull.v1.XmlPullParser;
public class IoTRemovedProvider extends IQProvider<IoTRemoved> {
@Override
public IoTRemoved parse(XmlPullParser parser, int initialDepth) {
public IoTRemoved parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
NodeInfo nodeInfo = NodeInfoParser.parse(parser);
return new IoTRemoved(nodeInfo);
}

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.iot.discovery.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.iot.discovery.element.IoTUnregister;
@ -27,7 +28,7 @@ import org.xmlpull.v1.XmlPullParser;
public class IoTUnregisterProvider extends IQProvider<IoTUnregister> {
@Override
public IoTUnregister parse(XmlPullParser parser, int initialDepth) {
public IoTUnregister parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
NodeInfo nodeInfo = NodeInfoParser.parse(parser);
return new IoTUnregister(nodeInfo);
}

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.iot.provisioning.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.iot.provisioning.element.ClearCache;
@ -25,7 +26,7 @@ import org.xmlpull.v1.XmlPullParser;
public class ClearCacheProvider extends IQProvider<ClearCache> {
@Override
public ClearCache parse(XmlPullParser parser, int initialDepth) {
public ClearCache parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return new ClearCache();
}

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.iot.provisioning.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.iot.provisioning.element.ClearCacheResponse;
@ -25,7 +26,7 @@ import org.xmlpull.v1.XmlPullParser;
public class ClearCacheResponseProvider extends IQProvider<ClearCacheResponse> {
@Override
public ClearCacheResponse parse(XmlPullParser parser, int initialDepth) {
public ClearCacheResponse parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return new ClearCacheResponse();
}

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.iot.provisioning.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.ParserUtils;
@ -28,7 +29,7 @@ import org.xmlpull.v1.XmlPullParser;
public class FriendProvider extends ExtensionElementProvider<Friend> {
@Override
public Friend parse(XmlPullParser parser, int initialDepth) throws XmppStringprepException {
public Friend parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmppStringprepException {
BareJid jid = ParserUtils.getBareJidAttribute(parser);
return new Friend(jid);
}

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.iot.provisioning.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils;
@ -28,7 +29,7 @@ import org.xmlpull.v1.XmlPullParser;
public class IoTIsFriendProvider extends IQProvider<IoTIsFriend> {
@Override
public IoTIsFriend parse(XmlPullParser parser, int initialDepth) throws XmppStringprepException {
public IoTIsFriend parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmppStringprepException {
Jid jid = ParserUtils.getJidAttribute(parser);
return new IoTIsFriend(jid);
}

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.iot.provisioning.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils;
@ -29,7 +30,7 @@ import org.xmlpull.v1.XmlPullParser;
public class IoTIsFriendResponseProvider extends IQProvider<IoTIsFriendResponse> {
@Override
public IoTIsFriendResponse parse(XmlPullParser parser, int initialDepth) throws XmppStringprepException {
public IoTIsFriendResponse parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmppStringprepException {
Jid jid = ParserUtils.getJidAttribute(parser);
BareJid bareJid = jid.asBareJid();
boolean result = ParserUtils.getBooleanAttribute(parser, "result");

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.iot.provisioning.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.ParserUtils;
@ -28,7 +29,7 @@ import org.xmlpull.v1.XmlPullParser;
public class UnfriendProvider extends ExtensionElementProvider<Unfriend> {
@Override
public Unfriend parse(XmlPullParser parser, int initialDepth) throws XmppStringprepException {
public Unfriend parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmppStringprepException {
BareJid jid = ParserUtils.getBareJidAttribute(parser);
return new Unfriend(jid);
}

View file

@ -21,6 +21,7 @@ import static org.xmlpull.v1.XmlPullParser.START_TAG;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.hashes.element.HashElement;
@ -38,7 +39,7 @@ import org.xmlpull.v1.XmlPullParserException;
*/
public class ChecksumProvider extends ExtensionElementProvider<Checksum> {
@Override
public Checksum parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
public Checksum parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
JingleContent.Creator creator = null;
String creatorString = parser.getAttributeValue(null, Checksum.ATTR_CREATOR);
if (creatorString != null) {

View file

@ -23,6 +23,7 @@ import java.io.IOException;
import java.text.ParseException;
import java.util.ArrayList;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smackx.hashes.element.HashElement;
import org.jivesoftware.smackx.hashes.provider.HashElementProvider;
@ -43,7 +44,7 @@ public class JingleFileTransferProvider
extends JingleContentDescriptionProvider<JingleFileTransfer> {
@Override
public JingleFileTransfer parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
public JingleFileTransfer parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
ArrayList<JingleContentDescriptionChildElement> payloads = new ArrayList<>();
boolean inRange = false;
JingleFileTransferChild.Builder builder = JingleFileTransferChild.getBuilder();

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.json.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.PacketParserUtils;
@ -29,7 +30,7 @@ import org.xmlpull.v1.XmlPullParserException;
public abstract class AbstractJsonExtensionProvider<J extends AbstractJsonPacketExtension> extends ExtensionElementProvider<J> {
@Override
public J parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException,
public J parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException,
IOException {
String json = PacketParserUtils.parseElementText(parser);
return from(json);

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.mam.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils;
@ -40,7 +41,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class MamFinIQProvider extends IQProvider<MamFinIQ> {
@Override
public MamFinIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
public MamFinIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
String queryId = parser.getAttributeValue("", "queryid");
boolean complete = ParserUtils.getBooleanAttribute(parser, "complete", false);
boolean stable = ParserUtils.getBooleanAttribute(parser, "stable", true);

View file

@ -20,6 +20,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.mam.element.MamPrefsIQ;
@ -41,7 +42,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class MamPrefsIQProvider extends IQProvider<MamPrefsIQ> {
@Override
public MamPrefsIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public MamPrefsIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
String iqType = parser.getAttributeValue("", "type");
String defaultBehaviorString = parser.getAttributeValue("", "default");
DefaultBehavior defaultBehavior = null;

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.mam.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider;
@ -39,7 +40,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class MamQueryIQProvider extends IQProvider<MamQueryIQ> {
@Override
public MamQueryIQ parse(XmlPullParser parser, int initialDepth)
public MamQueryIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException, SmackParsingException {
DataForm dataForm = null;
String queryId = parser.getAttributeValue("", "queryid");

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.mam.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
@ -39,7 +40,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class MamResultProvider extends ExtensionElementProvider<MamResultExtension> {
@Override
public MamResultExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
public MamResultExtension parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
Forwarded forwarded = null;
String queryId = parser.getAttributeValue("", "queryid");
String id = parser.getAttributeValue("", "id");

View file

@ -25,6 +25,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smackx.message_markup.element.BlockQuoteElement;
@ -39,7 +40,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class MarkupElementProvider extends ExtensionElementProvider<MarkupElement> {
@Override
public MarkupElement parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException {
public MarkupElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws IOException, XmlPullParserException {
MarkupElement.Builder markup = MarkupElement.getBuilder();

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.muclight.provider;
import java.io.IOException;
import java.util.HashMap;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.muclight.MUCLightAffiliation;
@ -38,7 +39,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class MUCLightAffiliationsChangeProvider extends ExtensionElementProvider<AffiliationsChangeExtension> {
@Override
public AffiliationsChangeExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public AffiliationsChangeExtension parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
HashMap<Jid, MUCLightAffiliation> affiliations = new HashMap<>();
String prevVersion = null;
String version = null;

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.muclight.provider;
import java.io.IOException;
import java.util.HashMap;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.muclight.MUCLightAffiliation;
@ -38,7 +39,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class MUCLightAffiliationsIQProvider extends IQProvider<MUCLightAffiliationsIQ> {
@Override
public MUCLightAffiliationsIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public MUCLightAffiliationsIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
String version = null;
HashMap<Jid, MUCLightAffiliation> occupants = new HashMap<>();

View file

@ -20,6 +20,7 @@ import java.io.IOException;
import java.util.HashMap;
import org.jivesoftware.smack.packet.IQ.Type;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.muclight.element.MUCLightBlockingIQ;
@ -39,7 +40,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class MUCLightBlockingIQProvider extends IQProvider<MUCLightBlockingIQ> {
@Override
public MUCLightBlockingIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public MUCLightBlockingIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
HashMap<Jid, Boolean> rooms = null;
HashMap<Jid, Boolean> users = null;

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.muclight.provider;
import java.io.IOException;
import java.util.HashMap;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.muclight.MUCLightRoomConfiguration;
@ -36,7 +37,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class MUCLightConfigurationIQProvider extends IQProvider<MUCLightConfigurationIQ> {
@Override
public MUCLightConfigurationIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public MUCLightConfigurationIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
String version = null;
String roomName = null;
String subject = null;

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.muclight.provider;
import java.io.IOException;
import java.util.HashMap;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.muclight.element.MUCLightElements.ConfigurationsChangeExtension;
@ -35,7 +36,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class MUCLightConfigurationsChangeProvider extends ExtensionElementProvider<ConfigurationsChangeExtension> {
@Override
public ConfigurationsChangeExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public ConfigurationsChangeExtension parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
String prevVersion = null;
String version = null;
String roomName = null;

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.muclight.provider;
import java.io.IOException;
import java.util.HashMap;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.muclight.MUCLightAffiliation;
@ -39,7 +40,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class MUCLightInfoIQProvider extends IQProvider<MUCLightInfoIQ> {
@Override
public MUCLightInfoIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public MUCLightInfoIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
String version = null;
String roomName = null;
String subject = null;

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.push_notifications.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.push_notifications.element.PushNotificationsElements.RemoteDisablingExtension;
@ -37,7 +38,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class RemoteDisablingProvider extends ExtensionElementProvider<RemoteDisablingExtension> {
@Override
public RemoteDisablingExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public RemoteDisablingExtension parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
Jid userJid = null;
String node = parser.getAttributeValue("", "node");

View file

@ -21,6 +21,7 @@ import java.net.URI;
import java.net.URISyntaxException;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.provider.ProviderManager;
@ -35,7 +36,7 @@ public class ReferenceProvider extends ExtensionElementProvider<ReferenceElement
public static final ReferenceProvider TEST_PROVIDER = new ReferenceProvider();
@Override
public ReferenceElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
public ReferenceElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
Integer begin = ParserUtils.getIntegerAttribute(parser, ReferenceElement.ATTR_BEGIN);
Integer end = ParserUtils.getIntegerAttribute(parser, ReferenceElement.ATTR_END);
String typeString = parser.getAttributeValue(null, ReferenceElement.ATTR_TYPE);

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.sid.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.sid.element.OriginIdElement;
@ -26,7 +27,7 @@ public class OriginIdProvider extends ExtensionElementProvider<OriginIdElement>
public static final OriginIdProvider TEST_INSTANCE = new OriginIdProvider();
@Override
public OriginIdElement parse(XmlPullParser parser, int initialDepth) {
public OriginIdElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return new OriginIdElement(parser.getAttributeValue(null, OriginIdElement.ATTR_ID));
}
}

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.sid.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.sid.element.StanzaIdElement;
@ -26,7 +27,7 @@ public class StanzaIdProvider extends ExtensionElementProvider<StanzaIdElement>
public static StanzaIdProvider TEST_INSTANCE = new StanzaIdProvider();
@Override
public StanzaIdElement parse(XmlPullParser parser, int initialDepth) {
public StanzaIdElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
String id = parser.getAttributeValue(null, StanzaIdElement.ATTR_ID);
String by = parser.getAttributeValue(null, StanzaIdElement.ATTR_BY);
return new StanzaIdElement(id, by);

View file

@ -21,6 +21,7 @@ import static org.xmlpull.v1.XmlPullParser.TEXT;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smackx.spoiler.element.SpoilerElement;
@ -33,7 +34,7 @@ public class SpoilerProvider extends ExtensionElementProvider<SpoilerElement> {
public static SpoilerProvider INSTANCE = new SpoilerProvider();
@Override
public SpoilerElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public SpoilerElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
String lang = ParserUtils.getXmlLang(parser);
String hint = null;

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.address.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.ParserUtils;
@ -38,7 +39,7 @@ public class MultipleAddressesProvider extends ExtensionElementProvider<Multiple
@Override
public MultipleAddresses parse(XmlPullParser parser,
int initialDepth) throws XmlPullParserException,
int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException,
IOException {
MultipleAddresses multipleAddresses = new MultipleAddresses();
outerloop: while (true) {

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.amp.provider;
import java.io.IOException;
import java.util.logging.Logger;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.amp.AMPDeliverCondition;
@ -42,7 +43,7 @@ public class AMPExtensionProvider extends ExtensionElementProvider<AMPExtension>
* @throws XmlPullParserException
*/
@Override
public AMPExtension parse(XmlPullParser parser, int initialDepth)
public AMPExtension parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException {
final String from = parser.getAttributeValue(null, "from");
final String to = parser.getAttributeValue(null, "to");

View file

@ -17,6 +17,7 @@
package org.jivesoftware.smackx.attention.packet;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.xmlpull.v1.XmlPullParser;
@ -87,7 +88,7 @@ s */
public static class Provider extends ExtensionElementProvider<AttentionExtension> {
@Override
public AttentionExtension parse(XmlPullParser parser, int initialDepth) {
public AttentionExtension parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return new AttentionExtension();
}
}

View file

@ -20,6 +20,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils;
@ -39,7 +40,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class BlockContactsIQProvider extends IQProvider<BlockContactsIQ> {
@Override
public BlockContactsIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public BlockContactsIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
List<Jid> jids = new ArrayList<>();
outerloop: while (true) {

View file

@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.packet.IQ.Type;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils;
@ -40,7 +41,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class BlockListIQProvider extends IQProvider<BlockListIQ> {
@Override
public BlockListIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public BlockListIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
List<Jid> jids = null;
outerloop: while (true) {

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.blocking.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.blocking.element.BlockedErrorExtension;
@ -32,7 +33,7 @@ import org.xmlpull.v1.XmlPullParser;
public class BlockedErrorExtensionProvider extends ExtensionElementProvider<BlockedErrorExtension> {
@Override
public BlockedErrorExtension parse(XmlPullParser parser, int initialDepth) {
public BlockedErrorExtension parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return new BlockedErrorExtension();
}

View file

@ -20,6 +20,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.blocking.element.UnblockContactsIQ;
@ -39,7 +40,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class UnblockContactsIQProvider extends IQProvider<UnblockContactsIQ> {
@Override
public UnblockContactsIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public UnblockContactsIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
List<Jid> jids = null;
outerloop: while (true) {

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.bob.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils;
@ -38,7 +39,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class BoBIQProvider extends IQProvider<BoBIQ> {
@Override
public BoBIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public BoBIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
String cid = parser.getAttributeValue("", "cid");
BoBHash bobHash = BoBHash.fromCid(cid);

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.bytestreams.ibb.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.bytestreams.ibb.packet.Close;
@ -30,7 +31,7 @@ import org.xmlpull.v1.XmlPullParser;
public class CloseIQProvider extends IQProvider<Close> {
@Override
public Close parse(XmlPullParser parser, int initialDepth) {
public Close parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
String sid = parser.getAttributeValue("", "sid");
return new Close(sid);
}

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.bytestreams.ibb.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smackx.bytestreams.ibb.packet.Data;
import org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtension;
@ -38,7 +39,7 @@ public class DataPacketProvider {
private static final PacketExtensionProvider packetExtensionProvider = new PacketExtensionProvider();
@Override
public Data parse(XmlPullParser parser, int initialDepth)
public Data parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
throws IOException, XmlPullParserException, SmackParsingException {
DataPacketExtension data = packetExtensionProvider.parse(parser);
return new Data(data);
@ -49,7 +50,7 @@ public class DataPacketProvider {
@Override
public DataPacketExtension parse(XmlPullParser parser,
int initialDepth) throws XmlPullParserException,
int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException,
IOException {
String sessionID = parser.getAttributeValue("", "sid");
long seq = Long.parseLong(parser.getAttributeValue("", "seq"));

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.bytestreams.ibb.provider;
import java.io.IOException;
import java.util.Locale;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType;
@ -35,7 +36,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class OpenIQProvider extends IQProvider<Open> {
@Override
public Open parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public Open parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
String sessionID = parser.getAttributeValue("", "sid");
int blockSize = Integer.parseInt(parser.getAttributeValue("", "block-size"));

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.bytestreams.socks5.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils;
@ -36,7 +37,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class BytestreamsProvider extends IQProvider<Bytestream> {
@Override
public Bytestream parse(XmlPullParser parser, int initialDepth)
public Bytestream parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException {
boolean done = false;

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.caps.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.caps.EntityCapsManager;
@ -29,7 +30,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class CapsExtensionProvider extends ExtensionElementProvider<CapsExtension> {
@Override
public CapsExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public CapsExtension parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
String hash, version, node;
if (parser.getEventType() == XmlPullParser.START_TAG
&& parser.getName().equalsIgnoreCase(EntityCapsManager.ELEMENT)) {

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.chatstates.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.chatstates.ChatState;
@ -26,7 +27,7 @@ import org.xmlpull.v1.XmlPullParser;
public class ChatStateExtensionProvider extends ExtensionElementProvider<ChatStateExtension> {
@Override
public ChatStateExtension parse(XmlPullParser parser, int initialDepth) {
public ChatStateExtension parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
String chatStateString = parser.getName();
ChatState state = ChatState.valueOf(chatStateString);

View file

@ -20,6 +20,7 @@ package org.jivesoftware.smackx.commands.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.provider.IQProvider;
@ -42,7 +43,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class AdHocCommandDataProvider extends IQProvider<AdHocCommandData> {
@Override
public AdHocCommandData parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
public AdHocCommandData parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
boolean done = false;
AdHocCommandData adHocCommandData = new AdHocCommandData();
DataFormProvider dataFormProvider = new DataFormProvider();
@ -127,42 +128,42 @@ public class AdHocCommandDataProvider extends IQProvider<AdHocCommandData> {
public static class BadActionError extends ExtensionElementProvider<AdHocCommandData.SpecificError> {
@Override
public AdHocCommandData.SpecificError parse(XmlPullParser parser, int initialDepth) {
public AdHocCommandData.SpecificError parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return new AdHocCommandData.SpecificError(AdHocCommand.SpecificErrorCondition.badAction);
}
}
public static class MalformedActionError extends ExtensionElementProvider<AdHocCommandData.SpecificError> {
@Override
public AdHocCommandData.SpecificError parse(XmlPullParser parser, int initialDepth) {
public AdHocCommandData.SpecificError parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return new AdHocCommandData.SpecificError(AdHocCommand.SpecificErrorCondition.malformedAction);
}
}
public static class BadLocaleError extends ExtensionElementProvider<AdHocCommandData.SpecificError> {
@Override
public AdHocCommandData.SpecificError parse(XmlPullParser parser, int initialDepth) {
public AdHocCommandData.SpecificError parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return new AdHocCommandData.SpecificError(AdHocCommand.SpecificErrorCondition.badLocale);
}
}
public static class BadPayloadError extends ExtensionElementProvider<AdHocCommandData.SpecificError> {
@Override
public AdHocCommandData.SpecificError parse(XmlPullParser parser, int initialDepth) {
public AdHocCommandData.SpecificError parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return new AdHocCommandData.SpecificError(AdHocCommand.SpecificErrorCondition.badPayload);
}
}
public static class BadSessionIDError extends ExtensionElementProvider<AdHocCommandData.SpecificError> {
@Override
public AdHocCommandData.SpecificError parse(XmlPullParser parser, int initialDepth) {
public AdHocCommandData.SpecificError parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return new AdHocCommandData.SpecificError(AdHocCommand.SpecificErrorCondition.badSessionid);
}
}
public static class SessionExpiredError extends ExtensionElementProvider<AdHocCommandData.SpecificError> {
@Override
public AdHocCommandData.SpecificError parse(XmlPullParser parser, int initialDepth) {
public AdHocCommandData.SpecificError parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return new AdHocCommandData.SpecificError(AdHocCommand.SpecificErrorCondition.sessionExpired);
}
}

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.delay.provider;
import java.io.IOException;
import java.util.Date;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
@ -31,7 +32,7 @@ public abstract class AbstractDelayInformationProvider extends ExtensionElementP
@Override
public final DelayInformation parse(XmlPullParser parser,
int initialDepth) throws XmlPullParserException,
int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException,
IOException, SmackTextParseException {
String stampString = (parser.getAttributeValue("", "stamp"));
String from = parser.getAttributeValue("", "from");

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.disco.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.PacketParserUtils;
@ -36,7 +37,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class DiscoverInfoProvider extends IQProvider<DiscoverInfo> {
@Override
public DiscoverInfo parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
public DiscoverInfo parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
DiscoverInfo discoverInfo = new DiscoverInfo();
boolean done = false;
DiscoverInfo.Identity identity;
@ -68,7 +69,7 @@ public class DiscoverInfoProvider extends IQProvider<DiscoverInfo> {
}
// Otherwise, it must be a packet extension.
else {
PacketParserUtils.addExtensionElement(discoverInfo, parser);
PacketParserUtils.addExtensionElement(discoverInfo, parser, xmlEnvironment);
}
} else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("identity")) {

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.disco.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils;
@ -36,7 +37,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class DiscoverItemsProvider extends IQProvider<DiscoverItems> {
@Override
public DiscoverItems parse(XmlPullParser parser, int initialDepth)
public DiscoverItems parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException {
DiscoverItems discoverItems = new DiscoverItems();
boolean done = false;

View file

@ -21,6 +21,7 @@ import java.util.logging.Logger;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.PacketParserUtils;
@ -45,7 +46,7 @@ public class ForwardedProvider extends ExtensionElementProvider<Forwarded> {
private static final Logger LOGGER = Logger.getLogger(ForwardedProvider.class.getName());
@Override
public Forwarded parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
public Forwarded parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
DelayInformation di = null;
Stanza packet = null;
@ -58,7 +59,7 @@ public class ForwardedProvider extends ExtensionElementProvider<Forwarded> {
switch (name) {
case DelayInformation.ELEMENT:
if (DelayInformation.NAMESPACE.equals(namespace)) {
di = DelayInformationProvider.INSTANCE.parse(parser, parser.getDepth());
di = DelayInformationProvider.INSTANCE.parse(parser, parser.getDepth(), null);
} else {
LOGGER.warning("Namespace '" + namespace + "' does not match expected namespace '"
+ DelayInformation.NAMESPACE + "'");

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.geoloc.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackUriSyntaxParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
@ -31,7 +32,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class GeoLocationProvider extends ExtensionElementProvider<GeoLocation> {
@Override
public GeoLocation parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException,
public GeoLocation parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException,
SmackTextParseException, SmackUriSyntaxParsingException {
GeoLocation.Builder builder = GeoLocation.builder();

View file

@ -20,6 +20,7 @@ package org.jivesoftware.smackx.iqlast.packet;
import java.io.IOException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jxmpp.jid.Jid;
@ -102,7 +103,7 @@ public class LastActivity extends IQ {
public static class Provider extends IQProvider<LastActivity> {
@Override
public LastActivity parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public LastActivity parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
LastActivity lastActivity = new LastActivity();
String seconds = parser.getAttributeValue("", "seconds");
if (seconds != null) {

View file

@ -29,6 +29,7 @@ import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.StanzaError.Condition;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.iqprivate.packet.DefaultPrivateData;
@ -235,7 +236,7 @@ public final class PrivateDataManager extends Manager {
public static class PrivateDataIQProvider extends IQProvider<PrivateDataIQ> {
@Override
public PrivateDataIQ parse(XmlPullParser parser, int initialDepth)
public PrivateDataIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException {
PrivateData privateData = null;
boolean done = false;

View file

@ -24,6 +24,7 @@ import java.util.Map;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.PacketParserUtils;
@ -36,7 +37,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class RegistrationProvider extends IQProvider<Registration> {
@Override
public Registration parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
public Registration parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
String instruction = null;
Map<String, String> fields = new HashMap<>();
List<ExtensionElement> packetExtensions = new LinkedList<>();
@ -63,7 +64,7 @@ public class RegistrationProvider extends IQProvider<Registration> {
}
// Otherwise, it must be a packet extension.
else {
PacketParserUtils.addExtensionElement(packetExtensions, parser);
PacketParserUtils.addExtensionElement(packetExtensions, parser, xmlEnvironment);
}
}
else if (eventType == XmlPullParser.END_TAG) {

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.iqregister.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.iqregister.packet.Registration;
@ -25,7 +26,7 @@ import org.xmlpull.v1.XmlPullParser;
public class RegistrationStreamFeatureProvider extends ExtensionElementProvider<Registration.Feature> {
@Override
public Registration.Feature parse(XmlPullParser parser, int initialDepth) {
public Registration.Feature parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return Registration.Feature.INSTANCE;
}

View file

@ -20,6 +20,7 @@ package org.jivesoftware.smackx.iqversion.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.iqversion.packet.Version;
@ -30,7 +31,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class VersionProvider extends IQProvider<Version> {
@Override
public Version parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public Version parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
String name = null, version = null, os = null;
outerloop: while (true) {

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.jingle.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
@ -30,6 +31,6 @@ public abstract class JingleContentDescriptionProvider<D extends JingleContentDe
extends ExtensionElementProvider<D> {
@Override
public abstract D parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException;
public abstract D parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException;
}

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.jingle.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.jingle.element.JingleContentTransport;
@ -29,6 +30,6 @@ public abstract class JingleContentTransportProvider<T extends JingleContentTran
extends ExtensionElementProvider<T> {
@Override
public abstract T parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException;
public abstract T parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws IOException, XmlPullParserException;
}

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.jingle.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.jingle.element.JingleError;
@ -25,7 +26,7 @@ import org.xmlpull.v1.XmlPullParser;
public class JingleErrorProvider extends ExtensionElementProvider<JingleError> {
@Override
public JingleError parse(XmlPullParser parser, int initialDepth) {
public JingleError parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
String errorName = parser.getName();
return JingleError.fromString(errorName);
}

View file

@ -20,6 +20,7 @@ import java.io.IOException;
import java.util.logging.Logger;
import org.jivesoftware.smack.packet.StandardExtensionElement;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.parsing.StandardExtensionElementProvider;
import org.jivesoftware.smack.provider.IQProvider;
@ -44,7 +45,7 @@ public class JingleProvider extends IQProvider<Jingle> {
private static final Logger LOGGER = Logger.getLogger(JingleProvider.class.getName());
@Override
public Jingle parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
public Jingle parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
Jingle.Builder builder = Jingle.getBuilder();
String actionString = parser.getAttributeValue("", Jingle.ACTION_ATTRIBUTE_NAME);

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.jingle.transports.jingle_ibb.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smackx.jingle.provider.JingleContentTransportProvider;
import org.jivesoftware.smackx.jingle.transports.jingle_ibb.element.JingleIBBTransport;
@ -26,7 +27,7 @@ import org.xmlpull.v1.XmlPullParser;
*/
public class JingleIBBTransportProvider extends JingleContentTransportProvider<JingleIBBTransport> {
@Override
public JingleIBBTransport parse(XmlPullParser parser, int initialDepth) {
public JingleIBBTransport parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
String blockSizeString = parser.getAttributeValue(null, JingleIBBTransport.ATTR_BLOCK_SIZE);
String sid = parser.getAttributeValue(null, JingleIBBTransport.ATTR_SID);

View file

@ -29,6 +29,7 @@ import static org.xmlpull.v1.XmlPullParser.START_TAG;
import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smackx.jingle.element.JingleContentTransport;
import org.jivesoftware.smackx.jingle.provider.JingleContentTransportProvider;
import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransport;
@ -45,7 +46,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class JingleS5BTransportProvider extends JingleContentTransportProvider<JingleS5BTransport> {
@Override
public JingleS5BTransport parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public JingleS5BTransport parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
JingleS5BTransport.Builder builder = JingleS5BTransport.getBuilder();
String streamId = parser.getAttributeValue(null, JingleS5BTransport.ATTR_SID);

Some files were not shown because too many files have changed in this diff Show more