1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-12-18 08:51:08 +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:
Florian Schmaus 2015-03-13 09:27:18 +01:00
parent 4d9bd6f216
commit bc093b620d
29 changed files with 63 additions and 156 deletions

View file

@ -16,9 +16,6 @@
*/
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.provider.ExtensionElementProvider;
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.packet.PubSubNamespace;
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
@ -42,7 +38,7 @@ public class ItemProvider extends ExtensionElementProvider<Item>
{
@Override
public Item parse(XmlPullParser parser, int initialDepth)
throws XmlPullParserException, IOException, SmackException {
throws Exception {
String id = parser.getAttributeValue(null, "id");
String node = parser.getAttributeValue(null, "node");

View file

@ -16,16 +16,12 @@
*/
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.provider.IQProvider;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smackx.pubsub.packet.PubSub;
import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
/**
* Parses the root pubsub packet extensions of the {@link IQ} packet and returns
@ -37,7 +33,7 @@ public class PubSubProvider extends IQProvider<PubSub>
{
@Override
public PubSub parse(XmlPullParser parser, int initialDepth)
throws XmlPullParserException, IOException, SmackException {
throws Exception {
String namespace = parser.getNamespace();
PubSubNamespace pubSubNamespace = PubSubNamespace.valueOfFromXmlns(namespace);
PubSub pubsub = new PubSub(pubSubNamespace);