mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-12 14:01:08 +01:00
Replace XPP3 by XmlPullParser interface wrapping StAX and XPP3
Introducing Smack's own XmlPullParser interface which tries to stay as compatible as possible to XPP3. The interface is used to either wrap StAX's XMLStreamReader if Smack is used on Java SE, and XPP3's XmlPullParser if Smack is used on on Android. Fixes SMACK-591. Also introduce JUnit 5 and non-strict javadoc projects.
This commit is contained in:
parent
b3646abecd
commit
4133eb175c
414 changed files with 3855 additions and 2041 deletions
|
|
@ -17,6 +17,7 @@
|
|||
package org.jivesoftware.smackx.jingle;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||
|
||||
public interface JingleHandler {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
|||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.IQ.Type;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleAction;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import java.util.concurrent.Future;
|
|||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||
import org.jivesoftware.smackx.jingle.transports.JingleTransportSession;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package org.jivesoftware.smackx.jingle;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||
|
||||
public interface JingleSessionHandler {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import java.util.WeakHashMap;
|
|||
|
||||
import org.jivesoftware.smack.Manager;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentTransport;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import org.jivesoftware.smack.XMPPConnection;
|
|||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleAction;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||
|
|
|
|||
|
|
@ -21,12 +21,11 @@ import java.io.IOException;
|
|||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescription;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
public abstract class JingleContentDescriptionProvider<D extends JingleContentDescription>
|
||||
extends ExtensionElementProvider<D> {
|
||||
|
||||
|
|
|
|||
|
|
@ -20,12 +20,11 @@ import java.io.IOException;
|
|||
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentTransport;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
public abstract class JingleContentTransportProvider<T extends JingleContentTransport>
|
||||
extends ExtensionElementProvider<T> {
|
||||
|
||||
|
|
|
|||
|
|
@ -18,11 +18,10 @@ package org.jivesoftware.smackx.jingle.provider;
|
|||
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.element.JingleError;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
||||
public class JingleErrorProvider extends ExtensionElementProvider<JingleError> {
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ import org.jivesoftware.smack.parsing.SmackParsingException;
|
|||
import org.jivesoftware.smack.parsing.StandardExtensionElementProvider;
|
||||
import org.jivesoftware.smack.provider.IQProvider;
|
||||
import org.jivesoftware.smack.util.ParserUtils;
|
||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleAction;
|
||||
|
|
@ -37,8 +39,6 @@ import org.jivesoftware.smackx.jingle.element.UnknownJingleContentDescription;
|
|||
import org.jivesoftware.smackx.jingle.element.UnknownJingleContentTransport;
|
||||
|
||||
import org.jxmpp.jid.FullJid;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
public class JingleProvider extends IQProvider<Jingle> {
|
||||
|
||||
|
|
@ -65,9 +65,9 @@ public class JingleProvider extends IQProvider<Jingle> {
|
|||
|
||||
|
||||
outerloop: while (true) {
|
||||
int eventType = parser.next();
|
||||
XmlPullParser.Event eventType = parser.next();
|
||||
switch (eventType) {
|
||||
case XmlPullParser.START_TAG:
|
||||
case START_ELEMENT:
|
||||
String tagName = parser.getName();
|
||||
switch (tagName) {
|
||||
case JingleContent.ELEMENT:
|
||||
|
|
@ -92,10 +92,14 @@ public class JingleProvider extends IQProvider<Jingle> {
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case XmlPullParser.END_TAG:
|
||||
case END_ELEMENT:
|
||||
if (parser.getDepth() == initialDepth) {
|
||||
break outerloop;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Catch all for incomplete switch (MissingCasesInEnumSwitch) statement.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -123,9 +127,9 @@ public class JingleProvider extends IQProvider<Jingle> {
|
|||
}
|
||||
|
||||
outerloop: while (true) {
|
||||
int eventType = parser.next();
|
||||
XmlPullParser.Event eventType = parser.next();
|
||||
switch (eventType) {
|
||||
case XmlPullParser.START_TAG:
|
||||
case START_ELEMENT:
|
||||
String tagName = parser.getName();
|
||||
String namespace = parser.getNamespace();
|
||||
switch (tagName) {
|
||||
|
|
@ -160,10 +164,14 @@ public class JingleProvider extends IQProvider<Jingle> {
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case XmlPullParser.END_TAG:
|
||||
case END_ELEMENT:
|
||||
if (parser.getDepth() == initialDepth) {
|
||||
break outerloop;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Catch all for incomplete switch (MissingCasesInEnumSwitch) statement.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package org.jivesoftware.smackx.jingle.transports;
|
|||
|
||||
import org.jivesoftware.smack.AbstractConnectionListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.JingleSession;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentTransport;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package org.jivesoftware.smackx.jingle.transports;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.JingleSession;
|
||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package org.jivesoftware.smackx.jingle.transports.jingle_ibb;
|
|||
import java.util.WeakHashMap;
|
||||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.JingleSession;
|
||||
import org.jivesoftware.smackx.jingle.provider.JingleContentProviderManager;
|
||||
import org.jivesoftware.smackx.jingle.transports.JingleTransportManager;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import java.util.logging.Logger;
|
|||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
||||
import org.jivesoftware.smackx.bytestreams.BytestreamListener;
|
||||
import org.jivesoftware.smackx.bytestreams.BytestreamRequest;
|
||||
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@
|
|||
package org.jivesoftware.smackx.jingle.transports.jingle_ibb.provider;
|
||||
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.provider.JingleContentTransportProvider;
|
||||
import org.jivesoftware.smackx.jingle.transports.jingle_ibb.element.JingleIBBTransport;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
||||
/**
|
||||
* Parse JingleByteStreamTransport elements.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import org.jivesoftware.smack.SmackException;
|
|||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamManager;
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.Socks5Proxy;
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import java.util.logging.Logger;
|
|||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamSession;
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.Socks5Client;
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.Socks5ClientForInitiator;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import java.util.List;
|
|||
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentTransport;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentTransportCandidate;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import java.util.logging.Logger;
|
|||
import org.jivesoftware.smack.util.Objects;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentTransportCandidate;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements;
|
||||
|
||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentTransportInfo;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -24,12 +24,13 @@ import static org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.Jing
|
|||
import static org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransportCandidate.ATTR_PORT;
|
||||
import static org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransportCandidate.ATTR_PRIORITY;
|
||||
import static org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransportCandidate.ATTR_TYPE;
|
||||
import static org.xmlpull.v1.XmlPullParser.END_TAG;
|
||||
import static org.xmlpull.v1.XmlPullParser.START_TAG;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentTransport;
|
||||
import org.jivesoftware.smackx.jingle.provider.JingleContentTransportProvider;
|
||||
import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransport;
|
||||
|
|
@ -37,9 +38,6 @@ import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTr
|
|||
import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransportInfo;
|
||||
import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransportInfo.JingleS5BCandidateTransportInfo;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/**
|
||||
* Provider for JingleSocks5BytestreamTransport elements.
|
||||
*/
|
||||
|
|
@ -62,10 +60,10 @@ public class JingleS5BTransportProvider extends JingleContentTransportProvider<J
|
|||
|
||||
JingleS5BTransportCandidate.Builder cb;
|
||||
outerloop: while (true) {
|
||||
int tag = parser.nextTag();
|
||||
XmlPullParser.TagEvent tag = parser.nextTag();
|
||||
String name = parser.getName();
|
||||
switch (tag) {
|
||||
case START_TAG: {
|
||||
case START_ELEMENT: {
|
||||
switch (name) {
|
||||
|
||||
case JingleS5BTransportCandidate.ELEMENT:
|
||||
|
|
@ -110,12 +108,13 @@ public class JingleS5BTransportProvider extends JingleContentTransportProvider<J
|
|||
}
|
||||
break;
|
||||
|
||||
case END_TAG: {
|
||||
case END_ELEMENT: {
|
||||
switch (name) {
|
||||
case JingleContentTransport.ELEMENT:
|
||||
break outerloop;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return builder.build();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue