mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-26 00:02:06 +01:00
Make Provider.parse() just throw Exception
instead of throwing XmlPullParserException, IOException and SmackException. Add a guard to AbstractXMPPConnection.processPacket() to always re-throw RuntimeExceptions.
This commit is contained in:
parent
4d9bd6f216
commit
bc093b620d
29 changed files with 63 additions and 156 deletions
|
@ -85,7 +85,6 @@ import org.jxmpp.jid.FullJid;
|
||||||
import org.jxmpp.jid.Jid;
|
import org.jxmpp.jid.Jid;
|
||||||
import org.jxmpp.util.XmppStringUtils;
|
import org.jxmpp.util.XmppStringUtils;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
|
|
||||||
public abstract class AbstractXMPPConnection implements XMPPConnection {
|
public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
|
@ -960,6 +959,10 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
stanza = PacketParserUtils.parseStanza(parser);
|
stanza = PacketParserUtils.parseStanza(parser);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
// Always re-throw runtime exceptions, they are fatal
|
||||||
|
if (e instanceof RuntimeException) {
|
||||||
|
throw (RuntimeException) e;
|
||||||
|
}
|
||||||
CharSequence content = PacketParserUtils.parseContentDepth(parser,
|
CharSequence content = PacketParserUtils.parseContentDepth(parser,
|
||||||
parserDepth);
|
parserDepth);
|
||||||
UnparsablePacket message = new UnparsablePacket(content, e);
|
UnparsablePacket message = new UnparsablePacket(content, e);
|
||||||
|
@ -1315,8 +1318,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void parseFeatures(XmlPullParser parser) throws XmlPullParserException,
|
protected final void parseFeatures(XmlPullParser parser) throws Exception {
|
||||||
IOException, SmackException, InterruptedException {
|
|
||||||
streamFeatures.clear();
|
streamFeatures.clear();
|
||||||
final int initialDepth = parser.getDepth();
|
final int initialDepth = parser.getDepth();
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
|
@ -16,17 +16,14 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smack.provider;
|
package org.jivesoftware.smack.provider;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -84,8 +81,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,
|
public final PE parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||||
SmackException {
|
|
||||||
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();
|
||||||
|
|
|
@ -17,17 +17,13 @@
|
||||||
|
|
||||||
package org.jivesoftware.smack.provider;
|
package org.jivesoftware.smack.provider;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smack.packet.Element;
|
import org.jivesoftware.smack.packet.Element;
|
||||||
import org.jivesoftware.smack.util.ParserUtils;
|
import org.jivesoftware.smack.util.ParserUtils;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
public abstract class Provider<E extends Element> {
|
public abstract class Provider<E extends Element> {
|
||||||
|
|
||||||
public final E parse(XmlPullParser parser) throws XmlPullParserException, IOException, SmackException {
|
public final E parse(XmlPullParser parser) throws Exception{
|
||||||
// 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);
|
||||||
|
|
||||||
|
@ -39,5 +35,5 @@ public abstract class Provider<E extends Element> {
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract E parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException;
|
public abstract E parse(XmlPullParser parser, int initialDepth) throws Exception;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ public class PacketParserUtils {
|
||||||
return parser;
|
return parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Stanza parseStanza(String stanza) throws XmlPullParserException, IOException, SmackException {
|
public static Stanza parseStanza(String stanza) throws Exception {
|
||||||
return parseStanza(getParserFor(stanza));
|
return parseStanza(getParserFor(stanza));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,11 +140,9 @@ public class PacketParserUtils {
|
||||||
*
|
*
|
||||||
* @param parser
|
* @param parser
|
||||||
* @return a packet which is either a Message, IQ or Presence.
|
* @return a packet which is either a Message, IQ or Presence.
|
||||||
* @throws XmlPullParserException
|
* @throws Exception
|
||||||
* @throws SmackException
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
*/
|
||||||
public static Stanza parseStanza(XmlPullParser parser) throws XmlPullParserException, IOException, SmackException {
|
public static Stanza parseStanza(XmlPullParser parser) throws Exception {
|
||||||
ParserUtils.assertAtStartTag(parser);
|
ParserUtils.assertAtStartTag(parser);
|
||||||
final String name = parser.getName();
|
final String name = parser.getName();
|
||||||
switch (name) {
|
switch (name) {
|
||||||
|
@ -211,12 +209,10 @@ public class PacketParserUtils {
|
||||||
*
|
*
|
||||||
* @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.
|
||||||
* @return a Message packet.
|
* @return a Message packet.
|
||||||
* @throws IOException
|
* @throws Exception
|
||||||
* @throws XmlPullParserException
|
|
||||||
* @throws SmackException
|
|
||||||
*/
|
*/
|
||||||
public static Message parseMessage(XmlPullParser parser)
|
public static Message parseMessage(XmlPullParser parser)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws Exception {
|
||||||
ParserUtils.assertAtStartTag(parser);
|
ParserUtils.assertAtStartTag(parser);
|
||||||
assert(parser.getName().equals(Message.ELEMENT));
|
assert(parser.getName().equals(Message.ELEMENT));
|
||||||
|
|
||||||
|
@ -513,12 +509,10 @@ public class PacketParserUtils {
|
||||||
*
|
*
|
||||||
* @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.
|
||||||
* @return a Presence packet.
|
* @return a Presence packet.
|
||||||
* @throws IOException
|
* @throws Exception
|
||||||
* @throws XmlPullParserException
|
|
||||||
* @throws SmackException
|
|
||||||
*/
|
*/
|
||||||
public static Presence parsePresence(XmlPullParser parser)
|
public static Presence parsePresence(XmlPullParser parser)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws Exception {
|
||||||
ParserUtils.assertAtStartTag(parser);
|
ParserUtils.assertAtStartTag(parser);
|
||||||
final int initialDepth = parser.getDepth();
|
final int initialDepth = parser.getDepth();
|
||||||
|
|
||||||
|
@ -600,7 +594,7 @@ public class PacketParserUtils {
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws SmackException
|
* @throws SmackException
|
||||||
*/
|
*/
|
||||||
public static IQ parseIQ(XmlPullParser parser) throws XmlPullParserException, IOException, SmackException {
|
public static IQ parseIQ(XmlPullParser parser) throws Exception {
|
||||||
ParserUtils.assertAtStartTag(parser);
|
ParserUtils.assertAtStartTag(parser);
|
||||||
final int initialDepth = parser.getDepth();
|
final int initialDepth = parser.getDepth();
|
||||||
IQ iqPacket = null;
|
IQ iqPacket = null;
|
||||||
|
@ -792,11 +786,9 @@ public class PacketParserUtils {
|
||||||
*
|
*
|
||||||
* @param parser the XML parser.
|
* @param parser the XML parser.
|
||||||
* @return an stream error packet.
|
* @return an stream error packet.
|
||||||
* @throws XmlPullParserException if an exception occurs while parsing the packet.
|
* @throws Exception if an exception occurs while parsing the packet.
|
||||||
* @throws SmackException
|
|
||||||
*/
|
*/
|
||||||
public static StreamError parseStreamError(XmlPullParser parser) throws IOException, XmlPullParserException,
|
public static StreamError parseStreamError(XmlPullParser parser) throws Exception {
|
||||||
SmackException {
|
|
||||||
final int initialDepth = parser.getDepth();
|
final int initialDepth = parser.getDepth();
|
||||||
List<ExtensionElement> extensions = new ArrayList<ExtensionElement>();
|
List<ExtensionElement> extensions = new ArrayList<ExtensionElement>();
|
||||||
Map<String, String> descriptiveTexts = null;
|
Map<String, String> descriptiveTexts = null;
|
||||||
|
@ -844,12 +836,10 @@ public class PacketParserUtils {
|
||||||
*
|
*
|
||||||
* @param parser the XML parser.
|
* @param parser the XML parser.
|
||||||
* @return an error sub-packet.
|
* @return an error sub-packet.
|
||||||
* @throws IOException
|
* @throws Exception
|
||||||
* @throws XmlPullParserException
|
|
||||||
* @throws SmackException
|
|
||||||
*/
|
*/
|
||||||
public static XMPPError parseError(XmlPullParser parser)
|
public static XMPPError parseError(XmlPullParser parser)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws Exception {
|
||||||
final int initialDepth = parser.getDepth();
|
final int initialDepth = parser.getDepth();
|
||||||
Map<String, String> descriptiveTexts = null;
|
Map<String, String> descriptiveTexts = null;
|
||||||
XMPPError.Condition condition = null;
|
XMPPError.Condition condition = null;
|
||||||
|
@ -898,8 +888,7 @@ public class PacketParserUtils {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static ExtensionElement parsePacketExtension(String elementName, String namespace,
|
public static ExtensionElement parsePacketExtension(String elementName, String namespace,
|
||||||
XmlPullParser parser) throws XmlPullParserException,
|
XmlPullParser parser) throws Exception {
|
||||||
IOException, SmackException {
|
|
||||||
return parseExtensionElement(elementName, namespace, parser);
|
return parseExtensionElement(elementName, namespace, parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -912,8 +901,7 @@ public class PacketParserUtils {
|
||||||
* @return an extension element.
|
* @return an extension element.
|
||||||
*/
|
*/
|
||||||
public static ExtensionElement parseExtensionElement(String elementName, String namespace,
|
public static ExtensionElement parseExtensionElement(String elementName, String namespace,
|
||||||
XmlPullParser parser) throws XmlPullParserException,
|
XmlPullParser parser) throws Exception {
|
||||||
IOException, SmackException {
|
|
||||||
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);
|
||||||
|
@ -1017,51 +1005,49 @@ public class PacketParserUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void addPacketExtension(Stanza packet, XmlPullParser parser) throws XmlPullParserException,
|
public static void addPacketExtension(Stanza packet, XmlPullParser parser) throws Exception {
|
||||||
IOException, SmackException {
|
|
||||||
addExtensionElement(packet, parser);
|
addExtensionElement(packet, parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void addPacketExtension(Stanza packet, XmlPullParser parser, String elementName, String namespace)
|
public static void addPacketExtension(Stanza packet, XmlPullParser parser, String elementName, String namespace)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws Exception {
|
||||||
addExtensionElement(packet, parser, elementName, namespace);
|
addExtensionElement(packet, parser, elementName, namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void addPacketExtension(Collection<ExtensionElement> collection, XmlPullParser parser)
|
public static void addPacketExtension(Collection<ExtensionElement> collection, XmlPullParser parser)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws Exception {
|
||||||
addExtensionElement(collection, parser, parser.getName(), parser.getNamespace());
|
addExtensionElement(collection, parser, parser.getName(), parser.getNamespace());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void addPacketExtension(Collection<ExtensionElement> collection, XmlPullParser parser,
|
public static void addPacketExtension(Collection<ExtensionElement> collection, XmlPullParser parser,
|
||||||
String elementName, String namespace) throws XmlPullParserException, IOException, SmackException {
|
String elementName, String namespace) throws Exception {
|
||||||
addExtensionElement(collection, parser, elementName, namespace);
|
addExtensionElement(collection, parser, elementName, namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void addExtensionElement(Stanza packet, XmlPullParser parser)
|
public static void addExtensionElement(Stanza packet, XmlPullParser parser)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws Exception {
|
||||||
ParserUtils.assertAtStartTag(parser);
|
ParserUtils.assertAtStartTag(parser);
|
||||||
addExtensionElement(packet, parser, parser.getName(), parser.getNamespace());
|
addExtensionElement(packet, parser, parser.getName(), parser.getNamespace());
|
||||||
}
|
}
|
||||||
|
|
||||||
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, SmackException {
|
String namespace) throws Exception{
|
||||||
ExtensionElement packetExtension = parseExtensionElement(elementName, namespace, parser);
|
ExtensionElement packetExtension = parseExtensionElement(elementName, namespace, parser);
|
||||||
packet.addExtension(packetExtension);
|
packet.addExtension(packetExtension);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addExtensionElement(Collection<ExtensionElement> collection,
|
public static void addExtensionElement(Collection<ExtensionElement> collection,
|
||||||
XmlPullParser parser) throws XmlPullParserException, IOException,
|
XmlPullParser parser) throws Exception {
|
||||||
SmackException {
|
|
||||||
addExtensionElement(collection, parser, parser.getName(), parser.getNamespace());
|
addExtensionElement(collection, parser, parser.getName(), parser.getNamespace());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addExtensionElement(Collection<ExtensionElement> collection,
|
public static void addExtensionElement(Collection<ExtensionElement> collection,
|
||||||
XmlPullParser parser, String elementName, String namespace)
|
XmlPullParser parser, String elementName, String namespace)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws Exception {
|
||||||
ExtensionElement packetExtension = parseExtensionElement(elementName, namespace, parser);
|
ExtensionElement packetExtension = parseExtensionElement(elementName, namespace, parser);
|
||||||
collection.add(packetExtension);
|
collection.add(packetExtension);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
import org.jivesoftware.smack.util.ParserUtils;
|
import org.jivesoftware.smack.util.ParserUtils;
|
||||||
|
@ -79,13 +78,13 @@ final public class TestUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <EE extends ExtensionElement> EE parseExtensionElement(String elementString)
|
public static <EE extends ExtensionElement> EE parseExtensionElement(String elementString)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws Exception {
|
||||||
return parseExtensionElement(getParser(elementString));
|
return parseExtensionElement(getParser(elementString));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <EE extends ExtensionElement> EE parseExtensionElement(XmlPullParser parser)
|
public static <EE extends ExtensionElement> EE parseExtensionElement(XmlPullParser parser)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
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();
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.carbons.provider;
|
package org.jivesoftware.smackx.carbons.provider;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
import org.jivesoftware.smack.SmackException;
|
||||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
import org.jivesoftware.smackx.carbons.packet.CarbonExtension;
|
import org.jivesoftware.smackx.carbons.packet.CarbonExtension;
|
||||||
|
@ -25,7 +23,6 @@ import org.jivesoftware.smackx.carbons.packet.CarbonExtension.Direction;
|
||||||
import org.jivesoftware.smackx.forward.packet.Forwarded;
|
import org.jivesoftware.smackx.forward.packet.Forwarded;
|
||||||
import org.jivesoftware.smackx.forward.provider.ForwardedProvider;
|
import org.jivesoftware.smackx.forward.provider.ForwardedProvider;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class implements the {@link ExtensionElementProvider} to parse
|
* This class implements the {@link ExtensionElementProvider} to parse
|
||||||
|
@ -40,7 +37,7 @@ public class CarbonManagerProvider extends ExtensionElementProvider<CarbonExtens
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CarbonExtension parse(XmlPullParser parser, int initialDepth)
|
public CarbonExtension parse(XmlPullParser parser, int initialDepth)
|
||||||
throws SmackException, XmlPullParserException, IOException {
|
throws Exception {
|
||||||
Direction dir = Direction.valueOf(parser.getName());
|
Direction dir = Direction.valueOf(parser.getName());
|
||||||
Forwarded fwd = null;
|
Forwarded fwd = null;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.hoxt.provider;
|
package org.jivesoftware.smackx.hoxt.provider;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smack.packet.NamedElement;
|
import org.jivesoftware.smack.packet.NamedElement;
|
||||||
import org.jivesoftware.smack.provider.IQProvider;
|
import org.jivesoftware.smack.provider.IQProvider;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
@ -55,11 +54,9 @@ public abstract class AbstractHttpOverXmppProvider<H extends AbstractHttpOverXmp
|
||||||
* @param parser parser
|
* @param parser parser
|
||||||
* @param elementName name of concrete implementation of this element
|
* @param elementName name of concrete implementation of this element
|
||||||
* @param body parent Body element
|
* @param body parent Body element
|
||||||
* @throws IOException
|
* @throws Exception
|
||||||
* @throws XmlPullParserException
|
|
||||||
* @throws SmackException
|
|
||||||
*/
|
*/
|
||||||
protected void parseHeadersAndData(XmlPullParser parser, String elementName, AbstractHttpOverXmpp body) throws XmlPullParserException, IOException, SmackException {
|
protected void parseHeadersAndData(XmlPullParser parser, String elementName, AbstractHttpOverXmpp body) throws Exception {
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
|
|
||||||
while (!done) {
|
while (!done) {
|
||||||
|
|
|
@ -16,13 +16,9 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.hoxt.provider;
|
package org.jivesoftware.smackx.hoxt.provider;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smackx.hoxt.packet.HttpMethod;
|
import org.jivesoftware.smackx.hoxt.packet.HttpMethod;
|
||||||
import org.jivesoftware.smackx.hoxt.packet.HttpOverXmppReq;
|
import org.jivesoftware.smackx.hoxt.packet.HttpOverXmppReq;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Req packet provider.
|
* Req packet provider.
|
||||||
|
@ -38,7 +34,7 @@ public class HttpOverXmppReqProvider extends AbstractHttpOverXmppProvider<HttpOv
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpOverXmppReq parse(XmlPullParser parser, int initialDepth)
|
public HttpOverXmppReq parse(XmlPullParser parser, int initialDepth)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws Exception {
|
||||||
String method = parser.getAttributeValue("", ATTRIBUTE_METHOD);
|
String method = parser.getAttributeValue("", ATTRIBUTE_METHOD);
|
||||||
String resource = parser.getAttributeValue("", ATTRIBUTE_RESOURCE);
|
String resource = parser.getAttributeValue("", ATTRIBUTE_RESOURCE);
|
||||||
String version = parser.getAttributeValue("", ATTRIBUTE_VERSION);
|
String version = parser.getAttributeValue("", ATTRIBUTE_VERSION);
|
||||||
|
|
|
@ -16,12 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.hoxt.provider;
|
package org.jivesoftware.smackx.hoxt.provider;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smackx.hoxt.packet.HttpOverXmppResp;
|
import org.jivesoftware.smackx.hoxt.packet.HttpOverXmppResp;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resp packet provider.
|
* Resp packet provider.
|
||||||
|
@ -36,7 +32,7 @@ public class HttpOverXmppRespProvider extends AbstractHttpOverXmppProvider<HttpO
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpOverXmppResp parse(XmlPullParser parser, int initialDepth)
|
public HttpOverXmppResp parse(XmlPullParser parser, int initialDepth)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws Exception {
|
||||||
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);
|
||||||
|
|
|
@ -18,7 +18,6 @@ package org.jivesoftware.smackx.bytestreams.ibb.provider;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
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;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
|
@ -38,8 +37,7 @@ public class DataPacketProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Data parse(XmlPullParser parser, int initialDepth)
|
public Data parse(XmlPullParser parser, int initialDepth)
|
||||||
throws XmlPullParserException, IOException,
|
throws Exception {
|
||||||
SmackException {
|
|
||||||
DataPacketExtension data = packetExtensionProvider.parse(parser);
|
DataPacketExtension data = packetExtensionProvider.parse(parser);
|
||||||
Data iq = new Data(data);
|
Data iq = new Data(data);
|
||||||
return iq;
|
return iq;
|
||||||
|
|
|
@ -17,9 +17,6 @@
|
||||||
|
|
||||||
package org.jivesoftware.smackx.commands.provider;
|
package org.jivesoftware.smackx.commands.provider;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.XMPPError;
|
||||||
import org.jivesoftware.smack.provider.IQProvider;
|
import org.jivesoftware.smack.provider.IQProvider;
|
||||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
|
@ -31,7 +28,6 @@ import org.jivesoftware.smackx.commands.AdHocCommandNote;
|
||||||
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
||||||
import org.jivesoftware.smackx.xdata.provider.DataFormProvider;
|
import org.jivesoftware.smackx.xdata.provider.DataFormProvider;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The AdHocCommandDataProvider parses AdHocCommandData packets.
|
* The AdHocCommandDataProvider parses AdHocCommandData packets.
|
||||||
|
@ -42,7 +38,7 @@ public class AdHocCommandDataProvider extends IQProvider<AdHocCommandData> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AdHocCommandData parse(XmlPullParser parser, int initialDepth)
|
public AdHocCommandData parse(XmlPullParser parser, int initialDepth)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws Exception {
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
AdHocCommandData adHocCommandData = new AdHocCommandData();
|
AdHocCommandData adHocCommandData = new AdHocCommandData();
|
||||||
DataFormProvider dataFormProvider = new DataFormProvider();
|
DataFormProvider dataFormProvider = new DataFormProvider();
|
||||||
|
|
|
@ -17,14 +17,10 @@
|
||||||
|
|
||||||
package org.jivesoftware.smackx.disco.provider;
|
package org.jivesoftware.smackx.disco.provider;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smack.provider.IQProvider;
|
import org.jivesoftware.smack.provider.IQProvider;
|
||||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The DiscoverInfoProvider parses Service Discovery information packets.
|
* The DiscoverInfoProvider parses Service Discovery information packets.
|
||||||
|
@ -35,7 +31,7 @@ public class DiscoverInfoProvider extends IQProvider<DiscoverInfo> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DiscoverInfo parse(XmlPullParser parser, int initialDepth)
|
public DiscoverInfo parse(XmlPullParser parser, int initialDepth)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws Exception {
|
||||||
DiscoverInfo discoverInfo = new DiscoverInfo();
|
DiscoverInfo discoverInfo = new DiscoverInfo();
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
DiscoverInfo.Identity identity = null;
|
DiscoverInfo.Identity identity = null;
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.forward.provider;
|
package org.jivesoftware.smackx.forward.provider;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
import org.jivesoftware.smack.SmackException;
|
||||||
|
@ -28,7 +27,6 @@ import org.jivesoftware.smackx.delay.packet.DelayInformation;
|
||||||
import org.jivesoftware.smackx.delay.provider.DelayInformationProvider;
|
import org.jivesoftware.smackx.delay.provider.DelayInformationProvider;
|
||||||
import org.jivesoftware.smackx.forward.packet.Forwarded;
|
import org.jivesoftware.smackx.forward.packet.Forwarded;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class implements the {@link ExtensionElementProvider} to parse
|
* This class implements the {@link ExtensionElementProvider} to parse
|
||||||
|
@ -41,7 +39,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, SmackException {
|
public Forwarded parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||||
DelayInformation di = null;
|
DelayInformation di = null;
|
||||||
Stanza packet = null;
|
Stanza packet = null;
|
||||||
|
|
||||||
|
|
|
@ -16,26 +16,23 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.iqregister.provider;
|
package org.jivesoftware.smackx.iqregister.provider;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.provider.IQProvider;
|
import org.jivesoftware.smack.provider.IQProvider;
|
||||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
import org.jivesoftware.smackx.iqregister.packet.Registration;
|
import org.jivesoftware.smackx.iqregister.packet.Registration;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
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)
|
public Registration parse(XmlPullParser parser, int initialDepth)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws Exception {
|
||||||
String instruction = null;
|
String instruction = null;
|
||||||
Map<String, String> fields = new HashMap<String, String>();
|
Map<String, String> fields = new HashMap<String, String>();
|
||||||
List<ExtensionElement> packetExtensions = new LinkedList<ExtensionElement>();
|
List<ExtensionElement> packetExtensions = new LinkedList<ExtensionElement>();
|
||||||
|
|
|
@ -17,14 +17,10 @@
|
||||||
|
|
||||||
package org.jivesoftware.smackx.muc.provider;
|
package org.jivesoftware.smackx.muc.provider;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smack.provider.IQProvider;
|
import org.jivesoftware.smack.provider.IQProvider;
|
||||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
import org.jivesoftware.smackx.muc.packet.MUCOwner;
|
import org.jivesoftware.smackx.muc.packet.MUCOwner;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The MUCOwnerProvider parses MUCOwner packets. (@see MUCOwner)
|
* The MUCOwnerProvider parses MUCOwner packets. (@see MUCOwner)
|
||||||
|
@ -35,7 +31,7 @@ public class MUCOwnerProvider extends IQProvider<MUCOwner> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MUCOwner parse(XmlPullParser parser, int initialDepth)
|
public MUCOwner parse(XmlPullParser parser, int initialDepth)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws Exception {
|
||||||
MUCOwner mucOwner = new MUCOwner();
|
MUCOwner mucOwner = new MUCOwner();
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
while (!done) {
|
while (!done) {
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class PEPProvider extends ExtensionElementProvider<ExtensionElement> {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ExtensionElement parse(XmlPullParser parser, int initialDepth)
|
public ExtensionElement parse(XmlPullParser parser, int initialDepth)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws Exception {
|
||||||
ExtensionElement pepItem = null;
|
ExtensionElement pepItem = null;
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
while (!done) {
|
while (!done) {
|
||||||
|
|
|
@ -16,9 +16,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.pubsub.provider;
|
package org.jivesoftware.smackx.pubsub.provider;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
import org.jivesoftware.smack.provider.ProviderManager;
|
import org.jivesoftware.smack.provider.ProviderManager;
|
||||||
|
@ -28,7 +25,6 @@ import org.jivesoftware.smackx.pubsub.PayloadItem;
|
||||||
import org.jivesoftware.smackx.pubsub.SimplePayload;
|
import org.jivesoftware.smackx.pubsub.SimplePayload;
|
||||||
import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses an <b>item</b> element as is defined in both the {@link PubSubNamespace#BASIC} and
|
* Parses an <b>item</b> element as is defined in both the {@link PubSubNamespace#BASIC} and
|
||||||
|
@ -42,7 +38,7 @@ public class ItemProvider extends ExtensionElementProvider<Item>
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Item parse(XmlPullParser parser, int initialDepth)
|
public Item parse(XmlPullParser parser, int initialDepth)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws Exception {
|
||||||
String id = parser.getAttributeValue(null, "id");
|
String id = parser.getAttributeValue(null, "id");
|
||||||
String node = parser.getAttributeValue(null, "node");
|
String node = parser.getAttributeValue(null, "node");
|
||||||
|
|
||||||
|
|
|
@ -16,16 +16,12 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.pubsub.provider;
|
package org.jivesoftware.smackx.pubsub.provider;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.provider.IQProvider;
|
import org.jivesoftware.smack.provider.IQProvider;
|
||||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
import org.jivesoftware.smackx.pubsub.packet.PubSub;
|
import org.jivesoftware.smackx.pubsub.packet.PubSub;
|
||||||
import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the root pubsub packet extensions of the {@link IQ} packet and returns
|
* Parses the root pubsub packet extensions of the {@link IQ} packet and returns
|
||||||
|
@ -37,7 +33,7 @@ public class PubSubProvider extends IQProvider<PubSub>
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public PubSub parse(XmlPullParser parser, int initialDepth)
|
public PubSub parse(XmlPullParser parser, int initialDepth)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws Exception {
|
||||||
String namespace = parser.getNamespace();
|
String namespace = parser.getNamespace();
|
||||||
PubSubNamespace pubSubNamespace = PubSubNamespace.valueOfFromXmlns(namespace);
|
PubSubNamespace pubSubNamespace = PubSubNamespace.valueOfFromXmlns(namespace);
|
||||||
PubSub pubsub = new PubSub(pubSubNamespace);
|
PubSub pubsub = new PubSub(pubSubNamespace);
|
||||||
|
|
|
@ -16,9 +16,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.search;
|
package org.jivesoftware.smackx.search;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
|
@ -32,7 +29,6 @@ import org.jivesoftware.smackx.xdata.FormField;
|
||||||
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
||||||
import org.jxmpp.jid.DomainBareJid;
|
import org.jxmpp.jid.DomainBareJid;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements the protocol currently used to search information repositories on the Jabber network. To date, the jabber:iq:search protocol
|
* Implements the protocol currently used to search information repositories on the Jabber network. To date, the jabber:iq:search protocol
|
||||||
|
@ -127,7 +123,7 @@ public class UserSearch extends SimpleIQ {
|
||||||
|
|
||||||
// FIXME this provider does return two different types of IQs
|
// FIXME this provider does return two different types of IQs
|
||||||
@Override
|
@Override
|
||||||
public IQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException {
|
public IQ parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||||
UserSearch search = null;
|
UserSearch search = null;
|
||||||
SimpleUserSearch simpleUserSearch = new SimpleUserSearch();
|
SimpleUserSearch simpleUserSearch = new SimpleUserSearch();
|
||||||
|
|
||||||
|
@ -163,7 +159,7 @@ public class UserSearch extends SimpleIQ {
|
||||||
|
|
||||||
private static void buildDataForm(SimpleUserSearch search,
|
private static void buildDataForm(SimpleUserSearch search,
|
||||||
String instructions, XmlPullParser parser)
|
String instructions, XmlPullParser parser)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws Exception {
|
||||||
DataForm dataForm = new DataForm(DataForm.Type.form);
|
DataForm dataForm = new DataForm(DataForm.Type.form);
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
dataForm.setTitle("User Search");
|
dataForm.setTitle("User Search");
|
||||||
|
|
|
@ -16,13 +16,11 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.si.provider;
|
package org.jivesoftware.smackx.si.provider;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smack.provider.IQProvider;
|
import org.jivesoftware.smack.provider.IQProvider;
|
||||||
import org.jxmpp.util.XmppDateTime;
|
import org.jxmpp.util.XmppDateTime;
|
||||||
import org.jivesoftware.smackx.si.packet.StreamInitiation;
|
import org.jivesoftware.smackx.si.packet.StreamInitiation;
|
||||||
|
@ -30,7 +28,6 @@ import org.jivesoftware.smackx.si.packet.StreamInitiation.File;
|
||||||
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
||||||
import org.jivesoftware.smackx.xdata.provider.DataFormProvider;
|
import org.jivesoftware.smackx.xdata.provider.DataFormProvider;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The StreamInitiationProvider parses StreamInitiation packets.
|
* The StreamInitiationProvider parses StreamInitiation packets.
|
||||||
|
@ -43,7 +40,7 @@ public class StreamInitiationProvider extends IQProvider<StreamInitiation> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StreamInitiation parse(XmlPullParser parser, int initialDepth)
|
public StreamInitiation parse(XmlPullParser parser, int initialDepth)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws Exception {
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
|
|
||||||
// si
|
// si
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
package org.jivesoftware.smackx.xdata.provider;
|
package org.jivesoftware.smackx.xdata.provider;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
import org.jivesoftware.smack.roster.packet.RosterPacket;
|
import org.jivesoftware.smack.roster.packet.RosterPacket;
|
||||||
import org.jivesoftware.smack.roster.provider.RosterPacketProvider;
|
import org.jivesoftware.smack.roster.provider.RosterPacketProvider;
|
||||||
|
@ -42,8 +41,8 @@ import java.util.List;
|
||||||
public class DataFormProvider extends ExtensionElementProvider<DataForm> {
|
public class DataFormProvider extends ExtensionElementProvider<DataForm> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataForm parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException,
|
public DataForm parse(XmlPullParser parser, int initialDepth) throws
|
||||||
SmackException {
|
Exception {
|
||||||
DataForm.Type dataFormType = DataForm.Type.fromString(parser.getAttributeValue("", "type"));
|
DataForm.Type dataFormType = DataForm.Type.fromString(parser.getAttributeValue("", "type"));
|
||||||
DataForm dataForm = new DataForm(dataFormType);
|
DataForm dataForm = new DataForm(dataFormType);
|
||||||
outerloop: while (true) {
|
outerloop: while (true) {
|
||||||
|
|
|
@ -18,19 +18,15 @@ package org.jivesoftware.smackx.caps.provider;
|
||||||
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smack.test.util.TestUtils;
|
import org.jivesoftware.smack.test.util.TestUtils;
|
||||||
import org.jivesoftware.smackx.InitExtensions;
|
import org.jivesoftware.smackx.InitExtensions;
|
||||||
import org.jivesoftware.smackx.caps.packet.CapsExtension;
|
import org.jivesoftware.smackx.caps.packet.CapsExtension;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
public class CapsExtensionProviderTest extends InitExtensions {
|
public class CapsExtensionProviderTest extends InitExtensions {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void parseTest() throws XmlPullParserException, IOException, SmackException {
|
public void parseTest() throws Exception {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
final String capsExtensionString =
|
final String capsExtensionString =
|
||||||
"<c xmlns='http://jabber.org/protocol/caps'"
|
"<c xmlns='http://jabber.org/protocol/caps'"
|
||||||
|
|
|
@ -19,9 +19,6 @@ package org.jivesoftware.smackx.xdata.packet;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smack.packet.Element;
|
import org.jivesoftware.smack.packet.Element;
|
||||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
import org.jivesoftware.smackx.xdata.FormField;
|
import org.jivesoftware.smackx.xdata.FormField;
|
||||||
|
@ -35,7 +32,6 @@ import org.jivesoftware.smackx.xdatavalidation.packet.ValidateElement;
|
||||||
import org.jivesoftware.smackx.xdatavalidation.packet.ValidateElement.RangeValidateElement;
|
import org.jivesoftware.smackx.xdatavalidation.packet.ValidateElement.RangeValidateElement;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for DataForm reading and parsing.
|
* Unit tests for DataForm reading and parsing.
|
||||||
|
@ -51,7 +47,7 @@ public class DataFormTest {
|
||||||
DataFormProvider pr = new DataFormProvider();
|
DataFormProvider pr = new DataFormProvider();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test() throws XmlPullParserException, IOException, SmackException {
|
public void test() throws Exception {
|
||||||
//Build a Form
|
//Build a Form
|
||||||
DataForm df = new DataForm(DataForm.Type.submit);
|
DataForm df = new DataForm(DataForm.Type.submit);
|
||||||
String instruction = "InstructionTest1";
|
String instruction = "InstructionTest1";
|
||||||
|
@ -78,7 +74,7 @@ public class DataFormTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLayout() throws XmlPullParserException, IOException, SmackException {
|
public void testLayout() throws Exception {
|
||||||
//Build a Form
|
//Build a Form
|
||||||
DataForm df = new DataForm(DataForm.Type.submit);
|
DataForm df = new DataForm(DataForm.Type.submit);
|
||||||
String instruction = "InstructionTest1";
|
String instruction = "InstructionTest1";
|
||||||
|
@ -120,7 +116,7 @@ public class DataFormTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testValidation() throws XmlPullParserException, IOException, SmackException {
|
public void testValidation() throws Exception {
|
||||||
//Build a Form
|
//Build a Form
|
||||||
DataForm df = new DataForm(DataForm.Type.submit);
|
DataForm df = new DataForm(DataForm.Type.submit);
|
||||||
String instruction = "InstructionTest1";
|
String instruction = "InstructionTest1";
|
||||||
|
@ -154,7 +150,7 @@ public class DataFormTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFixedField() throws XmlPullParserException, IOException, SmackException {
|
public void testFixedField() throws Exception {
|
||||||
final String formWithFixedField = "<x xmlns='jabber:x:data' type='submit'><instructions>InstructionTest1</instructions><field type='fixed'></field></x>";
|
final String formWithFixedField = "<x xmlns='jabber:x:data' type='submit'><instructions>InstructionTest1</instructions><field type='fixed'></field></x>";
|
||||||
DataForm df = pr.parse(PacketParserUtils.getParserFor(formWithFixedField));
|
DataForm df = pr.parse(PacketParserUtils.getParserFor(formWithFixedField));
|
||||||
assertEquals(Type.fixed, df.getFields().get(0).getType());
|
assertEquals(Type.fixed, df.getFields().get(0).getType());
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class DataLayoutTest {
|
||||||
private static final String TEST_INPUT_1 = "xdata-layout-sample.xml";
|
private static final String TEST_INPUT_1 = "xdata-layout-sample.xml";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLayout() throws XmlPullParserException, IOException, SmackException {
|
public void testLayout() throws Exception {
|
||||||
DataLayout layout = new DataLayout("Label");
|
DataLayout layout = new DataLayout("Label");
|
||||||
Fieldref reffield = new Fieldref("testField1");
|
Fieldref reffield = new Fieldref("testField1");
|
||||||
layout.getPageLayout().add(reffield);
|
layout.getPageLayout().add(reffield);
|
||||||
|
@ -116,7 +116,7 @@ public class DataLayoutTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLayoutFromFile() throws XmlPullParserException, IOException, SmackException {
|
public void testLayoutFromFile() throws Exception {
|
||||||
DataFormProvider pr = new DataFormProvider();
|
DataFormProvider pr = new DataFormProvider();
|
||||||
|
|
||||||
XmlPullParser parser = PacketParserUtils.newXmppParser();
|
XmlPullParser parser = PacketParserUtils.newXmppParser();
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class JingleProvider extends IQProvider<Jingle> {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Jingle parse(XmlPullParser parser, int intialDepth)
|
public Jingle parse(XmlPullParser parser, int intialDepth)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws Exception {
|
||||||
|
|
||||||
Jingle jingle = new Jingle();
|
Jingle jingle = new Jingle();
|
||||||
String sid = "";
|
String sid = "";
|
||||||
|
|
|
@ -17,14 +17,10 @@
|
||||||
|
|
||||||
package org.jivesoftware.smackx.workgroup.ext.forms;
|
package org.jivesoftware.smackx.workgroup.ext.forms;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smack.packet.SimpleIQ;
|
import org.jivesoftware.smack.packet.SimpleIQ;
|
||||||
import org.jivesoftware.smack.provider.IQProvider;
|
import org.jivesoftware.smack.provider.IQProvider;
|
||||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
public class WorkgroupForm extends SimpleIQ {
|
public class WorkgroupForm extends SimpleIQ {
|
||||||
|
|
||||||
|
@ -51,8 +47,7 @@ public class WorkgroupForm extends SimpleIQ {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WorkgroupForm parse(XmlPullParser parser, int initialDepth)
|
public WorkgroupForm parse(XmlPullParser parser, int initialDepth)
|
||||||
throws XmlPullParserException, IOException,
|
throws Exception {
|
||||||
SmackException {
|
|
||||||
WorkgroupForm answer = new WorkgroupForm();
|
WorkgroupForm answer = new WorkgroupForm();
|
||||||
|
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
|
|
|
@ -23,16 +23,13 @@ import org.jivesoftware.smackx.workgroup.agent.OfferContent;
|
||||||
import org.jivesoftware.smackx.workgroup.agent.TransferRequest;
|
import org.jivesoftware.smackx.workgroup.agent.TransferRequest;
|
||||||
import org.jivesoftware.smackx.workgroup.agent.UserRequest;
|
import org.jivesoftware.smackx.workgroup.agent.UserRequest;
|
||||||
import org.jivesoftware.smackx.workgroup.util.MetaDataUtils;
|
import org.jivesoftware.smackx.workgroup.util.MetaDataUtils;
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.provider.IQProvider;
|
import org.jivesoftware.smack.provider.IQProvider;
|
||||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
import org.jivesoftware.smack.util.ParserUtils;
|
import org.jivesoftware.smack.util.ParserUtils;
|
||||||
import org.jxmpp.jid.Jid;
|
import org.jxmpp.jid.Jid;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -49,7 +46,7 @@ public class OfferRequestProvider extends IQProvider<IQ> {
|
||||||
// happen anytime soon.
|
// happen anytime soon.
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OfferRequestPacket parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException {
|
public OfferRequestPacket parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||||
int eventType = parser.getEventType();
|
int eventType = parser.getEventType();
|
||||||
String sessionID = null;
|
String sessionID = null;
|
||||||
int timeout = -1;
|
int timeout = -1;
|
||||||
|
|
|
@ -17,14 +17,11 @@
|
||||||
|
|
||||||
package org.jivesoftware.smackx.workgroup.packet;
|
package org.jivesoftware.smackx.workgroup.packet;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smack.provider.IQProvider;
|
import org.jivesoftware.smack.provider.IQProvider;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -36,7 +33,7 @@ import java.util.List;
|
||||||
public class TranscriptProvider extends IQProvider<Transcript> {
|
public class TranscriptProvider extends IQProvider<Transcript> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Transcript parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException {
|
public Transcript parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||||
String sessionID = parser.getAttributeValue("", "sessionID");
|
String sessionID = parser.getAttributeValue("", "sessionID");
|
||||||
List<Stanza> packets = new ArrayList<Stanza>();
|
List<Stanza> packets = new ArrayList<Stanza>();
|
||||||
|
|
||||||
|
|
|
@ -17,14 +17,10 @@
|
||||||
|
|
||||||
package org.jivesoftware.smackx.workgroup.packet;
|
package org.jivesoftware.smackx.workgroup.packet;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smack.packet.SimpleIQ;
|
import org.jivesoftware.smack.packet.SimpleIQ;
|
||||||
import org.jivesoftware.smack.provider.IQProvider;
|
import org.jivesoftware.smack.provider.IQProvider;
|
||||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IQ packet for retrieving the transcript search form, submiting the completed search form
|
* IQ packet for retrieving the transcript search form, submiting the completed search form
|
||||||
|
@ -56,7 +52,7 @@ public class TranscriptSearch extends SimpleIQ {
|
||||||
public static class Provider extends IQProvider<TranscriptSearch> {
|
public static class Provider extends IQProvider<TranscriptSearch> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TranscriptSearch parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException {
|
public TranscriptSearch parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||||
TranscriptSearch answer = new TranscriptSearch();
|
TranscriptSearch answer = new TranscriptSearch();
|
||||||
|
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
|
|
Loading…
Reference in a new issue