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

View file

@ -17,6 +17,7 @@
package org.jivesoftware.smack.compress.provider; package org.jivesoftware.smack.compress.provider;
import org.jivesoftware.smack.compress.packet.Compressed; import org.jivesoftware.smack.compress.packet.Compressed;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.NonzaProvider; import org.jivesoftware.smack.provider.NonzaProvider;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
@ -29,7 +30,7 @@ public final class CompressedProvider extends NonzaProvider<Compressed> {
} }
@Override @Override
public Compressed parse(XmlPullParser parser, int initialDepth) { public Compressed parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return Compressed.INSTANCE; 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.compress.packet.Failure;
import org.jivesoftware.smack.packet.StanzaError; import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.packet.StreamOpen; import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.NonzaProvider; import org.jivesoftware.smack.provider.NonzaProvider;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
@ -39,9 +40,10 @@ public final class FailureProvider extends NonzaProvider<Failure> {
} }
@Override @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; Failure.CompressFailureError compressFailureError = null;
StanzaError stanzaError = null; StanzaError stanzaError = null;
XmlEnvironment failureXmlEnvironment = XmlEnvironment.from(parser, xmlEnvironment);
outerloop: while (true) { outerloop: while (true) {
int eventType = parser.next(); int eventType = parser.next();
@ -60,7 +62,7 @@ public final class FailureProvider extends NonzaProvider<Failure> {
case StreamOpen.SERVER_NAMESPACE: case StreamOpen.SERVER_NAMESPACE:
switch (name) { switch (name) {
case StanzaError.ERROR: case StanzaError.ERROR:
StanzaError.Builder stanzaErrorBuilder = PacketParserUtils.parseError(parser); StanzaError.Builder stanzaErrorBuilder = PacketParserUtils.parseError(parser, failureXmlEnvironment);
stanzaError = stanzaErrorBuilder.build(); stanzaError = stanzaErrorBuilder.build();
break; break;
default: default:

View file

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

View file

@ -16,8 +16,11 @@
*/ */
package org.jivesoftware.smack.packet; package org.jivesoftware.smack.packet;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import org.xmlpull.v1.XmlPullParser;
public class XmlEnvironment { public class XmlEnvironment {
public static final XmlEnvironment EMPTY = new XmlEnvironment((String) null); public static final XmlEnvironment EMPTY = new XmlEnvironment((String) null);
@ -43,7 +46,7 @@ public class XmlEnvironment {
this(builder.namespace, builder.language, builder.next); 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.namespace = namespace;
this.language = language; this.language = language;
this.next = next; this.next = next;
@ -103,6 +106,16 @@ public class XmlEnvironment {
return effectiveLanguage; 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() { public static Builder builder() {
return new Builder(); return new Builder();
} }

View file

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

View file

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

View file

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

View file

@ -23,6 +23,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.util.PacketParserUtils; 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> { public abstract class EmbeddedExtensionProvider<PE extends ExtensionElement> extends ExtensionElementProvider<PE> {
@Override @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 namespace = parser.getNamespace();
final String name = parser.getName(); final String name = parser.getName();
final int attributeCount = parser.getAttributeCount(); final int attributeCount = parser.getAttributeCount();
@ -101,7 +102,7 @@ public abstract class EmbeddedExtensionProvider<PE extends ExtensionElement> ext
event = parser.next(); event = parser.next();
if (event == XmlPullParser.START_TAG) if (event == XmlPullParser.START_TAG)
PacketParserUtils.addExtensionElement(extensions, parser); PacketParserUtils.addExtensionElement(extensions, parser, xmlEnvironment);
} }
while (!(event == XmlPullParser.END_TAG && parser.getDepth() == initialDepth)); 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.ExtensionElement;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smack.util.ParserUtils;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
@ -39,7 +40,7 @@ public class IntrospectionProvider{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public I parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { public I parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
try { try {
return (I) parseWithIntrospection(elementClass, parser, initialDepth); return (I) parseWithIntrospection(elementClass, parser, initialDepth);
} }
@ -60,7 +61,7 @@ public class IntrospectionProvider{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public PE parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { public PE parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
try { try {
return (PE) parseWithIntrospection(elementClass, parser, initialDepth); return (PE) parseWithIntrospection(elementClass, parser, initialDepth);
} }

View file

@ -22,6 +22,7 @@ import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import org.jivesoftware.smack.packet.Element; import org.jivesoftware.smack.packet.Element;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.util.ParserUtils; 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. * Smack provider are the parsers used to deserialize raw XMPP into the according Java {@link Element}s.
* <p> * <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 * 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. * {@link org.jivesoftware.smack.SmackException} should be thrown.
* </p> * </p>
@ -62,16 +63,22 @@ public abstract class Provider<E extends Element> {
} }
public final E parse(XmlPullParser parser) throws IOException, XmlPullParserException, SmackParsingException { 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 // XPP3 calling convention assert: Parser should be at start tag
ParserUtils.assertAtStartTag(parser); ParserUtils.assertAtStartTag(parser);
final int initialDepth = parser.getDepth(); 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 // XPP3 calling convention assert: Parser should be at end tag of the consumed/parsed element
ParserUtils.forwardToEndTagOfDepth(parser, initialDepth); ParserUtils.forwardToEndTagOfDepth(parser, initialDepth);
return e; 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; package org.jivesoftware.smack.provider;
import org.jivesoftware.smack.packet.TlsProceed; import org.jivesoftware.smack.packet.TlsProceed;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
@ -28,7 +29,7 @@ public final class TlsFailureProvider extends NonzaProvider<TlsProceed> {
} }
@Override @Override
public TlsProceed parse(XmlPullParser parser, int initialDepth) { public TlsProceed parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return TlsProceed.INSTANCE; return TlsProceed.INSTANCE;
} }

View file

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

View file

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

View file

@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.util.FileUtils; import org.jivesoftware.smack.util.FileUtils;
import org.junit.Assert; import org.junit.Assert;
@ -62,7 +63,7 @@ public class ProviderConfigTest {
public static class TestIQProvider extends IQProvider<IQ> { public static class TestIQProvider extends IQProvider<IQ> {
@Override @Override
public IQ parse(XmlPullParser parser, int initialDepth) { public IQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return null; 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -20,6 +20,7 @@ import static org.junit.Assert.assertTrue;
import org.jivesoftware.smack.SmackConfiguration; import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.junit.Test; import org.junit.Test;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
@ -38,7 +39,7 @@ public class ProviderManagerTest {
public static class TestIQProvider extends IQProvider<IQ> { public static class TestIQProvider extends IQProvider<IQ> {
@Override @Override
public IQ parse(XmlPullParser parser, int initialDepth) { public IQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return null; return null;
} }

View file

@ -21,6 +21,7 @@ import java.io.Reader;
import java.io.StringReader; import java.io.StringReader;
import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smack.util.ParserUtils;
@ -80,15 +81,15 @@ public final class TestUtils {
public static <EE extends ExtensionElement> EE parseExtensionElement(String elementString) public static <EE extends ExtensionElement> EE parseExtensionElement(String elementString)
throws Exception { throws Exception {
return parseExtensionElement(getParser(elementString)); return parseExtensionElement(getParser(elementString), null);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <EE extends ExtensionElement> EE parseExtensionElement(XmlPullParser parser) public static <EE extends ExtensionElement> EE parseExtensionElement(XmlPullParser parser, XmlEnvironment outerXmlEnvironment)
throws Exception { throws Exception {
ParserUtils.assertAtStartTag(parser); ParserUtils.assertAtStartTag(parser);
final String elementName = parser.getName(); final String elementName = parser.getName();
final String namespace = parser.getNamespace(); 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 java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
@ -41,7 +42,7 @@ public class CarbonManagerProvider extends ExtensionElementProvider<CarbonExtens
private static final ForwardedProvider FORWARDED_PROVIDER = new ForwardedProvider(); private static final ForwardedProvider FORWARDED_PROVIDER = new ForwardedProvider();
@Override @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()); Direction dir = Direction.valueOf(parser.getName());
Forwarded fwd = null; Forwarded fwd = null;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.hoxt.provider;
import java.io.IOException; import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.util.ParserUtils; 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"; private static final String ATTRIBUTE_MAX_CHUNK_SIZE = "maxChunkSize";
@Override @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(); HttpOverXmppReq.Builder builder = HttpOverXmppReq.builder();
builder.setResource(parser.getAttributeValue("", ATTRIBUTE_RESOURCE)); builder.setResource(parser.getAttributeValue("", ATTRIBUTE_RESOURCE));
builder.setVersion(parser.getAttributeValue("", ATTRIBUTE_VERSION)); builder.setVersion(parser.getAttributeValue("", ATTRIBUTE_VERSION));

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.hoxt.provider;
import java.io.IOException; import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smackx.hoxt.packet.AbstractHttpOverXmpp; import org.jivesoftware.smackx.hoxt.packet.AbstractHttpOverXmpp;
import org.jivesoftware.smackx.hoxt.packet.HttpOverXmppResp; 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"; private static final String ATTRIBUTE_STATUS_CODE = "statusCode";
@Override @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 version = parser.getAttributeValue("", ATTRIBUTE_VERSION);
String statusMessage = parser.getAttributeValue("", ATTRIBUTE_STATUS_MESSAGE); String statusMessage = parser.getAttributeValue("", ATTRIBUTE_STATUS_MESSAGE);
String statusCodeString = parser.getAttributeValue("", ATTRIBUTE_STATUS_CODE); String statusCodeString = parser.getAttributeValue("", ATTRIBUTE_STATUS_CODE);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -23,6 +23,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException; import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; 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()); private static final Logger LOGGER = Logger.getLogger(IoTFieldsExtensionProvider.class.getName());
@Override @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"); int seqNr = ParserUtils.getIntegerAttributeOrThrow(parser, "seqnr", "IoT data request <accepted/> without sequence number");
boolean done = ParserUtils.getBooleanAttribute(parser, "done", false); boolean done = ParserUtils.getBooleanAttribute(parser, "done", false);
List<NodeElement> nodes = new ArrayList<>(); List<NodeElement> nodes = new ArrayList<>();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -25,6 +25,7 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smackx.message_markup.element.BlockQuoteElement; import org.jivesoftware.smackx.message_markup.element.BlockQuoteElement;
@ -39,7 +40,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class MarkupElementProvider extends ExtensionElementProvider<MarkupElement> { public class MarkupElementProvider extends ExtensionElementProvider<MarkupElement> {
@Override @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(); MarkupElement.Builder markup = MarkupElement.getBuilder();

View file

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

View file

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

View file

@ -20,6 +20,7 @@ import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import org.jivesoftware.smack.packet.IQ.Type; import org.jivesoftware.smack.packet.IQ.Type;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.muclight.element.MUCLightBlockingIQ; import org.jivesoftware.smackx.muclight.element.MUCLightBlockingIQ;
@ -39,7 +40,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class MUCLightBlockingIQProvider extends IQProvider<MUCLightBlockingIQ> { public class MUCLightBlockingIQProvider extends IQProvider<MUCLightBlockingIQ> {
@Override @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> rooms = null;
HashMap<Jid, Boolean> users = null; HashMap<Jid, Boolean> users = null;

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.muclight.provider;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.muclight.MUCLightRoomConfiguration; import org.jivesoftware.smackx.muclight.MUCLightRoomConfiguration;
@ -36,7 +37,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class MUCLightConfigurationIQProvider extends IQProvider<MUCLightConfigurationIQ> { public class MUCLightConfigurationIQProvider extends IQProvider<MUCLightConfigurationIQ> {
@Override @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 version = null;
String roomName = null; String roomName = null;
String subject = null; String subject = null;

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.muclight.provider;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.muclight.element.MUCLightElements.ConfigurationsChangeExtension; import org.jivesoftware.smackx.muclight.element.MUCLightElements.ConfigurationsChangeExtension;
@ -35,7 +36,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class MUCLightConfigurationsChangeProvider extends ExtensionElementProvider<ConfigurationsChangeExtension> { public class MUCLightConfigurationsChangeProvider extends ExtensionElementProvider<ConfigurationsChangeExtension> {
@Override @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 prevVersion = null;
String version = null; String version = null;
String roomName = null; String roomName = null;

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.muclight.provider;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.muclight.MUCLightAffiliation; import org.jivesoftware.smackx.muclight.MUCLightAffiliation;
@ -39,7 +40,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class MUCLightInfoIQProvider extends IQProvider<MUCLightInfoIQ> { public class MUCLightInfoIQProvider extends IQProvider<MUCLightInfoIQ> {
@Override @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 version = null;
String roomName = null; String roomName = null;
String subject = null; String subject = null;

View file

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

View file

@ -21,6 +21,7 @@ import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.provider.ProviderManager; import org.jivesoftware.smack.provider.ProviderManager;
@ -35,7 +36,7 @@ public class ReferenceProvider extends ExtensionElementProvider<ReferenceElement
public static final ReferenceProvider TEST_PROVIDER = new ReferenceProvider(); public static final ReferenceProvider TEST_PROVIDER = new ReferenceProvider();
@Override @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 begin = ParserUtils.getIntegerAttribute(parser, ReferenceElement.ATTR_BEGIN);
Integer end = ParserUtils.getIntegerAttribute(parser, ReferenceElement.ATTR_END); Integer end = ParserUtils.getIntegerAttribute(parser, ReferenceElement.ATTR_END);
String typeString = parser.getAttributeValue(null, ReferenceElement.ATTR_TYPE); String typeString = parser.getAttributeValue(null, ReferenceElement.ATTR_TYPE);

View file

@ -16,6 +16,7 @@
*/ */
package org.jivesoftware.smackx.sid.provider; package org.jivesoftware.smackx.sid.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.sid.element.OriginIdElement; 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(); public static final OriginIdProvider TEST_INSTANCE = new OriginIdProvider();
@Override @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)); return new OriginIdElement(parser.getAttributeValue(null, OriginIdElement.ATTR_ID));
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.bytestreams.ibb.provider;
import java.io.IOException; import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smackx.bytestreams.ibb.packet.Data; import org.jivesoftware.smackx.bytestreams.ibb.packet.Data;
import org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtension; import org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtension;
@ -38,7 +39,7 @@ public class DataPacketProvider {
private static final PacketExtensionProvider packetExtensionProvider = new PacketExtensionProvider(); private static final PacketExtensionProvider packetExtensionProvider = new PacketExtensionProvider();
@Override @Override
public Data parse(XmlPullParser parser, int initialDepth) public Data parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
throws IOException, XmlPullParserException, SmackParsingException { throws IOException, XmlPullParserException, SmackParsingException {
DataPacketExtension data = packetExtensionProvider.parse(parser); DataPacketExtension data = packetExtensionProvider.parse(parser);
return new Data(data); return new Data(data);
@ -49,7 +50,7 @@ public class DataPacketProvider {
@Override @Override
public DataPacketExtension parse(XmlPullParser parser, public DataPacketExtension parse(XmlPullParser parser,
int initialDepth) throws XmlPullParserException, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException,
IOException { IOException {
String sessionID = parser.getAttributeValue("", "sid"); String sessionID = parser.getAttributeValue("", "sid");
long seq = Long.parseLong(parser.getAttributeValue("", "seq")); 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.io.IOException;
import java.util.Locale; import java.util.Locale;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType; import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType;
@ -35,7 +36,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class OpenIQProvider extends IQProvider<Open> { public class OpenIQProvider extends IQProvider<Open> {
@Override @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"); String sessionID = parser.getAttributeValue("", "sid");
int blockSize = Integer.parseInt(parser.getAttributeValue("", "block-size")); 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 java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smack.util.ParserUtils;
@ -36,7 +37,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class BytestreamsProvider extends IQProvider<Bytestream> { public class BytestreamsProvider extends IQProvider<Bytestream> {
@Override @Override
public Bytestream parse(XmlPullParser parser, int initialDepth) public Bytestream parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException { throws XmlPullParserException, IOException {
boolean done = false; boolean done = false;

View file

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

View file

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

View file

@ -20,6 +20,7 @@ package org.jivesoftware.smackx.commands.provider;
import java.io.IOException; import java.io.IOException;
import org.jivesoftware.smack.packet.StanzaError; import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
@ -42,7 +43,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class AdHocCommandDataProvider extends IQProvider<AdHocCommandData> { public class AdHocCommandDataProvider extends IQProvider<AdHocCommandData> {
@Override @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; boolean done = false;
AdHocCommandData adHocCommandData = new AdHocCommandData(); AdHocCommandData adHocCommandData = new AdHocCommandData();
DataFormProvider dataFormProvider = new DataFormProvider(); DataFormProvider dataFormProvider = new DataFormProvider();
@ -127,42 +128,42 @@ public class AdHocCommandDataProvider extends IQProvider<AdHocCommandData> {
public static class BadActionError extends ExtensionElementProvider<AdHocCommandData.SpecificError> { public static class BadActionError extends ExtensionElementProvider<AdHocCommandData.SpecificError> {
@Override @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); return new AdHocCommandData.SpecificError(AdHocCommand.SpecificErrorCondition.badAction);
} }
} }
public static class MalformedActionError extends ExtensionElementProvider<AdHocCommandData.SpecificError> { public static class MalformedActionError extends ExtensionElementProvider<AdHocCommandData.SpecificError> {
@Override @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); return new AdHocCommandData.SpecificError(AdHocCommand.SpecificErrorCondition.malformedAction);
} }
} }
public static class BadLocaleError extends ExtensionElementProvider<AdHocCommandData.SpecificError> { public static class BadLocaleError extends ExtensionElementProvider<AdHocCommandData.SpecificError> {
@Override @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); return new AdHocCommandData.SpecificError(AdHocCommand.SpecificErrorCondition.badLocale);
} }
} }
public static class BadPayloadError extends ExtensionElementProvider<AdHocCommandData.SpecificError> { public static class BadPayloadError extends ExtensionElementProvider<AdHocCommandData.SpecificError> {
@Override @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); return new AdHocCommandData.SpecificError(AdHocCommand.SpecificErrorCondition.badPayload);
} }
} }
public static class BadSessionIDError extends ExtensionElementProvider<AdHocCommandData.SpecificError> { public static class BadSessionIDError extends ExtensionElementProvider<AdHocCommandData.SpecificError> {
@Override @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); return new AdHocCommandData.SpecificError(AdHocCommand.SpecificErrorCondition.badSessionid);
} }
} }
public static class SessionExpiredError extends ExtensionElementProvider<AdHocCommandData.SpecificError> { public static class SessionExpiredError extends ExtensionElementProvider<AdHocCommandData.SpecificError> {
@Override @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); 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.io.IOException;
import java.util.Date; import java.util.Date;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException; import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
@ -31,7 +32,7 @@ public abstract class AbstractDelayInformationProvider extends ExtensionElementP
@Override @Override
public final DelayInformation parse(XmlPullParser parser, public final DelayInformation parse(XmlPullParser parser,
int initialDepth) throws XmlPullParserException, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException,
IOException, SmackTextParseException { IOException, SmackTextParseException {
String stampString = (parser.getAttributeValue("", "stamp")); String stampString = (parser.getAttributeValue("", "stamp"));
String from = parser.getAttributeValue("", "from"); String from = parser.getAttributeValue("", "from");

View file

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

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.disco.provider;
import java.io.IOException; import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smack.util.ParserUtils;
@ -36,7 +37,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class DiscoverItemsProvider extends IQProvider<DiscoverItems> { public class DiscoverItemsProvider extends IQProvider<DiscoverItems> {
@Override @Override
public DiscoverItems parse(XmlPullParser parser, int initialDepth) public DiscoverItems parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException { throws XmlPullParserException, IOException {
DiscoverItems discoverItems = new DiscoverItems(); DiscoverItems discoverItems = new DiscoverItems();
boolean done = false; 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.Message;
import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.PacketParserUtils; 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()); private static final Logger LOGGER = Logger.getLogger(ForwardedProvider.class.getName());
@Override @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; DelayInformation di = null;
Stanza packet = null; Stanza packet = null;
@ -58,7 +59,7 @@ public class ForwardedProvider extends ExtensionElementProvider<Forwarded> {
switch (name) { switch (name) {
case DelayInformation.ELEMENT: case DelayInformation.ELEMENT:
if (DelayInformation.NAMESPACE.equals(namespace)) { if (DelayInformation.NAMESPACE.equals(namespace)) {
di = DelayInformationProvider.INSTANCE.parse(parser, parser.getDepth()); di = DelayInformationProvider.INSTANCE.parse(parser, parser.getDepth(), null);
} else { } else {
LOGGER.warning("Namespace '" + namespace + "' does not match expected namespace '" LOGGER.warning("Namespace '" + namespace + "' does not match expected namespace '"
+ DelayInformation.NAMESPACE + "'"); + DelayInformation.NAMESPACE + "'");

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.jingle.provider;
import java.io.IOException; import java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
@ -30,6 +31,6 @@ public abstract class JingleContentDescriptionProvider<D extends JingleContentDe
extends ExtensionElementProvider<D> { extends ExtensionElementProvider<D> {
@Override @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 java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.jingle.element.JingleContentTransport; import org.jivesoftware.smackx.jingle.element.JingleContentTransport;
@ -29,6 +30,6 @@ public abstract class JingleContentTransportProvider<T extends JingleContentTran
extends ExtensionElementProvider<T> { extends ExtensionElementProvider<T> {
@Override @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; package org.jivesoftware.smackx.jingle.provider;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.jingle.element.JingleError; import org.jivesoftware.smackx.jingle.element.JingleError;
@ -25,7 +26,7 @@ import org.xmlpull.v1.XmlPullParser;
public class JingleErrorProvider extends ExtensionElementProvider<JingleError> { public class JingleErrorProvider extends ExtensionElementProvider<JingleError> {
@Override @Override
public JingleError parse(XmlPullParser parser, int initialDepth) { public JingleError parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
String errorName = parser.getName(); String errorName = parser.getName();
return JingleError.fromString(errorName); return JingleError.fromString(errorName);
} }

View file

@ -20,6 +20,7 @@ import java.io.IOException;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.packet.StandardExtensionElement; import org.jivesoftware.smack.packet.StandardExtensionElement;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.parsing.StandardExtensionElementProvider; import org.jivesoftware.smack.parsing.StandardExtensionElementProvider;
import org.jivesoftware.smack.provider.IQProvider; 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()); private static final Logger LOGGER = Logger.getLogger(JingleProvider.class.getName());
@Override @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(); Jingle.Builder builder = Jingle.getBuilder();
String actionString = parser.getAttributeValue("", Jingle.ACTION_ATTRIBUTE_NAME); String actionString = parser.getAttributeValue("", Jingle.ACTION_ATTRIBUTE_NAME);

View file

@ -16,6 +16,7 @@
*/ */
package org.jivesoftware.smackx.jingle.transports.jingle_ibb.provider; 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.provider.JingleContentTransportProvider;
import org.jivesoftware.smackx.jingle.transports.jingle_ibb.element.JingleIBBTransport; 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> { public class JingleIBBTransportProvider extends JingleContentTransportProvider<JingleIBBTransport> {
@Override @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 blockSizeString = parser.getAttributeValue(null, JingleIBBTransport.ATTR_BLOCK_SIZE);
String sid = parser.getAttributeValue(null, JingleIBBTransport.ATTR_SID); 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 java.io.IOException;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smackx.jingle.element.JingleContentTransport; import org.jivesoftware.smackx.jingle.element.JingleContentTransport;
import org.jivesoftware.smackx.jingle.provider.JingleContentTransportProvider; import org.jivesoftware.smackx.jingle.provider.JingleContentTransportProvider;
import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransport; 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> { public class JingleS5BTransportProvider extends JingleContentTransportProvider<JingleS5BTransport> {
@Override @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(); JingleS5BTransport.Builder builder = JingleS5BTransport.getBuilder();
String streamId = parser.getAttributeValue(null, JingleS5BTransport.ATTR_SID); String streamId = parser.getAttributeValue(null, JingleS5BTransport.ATTR_SID);

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