diff --git a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java index 79274bfe5..7b4959b36 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java @@ -33,6 +33,7 @@ import java.security.SecureRandom; import java.security.Security; import java.security.UnrecoverableKeyException; import java.security.cert.CertificateException; +import java.text.ParseException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -124,6 +125,7 @@ import org.jxmpp.jid.parts.Resourcepart; import org.jxmpp.util.XmppStringUtils; import org.minidns.dnsname.DnsName; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** @@ -1161,7 +1163,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { return successNonza; } - protected final void parseAndProcessNonza(XmlPullParser parser) throws SmackException { + protected final void parseAndProcessNonza(XmlPullParser parser) throws IOException, XmlPullParserException, ParseException { final String element = parser.getName(); final String namespace = parser.getNamespace(); final String key = XmppStringUtils.generateKey(element, namespace); @@ -1181,18 +1183,13 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { return; } - Nonza nonza; - try { - nonza = nonzaProvider.parse(parser); - } - catch (Exception e) { - throw new SmackException(e); - } + Nonza nonza = nonzaProvider.parse(parser); nonzaCallback.onNonzaReceived(nonza); } - protected void parseAndProcessStanza(XmlPullParser parser) throws Exception { + protected void parseAndProcessStanza(XmlPullParser parser) + throws XmlPullParserException, IOException, InterruptedException { ParserUtils.assertAtStartTag(parser); int parserDepth = parser.getDepth(); Stanza stanza = null; @@ -1566,7 +1563,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { return this.fromMode; } - protected final void parseFeatures(XmlPullParser parser) throws Exception { + protected final void parseFeatures(XmlPullParser parser) throws XmlPullParserException, IOException, ParseException { streamFeatures.clear(); final int initialDepth = parser.getDepth(); while (true) { diff --git a/smack-core/src/main/java/org/jivesoftware/smack/compress/provider/FailureProvider.java b/smack-core/src/main/java/org/jivesoftware/smack/compress/provider/FailureProvider.java index ca2916ea0..19bbc0877 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/compress/provider/FailureProvider.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/compress/provider/FailureProvider.java @@ -16,6 +16,8 @@ */ package org.jivesoftware.smack.compress.provider; +import java.io.IOException; +import java.text.ParseException; import java.util.logging.Logger; import org.jivesoftware.smack.compress.packet.Failure; @@ -25,6 +27,7 @@ import org.jivesoftware.smack.provider.NonzaProvider; import org.jivesoftware.smack.util.PacketParserUtils; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; public final class FailureProvider extends NonzaProvider { @@ -36,7 +39,7 @@ public final class FailureProvider extends NonzaProvider { } @Override - public Failure parse(XmlPullParser parser, int initialDepth) throws Exception { + public Failure parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { Failure.CompressFailureError compressFailureError = null; StanzaError stanzaError = null; diff --git a/smack-core/src/main/java/org/jivesoftware/smack/fsm/AbstractXmppStateMachineConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/fsm/AbstractXmppStateMachineConnection.java index 9bf3f0033..2896f6f82 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/fsm/AbstractXmppStateMachineConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/fsm/AbstractXmppStateMachineConnection.java @@ -17,6 +17,7 @@ package org.jivesoftware.smack.fsm; import java.io.IOException; +import java.text.ParseException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -59,6 +60,7 @@ import org.jivesoftware.smack.util.PacketParserUtils; import org.jxmpp.jid.parts.Resourcepart; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; public abstract class AbstractXmppStateMachineConnection extends AbstractXMPPConnection { @@ -301,7 +303,8 @@ public abstract class AbstractXmppStateMachineConnection extends AbstractXMPPCon } } - protected final void parseAndProcessElement(String element) throws Exception { + protected final void parseAndProcessElement(String element) throws XmlPullParserException, IOException, + InterruptedException, StreamErrorException, SmackException, ParseException { XmlPullParser parser = PacketParserUtils.getParserFor(element); // Skip the enclosing stream open what is guaranteed to be there. diff --git a/smack-core/src/main/java/org/jivesoftware/smack/parsing/ExceptionLoggingCallback.java b/smack-core/src/main/java/org/jivesoftware/smack/parsing/ExceptionLoggingCallback.java index f42254f36..083b2b550 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/parsing/ExceptionLoggingCallback.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/parsing/ExceptionLoggingCallback.java @@ -1,6 +1,6 @@ /** * - * Copyright 2013-2015 Florian Schmaus. + * Copyright 2013-2019 Florian Schmaus. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ public class ExceptionLoggingCallback implements ParsingExceptionCallback { private static final Logger LOGGER = Logger.getLogger(ExceptionLoggingCallback.class.getName()); @Override - public void handleUnparsableStanza(UnparseableStanza unparsed) throws Exception { + public void handleUnparsableStanza(UnparseableStanza unparsed) { LOGGER.log(Level.SEVERE, "Smack message parsing exception. Content: '" + unparsed.getContent() + "'", unparsed.getParsingException()); } } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/parsing/ExceptionThrowingCallback.java b/smack-core/src/main/java/org/jivesoftware/smack/parsing/ExceptionThrowingCallback.java index df11552c9..a5611d953 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/parsing/ExceptionThrowingCallback.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/parsing/ExceptionThrowingCallback.java @@ -1,6 +1,6 @@ /** * - * Copyright 2013-2015 Florian Schmaus. + * Copyright 2013-2019 Florian Schmaus. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,8 @@ package org.jivesoftware.smack.parsing; +import java.io.IOException; + import org.jivesoftware.smack.ConnectionListener; import org.jivesoftware.smack.UnparseableStanza; @@ -30,7 +32,7 @@ import org.jivesoftware.smack.UnparseableStanza; public class ExceptionThrowingCallback implements ParsingExceptionCallback { @Override - public void handleUnparsableStanza(UnparseableStanza packetData) throws Exception { - throw packetData.getParsingException(); + public void handleUnparsableStanza(UnparseableStanza packetData) throws IOException { + throw new IOException(packetData.getParsingException()); } } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/parsing/ExceptionThrowingCallbackWithHint.java b/smack-core/src/main/java/org/jivesoftware/smack/parsing/ExceptionThrowingCallbackWithHint.java index 299b21242..f7e91355d 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/parsing/ExceptionThrowingCallbackWithHint.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/parsing/ExceptionThrowingCallbackWithHint.java @@ -1,6 +1,6 @@ /** * - * Copyright 2018 Florian Schmaus. + * Copyright 2018-2019 Florian Schmaus. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package org.jivesoftware.smack.parsing; +import java.io.IOException; import java.util.logging.Logger; import org.jivesoftware.smack.UnparseableStanza; @@ -32,7 +33,7 @@ public class ExceptionThrowingCallbackWithHint extends ExceptionThrowingCallback private static final Logger LOGGER = Logger.getLogger(ExceptionThrowingCallbackWithHint.class.getName()); @Override - public void handleUnparsableStanza(UnparseableStanza packetData) throws Exception { + public void handleUnparsableStanza(UnparseableStanza packetData) throws IOException { LOGGER.warning("Parsing exception encountered." + " This exception will be re-thrown, leading to a disconnect." + " You can change this behavior by setting a different ParsingExceptionCallback using setParsingExceptionCallback()." diff --git a/smack-core/src/main/java/org/jivesoftware/smack/parsing/ParsingExceptionCallback.java b/smack-core/src/main/java/org/jivesoftware/smack/parsing/ParsingExceptionCallback.java index 0e8339ca1..f847a8c6c 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/parsing/ParsingExceptionCallback.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/parsing/ParsingExceptionCallback.java @@ -1,6 +1,6 @@ /** * - * Copyright 2013-2015 Florian Schmaus. + * Copyright 2013-2019 Florian Schmaus. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ */ package org.jivesoftware.smack.parsing; +import java.io.IOException; + import org.jivesoftware.smack.UnparseableStanza; /** @@ -37,8 +39,8 @@ public interface ParsingExceptionCallback { * Called when parsing a stanza caused an exception. * * @param stanzaData the raw stanza data that caused the exception - * @throws Exception + * @throws IOException */ - void handleUnparsableStanza(UnparseableStanza stanzaData) throws Exception; + void handleUnparsableStanza(UnparseableStanza stanzaData) throws IOException; } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/BindIQProvider.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/BindIQProvider.java index 1f5b11d1d..5ca6b0793 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/provider/BindIQProvider.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/BindIQProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright © 2003-2007 Jive Software, 2014 Florian Schmaus + * Copyright © 2003-2007 Jive Software, 2014-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ package org.jivesoftware.smack.provider; import java.io.IOException; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.packet.Bind; import org.jxmpp.jid.EntityFullJid; @@ -30,8 +29,7 @@ import org.xmlpull.v1.XmlPullParserException; public class BindIQProvider extends IQProvider { @Override - public Bind parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, - SmackException { + public Bind parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { String name; Bind bind = null; outerloop: while (true) { diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/BodyElementProvider.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/BodyElementProvider.java index 5ace1e8f5..8f08eb9d7 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/provider/BodyElementProvider.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/BodyElementProvider.java @@ -18,15 +18,18 @@ package org.jivesoftware.smack.provider; import static org.jivesoftware.smack.util.PacketParserUtils.parseElementText; +import java.io.IOException; + import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.util.ParserUtils; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; public class BodyElementProvider extends ExtensionElementProvider { @Override - public Message.Body parse(XmlPullParser parser, int initialDepth) throws Exception { + public Message.Body parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { String xmlLang = ParserUtils.getXmlLang(parser); String body = parseElementText(parser); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/EmbeddedExtensionProvider.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/EmbeddedExtensionProvider.java index a216c0f93..16631219e 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/provider/EmbeddedExtensionProvider.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/EmbeddedExtensionProvider.java @@ -16,6 +16,8 @@ */ package org.jivesoftware.smack.provider; +import java.io.IOException; +import java.text.ParseException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -25,6 +27,7 @@ import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.PacketParserUtils; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * @@ -82,7 +85,7 @@ import org.xmlpull.v1.XmlPullParser; public abstract class EmbeddedExtensionProvider extends ExtensionElementProvider { @Override - public final PE parse(XmlPullParser parser, int initialDepth) throws Exception { + public final PE parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { final String namespace = parser.getNamespace(); final String name = parser.getName(); final int attributeCount = parser.getAttributeCount(); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/IntrospectionProvider.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/IntrospectionProvider.java index 35dde99b4..93ce13d1a 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/provider/IntrospectionProvider.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/IntrospectionProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright © 2014-2018 Florian Schmaus + * Copyright © 2014-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ package org.jivesoftware.smack.provider; import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.util.ParserUtils; @@ -40,14 +39,14 @@ public class IntrospectionProvider{ @SuppressWarnings("unchecked") @Override - public I parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, - SmackException { + public I parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { try { return (I) parseWithIntrospection(elementClass, parser, initialDepth); } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | ClassNotFoundException e) { - throw new SmackException(e); + // TODO: Should probably be SmackParsingException (once it exists). + throw new IOException(e); } } } @@ -61,14 +60,14 @@ public class IntrospectionProvider{ @SuppressWarnings("unchecked") @Override - public PE parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, - SmackException { + public PE parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { try { return (PE) parseWithIntrospection(elementClass, parser, initialDepth); } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | ClassNotFoundException e) { - throw new SmackException(e); + // TODO: Should probably be SmackParsingException (once it exists). + throw new IOException(e); } } } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/Provider.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/Provider.java index 35983cb86..7c8231447 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/provider/Provider.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/Provider.java @@ -17,13 +17,16 @@ package org.jivesoftware.smack.provider; +import java.io.IOException; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; +import java.text.ParseException; import org.jivesoftware.smack.packet.Element; import org.jivesoftware.smack.util.ParserUtils; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * Smack provider are the parsers used to deserialize raw XMPP into the according Java {@link Element}s. @@ -58,7 +61,7 @@ public abstract class Provider { return elementClass; } - public final E parse(XmlPullParser parser) throws Exception { + public final E parse(XmlPullParser parser) throws IOException, XmlPullParserException, ParseException { // XPP3 calling convention assert: Parser should be at start tag ParserUtils.assertAtStartTag(parser); @@ -70,5 +73,5 @@ public abstract class Provider { return e; } - public abstract E parse(XmlPullParser parser, int initialDepth) throws Exception; + public abstract E parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException; } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/TlsFailureProvider.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/TlsFailureProvider.java index c568ccc88..48f7597d0 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/provider/TlsFailureProvider.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/TlsFailureProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2018 Florian Schmaus + * Copyright 2018-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ public final class TlsFailureProvider extends NonzaProvider { } @Override - public TlsProceed parse(XmlPullParser parser, int initialDepth) throws Exception { + public TlsProceed parse(XmlPullParser parser, int initialDepth) { return TlsProceed.INSTANCE; } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/TlsProceedProvider.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/TlsProceedProvider.java index 917487bdf..2b7495aaf 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/provider/TlsProceedProvider.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/TlsProceedProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2018 Florian Schmaus + * Copyright 2018-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ public final class TlsProceedProvider extends NonzaProvider { } @Override - public TlsFailure parse(XmlPullParser parser, int initialDepth) throws Exception { + public TlsFailure parse(XmlPullParser parser, int initialDepth) { return TlsFailure.INSTANCE; } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java b/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java index d1326a950..3580e1983 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java @@ -19,6 +19,7 @@ package org.jivesoftware.smack.util; import java.io.IOException; import java.io.Reader; import java.io.StringReader; +import java.text.ParseException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -215,10 +216,11 @@ public class PacketParserUtils { * * @param parser the XML parser, positioned at the start of a message packet. * @return a Message packet. - * @throws Exception + * @throws XmlPullParserException + * @throws IOException + * @throws ParseException */ - public static Message parseMessage(XmlPullParser parser) - throws Exception { + public static Message parseMessage(XmlPullParser parser) throws XmlPullParserException, IOException, ParseException { ParserUtils.assertAtStartTag(parser); assert (parser.getName().equals(Message.ELEMENT)); @@ -500,10 +502,11 @@ public class PacketParserUtils { * * @param parser the XML parser, positioned at the start of a presence packet. * @return a Presence packet. - * @throws Exception + * @throws IOException + * @throws XmlPullParserException + * @throws ParseException */ - public static Presence parsePresence(XmlPullParser parser) - throws Exception { + public static Presence parsePresence(XmlPullParser parser) throws XmlPullParserException, IOException, ParseException { ParserUtils.assertAtStartTag(parser); final int initialDepth = parser.getDepth(); @@ -786,9 +789,11 @@ public class PacketParserUtils { * * @param parser the XML parser. * @return an stream error packet. - * @throws Exception if an exception occurs while parsing the packet. + * @throws IOException + * @throws XmlPullParserException + * @throws ParseException */ - public static StreamError parseStreamError(XmlPullParser parser) throws Exception { + public static StreamError parseStreamError(XmlPullParser parser) throws XmlPullParserException, IOException, ParseException { final int initialDepth = parser.getDepth(); List extensions = new ArrayList<>(); Map descriptiveTexts = null; @@ -836,10 +841,11 @@ public class PacketParserUtils { * * @param parser the XML parser. * @return an error sub-packet. - * @throws Exception + * @throws IOException + * @throws XmlPullParserException + * @throws ParseException */ - public static StanzaError.Builder parseError(XmlPullParser parser) - throws Exception { + public static StanzaError.Builder parseError(XmlPullParser parser) throws XmlPullParserException, IOException, ParseException { final int initialDepth = parser.getDepth(); Map descriptiveTexts = null; List extensions = new ArrayList<>(); @@ -908,10 +914,12 @@ public class PacketParserUtils { * @param parser the XML parser, positioned at the starting element of the extension. * * @return an extension element. - * @throws Exception when an error occurs during parsing. + * @throws XmlPullParserException + * @throws IOException + * @throws ParseException */ public static ExtensionElement parseExtensionElement(String elementName, String namespace, - XmlPullParser parser) throws Exception { + XmlPullParser parser) throws XmlPullParserException, IOException, ParseException { ParserUtils.assertAtStartTag(parser); // See if a provider is registered to handle the extension. ExtensionElementProvider provider = ProviderManager.getExtensionProvider(elementName, namespace); @@ -980,25 +988,24 @@ public class PacketParserUtils { } public static void addExtensionElement(Stanza packet, XmlPullParser parser) - throws Exception { + throws XmlPullParserException, IOException, ParseException { ParserUtils.assertAtStartTag(parser); addExtensionElement(packet, parser, parser.getName(), parser.getNamespace()); } public static void addExtensionElement(Stanza packet, XmlPullParser parser, String elementName, - String namespace) throws Exception { + String namespace) throws XmlPullParserException, IOException, ParseException { ExtensionElement packetExtension = parseExtensionElement(elementName, namespace, parser); packet.addExtension(packetExtension); } - public static void addExtensionElement(Collection collection, - XmlPullParser parser) throws Exception { + public static void addExtensionElement(Collection collection, XmlPullParser parser) + throws XmlPullParserException, IOException, ParseException { addExtensionElement(collection, parser, parser.getName(), parser.getNamespace()); } - public static void addExtensionElement(Collection collection, - XmlPullParser parser, String elementName, String namespace) - throws Exception { + public static void addExtensionElement(Collection collection, XmlPullParser parser, + String elementName, String namespace) throws XmlPullParserException, IOException, ParseException { ExtensionElement packetExtension = parseExtensionElement(elementName, namespace, parser); collection.add(packetExtension); } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java b/smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java index f6d5bdbbd..6f6bd1d82 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java @@ -26,8 +26,6 @@ import java.util.Locale; import javax.xml.XMLConstants; import javax.xml.namespace.QName; -import org.jivesoftware.smack.SmackException; - import org.jxmpp.jid.EntityBareJid; import org.jxmpp.jid.EntityFullJid; import org.jxmpp.jid.EntityJid; @@ -176,10 +174,12 @@ public class ParserUtils { } } - public static int getIntegerAttributeOrThrow(XmlPullParser parser, String name, String throwMessage) throws SmackException { + public static int getIntegerAttributeOrThrow(XmlPullParser parser, String name, String throwMessage) + throws IOException { Integer res = getIntegerAttribute(parser, name); if (res == null) { - throw new SmackException(throwMessage); + // TODO Should be SmackParseException. + throw new IOException(throwMessage); } return res; } @@ -266,9 +266,15 @@ public class ParserUtils { return XmppDateTime.parseDate(dateString); } - public static URI getUriFromNextText(XmlPullParser parser) throws XmlPullParserException, IOException, URISyntaxException { + public static URI getUriFromNextText(XmlPullParser parser) throws XmlPullParserException, IOException { String uriString = parser.nextText(); - return new URI(uriString); + try { + return new URI(uriString); + } + catch (URISyntaxException e) { + // TODO: Should be SmackParseException (or subclass of). + throw new IOException(e); + } } public static String getRequiredAttribute(XmlPullParser parser, String name) throws IOException { diff --git a/smack-core/src/test/java/org/jivesoftware/smack/parsing/ParsingExceptionTest.java b/smack-core/src/test/java/org/jivesoftware/smack/parsing/ParsingExceptionTest.java index e3bd1e973..360433a46 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/parsing/ParsingExceptionTest.java +++ b/smack-core/src/test/java/org/jivesoftware/smack/parsing/ParsingExceptionTest.java @@ -19,7 +19,8 @@ package org.jivesoftware.smack.parsing; import static org.jivesoftware.smack.test.util.CharSequenceEquals.equalsCharSequence; import static org.junit.Assert.assertThat; -import org.jivesoftware.smack.SmackException; +import java.io.IOException; + import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ProviderManager; @@ -78,8 +79,8 @@ public class ParsingExceptionTest { public static final String NAMESPACE = "http://smack.jivesoftware.org/exception"; @Override - public ExtensionElement parse(XmlPullParser parser, int initialDepth) throws SmackException { - throw new SmackException("Test Exception"); + public ExtensionElement parse(XmlPullParser parser, int initialDepth) throws IOException { + throw new IOException("Test Exception"); } } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/provider/CarbonManagerProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/provider/CarbonManagerProvider.java index 60e5e1e0e..3cd6faa32 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/provider/CarbonManagerProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/provider/CarbonManagerProvider.java @@ -16,7 +16,9 @@ */ package org.jivesoftware.smackx.carbons.provider; -import org.jivesoftware.smack.SmackException; +import java.io.IOException; +import java.text.ParseException; + import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.carbons.packet.CarbonExtension; @@ -25,6 +27,7 @@ import org.jivesoftware.smackx.forward.packet.Forwarded; import org.jivesoftware.smackx.forward.provider.ForwardedProvider; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * This class implements the {@link ExtensionElementProvider} to parse @@ -38,8 +41,7 @@ public class CarbonManagerProvider extends ExtensionElementProvider tag"); + if (fwd == null) { + // TODO: Should be SmackParseException. + throw new IOException("sent/received must contain exactly one tag"); + } return new CarbonExtension(dir, fwd); } } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/provider/AcknowledgedProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/provider/AcknowledgedProvider.java index db5e6505f..45c44d7df 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/provider/AcknowledgedProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/provider/AcknowledgedProvider.java @@ -33,7 +33,7 @@ import org.xmlpull.v1.XmlPullParser; public class AcknowledgedProvider extends ExtensionElementProvider { @Override - public AcknowledgedExtension parse(XmlPullParser parser, int initialDepth) throws Exception { + public AcknowledgedExtension parse(XmlPullParser parser, int initialDepth) { String id = parser.getAttributeValue("", "id"); return new AcknowledgedExtension(id); } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/provider/DisplayedProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/provider/DisplayedProvider.java index 804b77124..0b1914fac 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/provider/DisplayedProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/provider/DisplayedProvider.java @@ -33,7 +33,7 @@ import org.xmlpull.v1.XmlPullParser; public class DisplayedProvider extends ExtensionElementProvider { @Override - public DisplayedExtension parse(XmlPullParser parser, int initialDepth) throws Exception { + public DisplayedExtension parse(XmlPullParser parser, int initialDepth) { String id = parser.getAttributeValue("", "id"); return new DisplayedExtension(id); } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/provider/MarkableProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/provider/MarkableProvider.java index c243b57da..e8b121e42 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/provider/MarkableProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/provider/MarkableProvider.java @@ -33,7 +33,7 @@ import org.xmlpull.v1.XmlPullParser; public class MarkableProvider extends ExtensionElementProvider { @Override - public MarkableExtension parse(XmlPullParser parser, int initialDepth) throws Exception { + public MarkableExtension parse(XmlPullParser parser, int initialDepth) { return MarkableExtension.INSTANCE; } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/provider/ReceivedProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/provider/ReceivedProvider.java index b0d527093..270b9894e 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/provider/ReceivedProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/provider/ReceivedProvider.java @@ -33,7 +33,7 @@ import org.xmlpull.v1.XmlPullParser; public class ReceivedProvider extends ExtensionElementProvider { @Override - public ReceivedExtension parse(XmlPullParser parser, int initialDepth) throws Exception { + public ReceivedExtension parse(XmlPullParser parser, int initialDepth) { String id = parser.getAttributeValue("", "id"); return new ReceivedExtension(id); } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/csi/provider/ClientStateIndicationFeatureProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/csi/provider/ClientStateIndicationFeatureProvider.java index dadd019d5..a3ce4b0cf 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/csi/provider/ClientStateIndicationFeatureProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/csi/provider/ClientStateIndicationFeatureProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright © 2014 Florian Schmaus + * Copyright © 2014-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ package org.jivesoftware.smackx.csi.provider; import java.io.IOException; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.csi.packet.ClientStateIndication; @@ -30,7 +29,7 @@ public class ClientStateIndicationFeatureProvider extends ExtensionElementProvid @Override public ClientStateIndication.Feature parse(XmlPullParser parser, int initialDepth) - throws XmlPullParserException, IOException, SmackException { + throws XmlPullParserException, IOException { return ClientStateIndication.Feature.INSTANCE; } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/eme/provider/ExplicitMessageEncryptionProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/eme/provider/ExplicitMessageEncryptionProvider.java index 279fb144d..597c3e272 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/eme/provider/ExplicitMessageEncryptionProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/eme/provider/ExplicitMessageEncryptionProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2017 Florian Schmaus + * Copyright 2017-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import org.xmlpull.v1.XmlPullParser; public class ExplicitMessageEncryptionProvider extends ExtensionElementProvider { @Override - public ExplicitMessageEncryptionElement parse(XmlPullParser parser, int initialDepth) throws Exception { + public ExplicitMessageEncryptionElement parse(XmlPullParser parser, int initialDepth) { String namespace = parser.getAttributeValue(null, "namespace"); String name = parser.getAttributeValue(null, "name"); return new ExplicitMessageEncryptionElement(namespace, name); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/hashes/provider/HashElementProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/hashes/provider/HashElementProvider.java index 62e5a657a..114937631 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/hashes/provider/HashElementProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/hashes/provider/HashElementProvider.java @@ -16,12 +16,15 @@ */ package org.jivesoftware.smackx.hashes.provider; +import java.io.IOException; + import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.hashes.HashManager; import org.jivesoftware.smackx.hashes.element.HashElement; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * Provider for HashElements. @@ -29,7 +32,7 @@ import org.xmlpull.v1.XmlPullParser; public class HashElementProvider extends ExtensionElementProvider { @Override - public HashElement parse(XmlPullParser parser, int initialDepth) throws Exception { + public HashElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { String algo = parser.getAttributeValue(null, HashElement.ATTR_ALGO); String hashB64 = parser.nextText(); return new HashElement(HashManager.ALGORITHM.valueOfName(algo), hashB64); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/hints/provider/MessageProcessingHintProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/hints/provider/MessageProcessingHintProvider.java index 34f54e844..745638ba6 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/hints/provider/MessageProcessingHintProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/hints/provider/MessageProcessingHintProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2017 Florian Schmaus + * Copyright 2017-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import org.xmlpull.v1.XmlPullParser; public abstract class MessageProcessingHintProvider extends ExtensionElementProvider { @Override - public H parse(XmlPullParser parser, int initialDepth) throws Exception { + public H parse(XmlPullParser parser, int initialDepth) { return getHint(); } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/provider/AbstractHttpOverXmppProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/provider/AbstractHttpOverXmppProvider.java index 496330250..34524fa33 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/provider/AbstractHttpOverXmppProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/provider/AbstractHttpOverXmppProvider.java @@ -17,6 +17,7 @@ package org.jivesoftware.smackx.hoxt.provider; import java.io.IOException; +import java.text.ParseException; import org.jivesoftware.smack.packet.NamedElement; import org.jivesoftware.smack.provider.IQProvider; @@ -55,9 +56,11 @@ public abstract class AbstractHttpOverXmppProvider { @Override - public FileTooLargeError parse(XmlPullParser parser, int initialDepth) throws Exception { + public FileTooLargeError parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { final String namespace = parser.getNamespace(); Long maxFileSize = null; diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/provider/SlotProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/provider/SlotProvider.java index 5d3b069e1..82f798e3d 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/provider/SlotProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/provider/SlotProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright © 2017 Grigory Fedorov, Florian Schmaus + * Copyright © 2017 Grigory Fedorov, 2017-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import java.net.URL; import java.util.HashMap; import java.util.Map; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.util.ParserUtils; @@ -42,7 +41,7 @@ import org.xmlpull.v1.XmlPullParserException; public class SlotProvider extends IQProvider { @Override - public Slot parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException { + public Slot parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { final String namespace = parser.getNamespace(); final UploadService.Version version = HttpFileUploadManager.namespaceToVersion(namespace); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/provider/IoTSetRequestProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/provider/IoTSetRequestProvider.java index 4f6c62b17..8a3f80834 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/provider/IoTSetRequestProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/provider/IoTSetRequestProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright © 2016 Florian Schmaus + * Copyright © 2016-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ */ package org.jivesoftware.smackx.iot.control.provider; +import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -29,11 +30,12 @@ import org.jivesoftware.smackx.iot.control.element.SetIntData; import org.jivesoftware.smackx.iot.control.element.SetLongData; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; public class IoTSetRequestProvider extends IQProvider { @Override - public IoTSetRequest parse(XmlPullParser parser, int initialDepth) throws Exception { + public IoTSetRequest parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { List data = new ArrayList<>(4); outerloop: while (true) { final int eventType = parser.next(); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/provider/IoTSetResponseProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/provider/IoTSetResponseProvider.java index e484d8461..a355ef854 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/provider/IoTSetResponseProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/provider/IoTSetResponseProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright © 2016 Florian Schmaus + * Copyright © 2016-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import org.xmlpull.v1.XmlPullParser; public class IoTSetResponseProvider extends IQProvider { @Override - public IoTSetResponse parse(XmlPullParser parser, int initialDepth) throws Exception { + public IoTSetResponse parse(XmlPullParser parser, int initialDepth) { return new IoTSetResponse(); } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/provider/IoTDataReadOutAcceptedProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/provider/IoTDataReadOutAcceptedProvider.java index 398b1ac36..be2448e61 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/provider/IoTDataReadOutAcceptedProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/provider/IoTDataReadOutAcceptedProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright © 2016 Florian Schmaus + * Copyright © 2016-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ */ package org.jivesoftware.smackx.iot.data.provider; +import java.io.IOException; + import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.util.ParserUtils; @@ -26,7 +28,7 @@ import org.xmlpull.v1.XmlPullParser; public class IoTDataReadOutAcceptedProvider extends IQProvider { @Override - public IoTDataReadOutAccepted parse(XmlPullParser parser, int initialDepth) throws Exception { + public IoTDataReadOutAccepted parse(XmlPullParser parser, int initialDepth) throws IOException { int seqNr = ParserUtils.getIntegerAttributeOrThrow(parser, "seqnr", "IoT data request without sequence number"); boolean queued = ParserUtils.getBooleanAttribute(parser, "queued", false); return new IoTDataReadOutAccepted(seqNr, queued); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/provider/IoTDataRequestProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/provider/IoTDataRequestProvider.java index b06ca9495..f7b58f4ad 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/provider/IoTDataRequestProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/provider/IoTDataRequestProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright © 2016 Florian Schmaus + * Copyright © 2016-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ */ package org.jivesoftware.smackx.iot.data.provider; +import java.io.IOException; + import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.util.ParserUtils; @@ -26,7 +28,7 @@ import org.xmlpull.v1.XmlPullParser; public class IoTDataRequestProvider extends IQProvider { @Override - public IoTDataRequest parse(XmlPullParser parser, int initialDepth) throws Exception { + public IoTDataRequest parse(XmlPullParser parser, int initialDepth) throws IOException { int seqNr = ParserUtils.getIntegerAttributeOrThrow(parser, "seqnr", "IoT data request without sequence number"); boolean momentary = ParserUtils.getBooleanAttribute(parser, "momentary", false); return new IoTDataRequest(seqNr, momentary); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/provider/IoTFieldsExtensionProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/provider/IoTFieldsExtensionProvider.java index 03b6e870d..c494ed871 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/provider/IoTFieldsExtensionProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/provider/IoTFieldsExtensionProvider.java @@ -42,7 +42,7 @@ public class IoTFieldsExtensionProvider extends ExtensionElementProvider without sequence number"); boolean done = ParserUtils.getBooleanAttribute(parser, "done", false); List nodes = new ArrayList<>(); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTClaimedProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTClaimedProvider.java index 8a8b0c0ee..075b88257 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTClaimedProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTClaimedProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2016 Florian Schmaus + * Copyright 2016-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,12 +24,13 @@ import org.jivesoftware.smackx.iot.element.NodeInfo; import org.jivesoftware.smackx.iot.parser.NodeInfoParser; import org.jxmpp.jid.Jid; +import org.jxmpp.stringprep.XmppStringprepException; import org.xmlpull.v1.XmlPullParser; public class IoTClaimedProvider extends IQProvider { @Override - public IoTClaimed parse(XmlPullParser parser, int initialDepth) throws Exception { + public IoTClaimed parse(XmlPullParser parser, int initialDepth) throws XmppStringprepException { Jid jid = ParserUtils.getJidAttribute(parser); NodeInfo nodeInfo = NodeInfoParser.parse(parser); return new IoTClaimed(jid, nodeInfo); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTDisownProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTDisownProvider.java index b9be81252..aa114a1c7 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTDisownProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTDisownProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2016 Florian Schmaus + * Copyright 2016-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,12 +24,13 @@ import org.jivesoftware.smackx.iot.element.NodeInfo; import org.jivesoftware.smackx.iot.parser.NodeInfoParser; import org.jxmpp.jid.Jid; +import org.jxmpp.stringprep.XmppStringprepException; import org.xmlpull.v1.XmlPullParser; public class IoTDisownProvider extends IQProvider { @Override - public IoTDisown parse(XmlPullParser parser, int initialDepth) throws Exception { + public IoTDisown parse(XmlPullParser parser, int initialDepth) throws XmppStringprepException { Jid jid = ParserUtils.getJidAttribute(parser); NodeInfo nodeInfo = NodeInfoParser.parse(parser); return new IoTDisown(jid, nodeInfo); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTDisownedProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTDisownedProvider.java index 51245ab3e..71465a998 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTDisownedProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTDisownedProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2016 Florian Schmaus + * Copyright 2016-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ import org.xmlpull.v1.XmlPullParser; public class IoTDisownedProvider extends IQProvider { @Override - public IoTDisowned parse(XmlPullParser parser, int initialDepth) throws Exception { + public IoTDisowned parse(XmlPullParser parser, int initialDepth) { NodeInfo nodeInfo = NodeInfoParser.parse(parser); return new IoTDisowned(nodeInfo); } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTRegisterProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTRegisterProvider.java index 9b1b5d068..e1fa7ab86 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTRegisterProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTRegisterProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2016 Florian Schmaus + * Copyright 2016-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ */ package org.jivesoftware.smackx.iot.discovery.provider; +import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -28,11 +29,12 @@ import org.jivesoftware.smackx.iot.element.NodeInfo; import org.jivesoftware.smackx.iot.parser.NodeInfoParser; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; public class IoTRegisterProvider extends IQProvider { @Override - public IoTRegister parse(XmlPullParser parser, int initialDepth) throws Exception { + public IoTRegister parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { boolean selfOwned = ParserUtils.getBooleanAttribute(parser, "selfOwned", false); NodeInfo nodeInfo = NodeInfoParser.parse(parser); List tags = new ArrayList<>(); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTRemoveProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTRemoveProvider.java index 754cb18a1..decf7f5be 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTRemoveProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTRemoveProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2016 Florian Schmaus + * Copyright 2016-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,8 @@ */ package org.jivesoftware.smackx.iot.discovery.provider; -import org.jivesoftware.smack.SmackException; +import java.io.IOException; + import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.util.ParserUtils; @@ -31,10 +32,11 @@ import org.xmlpull.v1.XmlPullParser; public class IoTRemoveProvider extends IQProvider { @Override - public IoTRemove parse(XmlPullParser parser, int initialDepth) throws Exception { + public IoTRemove parse(XmlPullParser parser, int initialDepth) throws IOException { Jid jid = ParserUtils.getJidAttribute(parser); if (jid.hasResource()) { - throw new SmackException("JID must be without resourcepart"); + // TODO: Should be SmackParseException. + throw new IOException("JID must be without resourcepart"); } BareJid bareJid = jid.asBareJid(); NodeInfo nodeInfo = NodeInfoParser.parse(parser); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTRemovedProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTRemovedProvider.java index a181cefec..6fd5e0d98 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTRemovedProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTRemovedProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2016 Florian Schmaus + * Copyright 2016-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ import org.xmlpull.v1.XmlPullParser; public class IoTRemovedProvider extends IQProvider { @Override - public IoTRemoved parse(XmlPullParser parser, int initialDepth) throws Exception { + public IoTRemoved parse(XmlPullParser parser, int initialDepth) { NodeInfo nodeInfo = NodeInfoParser.parse(parser); return new IoTRemoved(nodeInfo); } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTUnregisterProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTUnregisterProvider.java index ecd636a23..02e53120b 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTUnregisterProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/provider/IoTUnregisterProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2016 Florian Schmaus + * Copyright 2016-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ import org.xmlpull.v1.XmlPullParser; public class IoTUnregisterProvider extends IQProvider { @Override - public IoTUnregister parse(XmlPullParser parser, int initialDepth) throws Exception { + public IoTUnregister parse(XmlPullParser parser, int initialDepth) { NodeInfo nodeInfo = NodeInfoParser.parse(parser); return new IoTUnregister(nodeInfo); } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/provider/ClearCacheProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/provider/ClearCacheProvider.java index b39a7e273..7bb0d7082 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/provider/ClearCacheProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/provider/ClearCacheProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2016 Florian Schmaus + * Copyright 2016-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import org.xmlpull.v1.XmlPullParser; public class ClearCacheProvider extends IQProvider { @Override - public ClearCache parse(XmlPullParser parser, int initialDepth) throws Exception { + public ClearCache parse(XmlPullParser parser, int initialDepth) { return new ClearCache(); } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/provider/ClearCacheResponseProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/provider/ClearCacheResponseProvider.java index b1aa58192..48cf6a65f 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/provider/ClearCacheResponseProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/provider/ClearCacheResponseProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2016 Florian Schmaus + * Copyright 2016-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import org.xmlpull.v1.XmlPullParser; public class ClearCacheResponseProvider extends IQProvider { @Override - public ClearCacheResponse parse(XmlPullParser parser, int initialDepth) throws Exception { + public ClearCacheResponse parse(XmlPullParser parser, int initialDepth) { return new ClearCacheResponse(); } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/provider/IoTIsFriendProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/provider/IoTIsFriendProvider.java index db4b254cb..ad7f116de 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/provider/IoTIsFriendProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/provider/IoTIsFriendProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2016 Florian Schmaus + * Copyright 2016-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,12 +22,13 @@ import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smackx.iot.provisioning.element.IoTIsFriend; import org.jxmpp.jid.Jid; +import org.jxmpp.stringprep.XmppStringprepException; import org.xmlpull.v1.XmlPullParser; public class IoTIsFriendProvider extends IQProvider { @Override - public IoTIsFriend parse(XmlPullParser parser, int initialDepth) throws Exception { + public IoTIsFriend parse(XmlPullParser parser, int initialDepth) throws XmppStringprepException { Jid jid = ParserUtils.getJidAttribute(parser); return new IoTIsFriend(jid); } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/provider/IoTIsFriendResponseProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/provider/IoTIsFriendResponseProvider.java index c3c1808b4..566386248 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/provider/IoTIsFriendResponseProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/provider/IoTIsFriendResponseProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2016 Florian Schmaus + * Copyright 2016-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,12 +23,13 @@ import org.jivesoftware.smackx.iot.provisioning.element.IoTIsFriendResponse; import org.jxmpp.jid.BareJid; import org.jxmpp.jid.Jid; +import org.jxmpp.stringprep.XmppStringprepException; import org.xmlpull.v1.XmlPullParser; public class IoTIsFriendResponseProvider extends IQProvider { @Override - public IoTIsFriendResponse parse(XmlPullParser parser, int initialDepth) throws Exception { + public IoTIsFriendResponse parse(XmlPullParser parser, int initialDepth) throws XmppStringprepException { Jid jid = ParserUtils.getJidAttribute(parser); BareJid bareJid = jid.asBareJid(); boolean result = ParserUtils.getBooleanAttribute(parser, "result"); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/provider/UnfriendProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/provider/UnfriendProvider.java index 7eb47d70a..fd63a0722 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/provider/UnfriendProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/provider/UnfriendProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright © 2016 Florian Schmaus + * Copyright © 2016-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,12 +22,13 @@ import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smackx.iot.provisioning.element.Unfriend; import org.jxmpp.jid.BareJid; +import org.jxmpp.stringprep.XmppStringprepException; import org.xmlpull.v1.XmlPullParser; public class UnfriendProvider extends ExtensionElementProvider { @Override - public Unfriend parse(XmlPullParser parser, int initialDepth) throws Exception { + public Unfriend parse(XmlPullParser parser, int initialDepth) throws XmppStringprepException { BareJid jid = ParserUtils.getBareJidAttribute(parser); return new Unfriend(jid); } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/provider/ChecksumProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/provider/ChecksumProvider.java index 980b50a74..abb58f67e 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/provider/ChecksumProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/provider/ChecksumProvider.java @@ -19,6 +19,9 @@ package org.jivesoftware.smackx.jingle_filetransfer.provider; import static org.xmlpull.v1.XmlPullParser.END_TAG; import static org.xmlpull.v1.XmlPullParser.START_TAG; +import java.io.IOException; +import java.text.ParseException; + import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.hashes.element.HashElement; import org.jivesoftware.smackx.hashes.provider.HashElementProvider; @@ -28,13 +31,14 @@ import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChi import org.jivesoftware.smackx.jingle_filetransfer.element.Range; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * Provider for the Checksum element. */ public class ChecksumProvider extends ExtensionElementProvider { @Override - public Checksum parse(XmlPullParser parser, int initialDepth) throws Exception { + public Checksum parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { JingleContent.Creator creator = null; String creatorString = parser.getAttributeValue(null, Checksum.ATTR_CREATOR); if (creatorString != null) { diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/provider/JingleFileTransferProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/provider/JingleFileTransferProvider.java index 8570188a6..ccac77707 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/provider/JingleFileTransferProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/provider/JingleFileTransferProvider.java @@ -19,6 +19,8 @@ package org.jivesoftware.smackx.jingle_filetransfer.provider; import static org.xmlpull.v1.XmlPullParser.END_TAG; import static org.xmlpull.v1.XmlPullParser.START_TAG; +import java.io.IOException; +import java.text.ParseException; import java.util.ArrayList; import org.jivesoftware.smackx.hashes.element.HashElement; @@ -31,6 +33,7 @@ import org.jivesoftware.smackx.jingle_filetransfer.element.Range; import org.jxmpp.util.XmppDateTime; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * Provider for JingleContentDescriptionFileTransfer elements. @@ -39,7 +42,7 @@ public class JingleFileTransferProvider extends JingleContentDescriptionProvider { @Override - public JingleFileTransfer parse(XmlPullParser parser, int initialDepth) throws Exception { + public JingleFileTransfer parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { ArrayList payloads = new ArrayList<>(); boolean inRange = false; JingleFileTransferChild.Builder builder = JingleFileTransferChild.getBuilder(); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/json/provider/AbstractJsonExtensionProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/json/provider/AbstractJsonExtensionProvider.java index 3d00ac01b..385378947 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/json/provider/AbstractJsonExtensionProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/json/provider/AbstractJsonExtensionProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2014-2018 Florian Schmaus + * Copyright 2014-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ package org.jivesoftware.smackx.json.provider; import java.io.IOException; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.util.PacketParserUtils; @@ -31,7 +30,7 @@ public abstract class AbstractJsonExtensionProvider { @Override - public MamFinIQ parse(XmlPullParser parser, int initialDepth) throws Exception { + public MamFinIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { String queryId = parser.getAttributeValue("", "queryid"); boolean complete = ParserUtils.getBooleanAttribute(parser, "complete", false); boolean stable = ParserUtils.getBooleanAttribute(parser, "stable", true); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/provider/MamQueryIQProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/provider/MamQueryIQProvider.java index c8de4c0fe..1ae617ea3 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/provider/MamQueryIQProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/provider/MamQueryIQProvider.java @@ -16,6 +16,9 @@ */ package org.jivesoftware.smackx.mam.provider; +import java.io.IOException; +import java.text.ParseException; + import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smackx.mam.element.MamQueryIQ; @@ -23,6 +26,7 @@ import org.jivesoftware.smackx.xdata.packet.DataForm; import org.jivesoftware.smackx.xdata.provider.DataFormProvider; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * MAM Query IQ Provider class. @@ -35,7 +39,8 @@ import org.xmlpull.v1.XmlPullParser; public class MamQueryIQProvider extends IQProvider { @Override - public MamQueryIQ parse(XmlPullParser parser, int initialDepth) throws Exception { + public MamQueryIQ parse(XmlPullParser parser, int initialDepth) + throws XmlPullParserException, IOException, ParseException { DataForm dataForm = null; String queryId = parser.getAttributeValue("", "queryid"); String node = parser.getAttributeValue("", "node"); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/provider/MamResultProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/provider/MamResultProvider.java index f2ebdf87b..3d37b1869 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/provider/MamResultProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/provider/MamResultProvider.java @@ -16,6 +16,9 @@ */ package org.jivesoftware.smackx.mam.provider; +import java.io.IOException; +import java.text.ParseException; + import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.forward.packet.Forwarded; @@ -23,6 +26,7 @@ import org.jivesoftware.smackx.forward.provider.ForwardedProvider; import org.jivesoftware.smackx.mam.element.MamElements.MamResultExtension; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * MAM Result Provider class. @@ -35,7 +39,7 @@ import org.xmlpull.v1.XmlPullParser; public class MamResultProvider extends ExtensionElementProvider { @Override - public MamResultExtension parse(XmlPullParser parser, int initialDepth) throws Exception { + public MamResultExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { Forwarded forwarded = null; String queryId = parser.getAttributeValue("", "queryid"); String id = parser.getAttributeValue("", "id"); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/provider/MarkupElementProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/provider/MarkupElementProvider.java index 00bb1627b..50cb37de1 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/provider/MarkupElementProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/provider/MarkupElementProvider.java @@ -19,12 +19,12 @@ package org.jivesoftware.smackx.message_markup.provider; import static org.xmlpull.v1.XmlPullParser.END_TAG; import static org.xmlpull.v1.XmlPullParser.START_TAG; +import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smackx.message_markup.element.BlockQuoteElement; @@ -34,11 +34,12 @@ import org.jivesoftware.smackx.message_markup.element.MarkupElement; import org.jivesoftware.smackx.message_markup.element.SpanElement; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; public class MarkupElementProvider extends ExtensionElementProvider { @Override - public MarkupElement parse(XmlPullParser parser, int initialDepth) throws Exception { + public MarkupElement parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException { MarkupElement.Builder markup = MarkupElement.getBuilder(); @@ -117,7 +118,8 @@ public class MarkupElementProvider extends ExtensionElementProvider 0 && lis.get(0).getStart() != listStart) { - throw new SmackException("Error while parsing incoming MessageMarkup ListElement: " + + // TODO: Should be SmackParseException. + throw new IOException("Error while parsing incoming MessageMarkup ListElement: " + "'start' attribute of first 'li' element must equal 'start' attribute of list."); } for (int i = 0; i < lis.size(); i++) { diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightAffiliationsChangeProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightAffiliationsChangeProvider.java index b2ef71fea..4f75e18c0 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightAffiliationsChangeProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightAffiliationsChangeProvider.java @@ -16,6 +16,7 @@ */ package org.jivesoftware.smackx.muclight.provider; +import java.io.IOException; import java.util.HashMap; import org.jivesoftware.smack.provider.ExtensionElementProvider; @@ -26,6 +27,7 @@ import org.jivesoftware.smackx.muclight.element.MUCLightElements.AffiliationsCha import org.jxmpp.jid.Jid; import org.jxmpp.jid.impl.JidCreate; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * MUC Light Affiliations Change Provider class. @@ -36,7 +38,7 @@ import org.xmlpull.v1.XmlPullParser; public class MUCLightAffiliationsChangeProvider extends ExtensionElementProvider { @Override - public AffiliationsChangeExtension parse(XmlPullParser parser, int initialDepth) throws Exception { + public AffiliationsChangeExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { HashMap affiliations = new HashMap<>(); String prevVersion = null; String version = null; diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightAffiliationsIQProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightAffiliationsIQProvider.java index 3f9d470a4..afc3fb9c6 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightAffiliationsIQProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightAffiliationsIQProvider.java @@ -16,6 +16,7 @@ */ package org.jivesoftware.smackx.muclight.provider; +import java.io.IOException; import java.util.HashMap; import org.jivesoftware.smack.provider.IQProvider; @@ -26,6 +27,7 @@ import org.jivesoftware.smackx.muclight.element.MUCLightAffiliationsIQ; import org.jxmpp.jid.Jid; import org.jxmpp.jid.impl.JidCreate; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * MUC Light affiliations IQ provider class. @@ -36,7 +38,7 @@ import org.xmlpull.v1.XmlPullParser; public class MUCLightAffiliationsIQProvider extends IQProvider { @Override - public MUCLightAffiliationsIQ parse(XmlPullParser parser, int initialDepth) throws Exception { + public MUCLightAffiliationsIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { String version = null; HashMap occupants = new HashMap<>(); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightBlockingIQProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightBlockingIQProvider.java index ed5cd132b..3a608580c 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightBlockingIQProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightBlockingIQProvider.java @@ -39,7 +39,7 @@ import org.xmlpull.v1.XmlPullParserException; public class MUCLightBlockingIQProvider extends IQProvider { @Override - public MUCLightBlockingIQ parse(XmlPullParser parser, int initialDepth) throws Exception { + public MUCLightBlockingIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { HashMap rooms = null; HashMap users = null; diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightConfigurationIQProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightConfigurationIQProvider.java index ad6f569f7..04b04cf6f 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightConfigurationIQProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightConfigurationIQProvider.java @@ -16,6 +16,7 @@ */ package org.jivesoftware.smackx.muclight.provider; +import java.io.IOException; import java.util.HashMap; import org.jivesoftware.smack.provider.IQProvider; @@ -24,6 +25,7 @@ import org.jivesoftware.smackx.muclight.MUCLightRoomConfiguration; import org.jivesoftware.smackx.muclight.element.MUCLightConfigurationIQ; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * MUC Light configuration IQ provider class. @@ -34,7 +36,7 @@ import org.xmlpull.v1.XmlPullParser; public class MUCLightConfigurationIQProvider extends IQProvider { @Override - public MUCLightConfigurationIQ parse(XmlPullParser parser, int initialDepth) throws Exception { + public MUCLightConfigurationIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { String version = null; String roomName = null; String subject = null; diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightConfigurationsChangeProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightConfigurationsChangeProvider.java index e62a7f566..20b4a346d 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightConfigurationsChangeProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightConfigurationsChangeProvider.java @@ -16,6 +16,7 @@ */ package org.jivesoftware.smackx.muclight.provider; +import java.io.IOException; import java.util.HashMap; import org.jivesoftware.smack.provider.ExtensionElementProvider; @@ -23,6 +24,7 @@ import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.muclight.element.MUCLightElements.ConfigurationsChangeExtension; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * MUC Light configurations change provider class. @@ -33,7 +35,7 @@ import org.xmlpull.v1.XmlPullParser; public class MUCLightConfigurationsChangeProvider extends ExtensionElementProvider { @Override - public ConfigurationsChangeExtension parse(XmlPullParser parser, int initialDepth) throws Exception { + public ConfigurationsChangeExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { String prevVersion = null; String version = null; String roomName = null; diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightInfoIQProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightInfoIQProvider.java index 72b6fc2e2..add4d4e21 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightInfoIQProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightInfoIQProvider.java @@ -16,6 +16,7 @@ */ package org.jivesoftware.smackx.muclight.provider; +import java.io.IOException; import java.util.HashMap; import org.jivesoftware.smack.provider.IQProvider; @@ -27,6 +28,7 @@ import org.jivesoftware.smackx.muclight.element.MUCLightInfoIQ; import org.jxmpp.jid.Jid; import org.jxmpp.jid.impl.JidCreate; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * MUC Light info IQ provider class. @@ -37,7 +39,7 @@ import org.xmlpull.v1.XmlPullParser; public class MUCLightInfoIQProvider extends IQProvider { @Override - public MUCLightInfoIQ parse(XmlPullParser parser, int initialDepth) throws Exception { + public MUCLightInfoIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { String version = null; String roomName = null; String subject = null; @@ -93,7 +95,7 @@ public class MUCLightInfoIQProvider extends IQProvider { return new MUCLightInfoIQ(version, new MUCLightRoomConfiguration(roomName, subject, customConfigs), occupants); } - private static HashMap iterateOccupants(XmlPullParser parser) throws Exception { + private static HashMap iterateOccupants(XmlPullParser parser) throws XmlPullParserException, IOException { HashMap occupants = new HashMap<>(); int depth = parser.getDepth(); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/provider/RemoteDisablingProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/provider/RemoteDisablingProvider.java index 501e2b15c..cfeca6115 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/provider/RemoteDisablingProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/provider/RemoteDisablingProvider.java @@ -16,6 +16,8 @@ */ package org.jivesoftware.smackx.push_notifications.provider; +import java.io.IOException; + import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.push_notifications.element.PushNotificationsElements.RemoteDisablingExtension; @@ -23,6 +25,7 @@ import org.jivesoftware.smackx.push_notifications.element.PushNotificationsEleme import org.jxmpp.jid.Jid; import org.jxmpp.jid.impl.JidCreate; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * Push Notifications Remote Disabling Provider class. @@ -34,7 +37,7 @@ import org.xmlpull.v1.XmlPullParser; public class RemoteDisablingProvider extends ExtensionElementProvider { @Override - public RemoteDisablingExtension parse(XmlPullParser parser, int initialDepth) throws Exception { + public RemoteDisablingExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { Jid userJid = null; String node = parser.getAttributeValue("", "node"); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/reference/provider/ReferenceProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/reference/provider/ReferenceProvider.java index 92474a48c..e46a99285 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/reference/provider/ReferenceProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/reference/provider/ReferenceProvider.java @@ -16,7 +16,10 @@ */ package org.jivesoftware.smackx.reference.provider; +import java.io.IOException; import java.net.URI; +import java.net.URISyntaxException; +import java.text.ParseException; import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.provider.ExtensionElementProvider; @@ -25,20 +28,28 @@ import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smackx.reference.element.ReferenceElement; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; public class ReferenceProvider extends ExtensionElementProvider { public static final ReferenceProvider TEST_PROVIDER = new ReferenceProvider(); @Override - public ReferenceElement parse(XmlPullParser parser, int initialDepth) throws Exception { + public ReferenceElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { Integer begin = ParserUtils.getIntegerAttribute(parser, ReferenceElement.ATTR_BEGIN); Integer end = ParserUtils.getIntegerAttribute(parser, ReferenceElement.ATTR_END); String typeString = parser.getAttributeValue(null, ReferenceElement.ATTR_TYPE); ReferenceElement.Type type = ReferenceElement.Type.valueOf(typeString); String anchor = parser.getAttributeValue(null, ReferenceElement.ATTR_ANCHOR); String uriString = parser.getAttributeValue(null, ReferenceElement.ATTR_URI); - URI uri = uriString != null ? new URI(uriString) : null; + URI uri; + try { + uri = uriString != null ? new URI(uriString) : null; + } + catch (URISyntaxException e) { + // TODO: Should be SmackParseException and probably be factored into ParserUtils. + throw new IOException(e); + } ExtensionElement child = null; outerloop: while (true) { int eventType = parser.next(); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/provider/OriginIdProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/provider/OriginIdProvider.java index 19ef6edd7..2053ace96 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/provider/OriginIdProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/provider/OriginIdProvider.java @@ -26,7 +26,7 @@ public class OriginIdProvider extends ExtensionElementProvider public static final OriginIdProvider TEST_INSTANCE = new OriginIdProvider(); @Override - public OriginIdElement parse(XmlPullParser parser, int initialDepth) throws Exception { + public OriginIdElement parse(XmlPullParser parser, int initialDepth) { return new OriginIdElement(parser.getAttributeValue(null, OriginIdElement.ATTR_ID)); } } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/provider/StanzaIdProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/provider/StanzaIdProvider.java index 2a3fcad28..84e4526b2 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/provider/StanzaIdProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/provider/StanzaIdProvider.java @@ -26,7 +26,7 @@ public class StanzaIdProvider extends ExtensionElementProvider public static StanzaIdProvider TEST_INSTANCE = new StanzaIdProvider(); @Override - public StanzaIdElement parse(XmlPullParser parser, int initialDepth) throws Exception { + public StanzaIdElement parse(XmlPullParser parser, int initialDepth) { String id = parser.getAttributeValue(null, StanzaIdElement.ATTR_ID); String by = parser.getAttributeValue(null, StanzaIdElement.ATTR_BY); return new StanzaIdElement(id, by); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/provider/SpoilerProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/provider/SpoilerProvider.java index 090d8c499..277a514e0 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/provider/SpoilerProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/provider/SpoilerProvider.java @@ -19,18 +19,21 @@ package org.jivesoftware.smackx.spoiler.provider; import static org.xmlpull.v1.XmlPullParser.END_TAG; import static org.xmlpull.v1.XmlPullParser.TEXT; +import java.io.IOException; + import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smackx.spoiler.element.SpoilerElement; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; public class SpoilerProvider extends ExtensionElementProvider { public static SpoilerProvider INSTANCE = new SpoilerProvider(); @Override - public SpoilerElement parse(XmlPullParser parser, int initialDepth) throws Exception { + public SpoilerElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { String lang = ParserUtils.getXmlLang(parser); String hint = null; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/provider/BlockContactsIQProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/provider/BlockContactsIQProvider.java index 72174a8eb..8dd79f2de 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/provider/BlockContactsIQProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/provider/BlockContactsIQProvider.java @@ -16,6 +16,7 @@ */ package org.jivesoftware.smackx.blocking.provider; +import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -26,6 +27,7 @@ import org.jivesoftware.smackx.blocking.element.BlockContactsIQ; import org.jxmpp.jid.Jid; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * Block contact IQ provider class. @@ -37,7 +39,7 @@ import org.xmlpull.v1.XmlPullParser; public class BlockContactsIQProvider extends IQProvider { @Override - public BlockContactsIQ parse(XmlPullParser parser, int initialDepth) throws Exception { + public BlockContactsIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { List jids = new ArrayList<>(); outerloop: while (true) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/provider/BlockListIQProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/provider/BlockListIQProvider.java index 590cfda4b..89908fd17 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/provider/BlockListIQProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/provider/BlockListIQProvider.java @@ -16,6 +16,7 @@ */ package org.jivesoftware.smackx.blocking.provider; +import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -27,6 +28,7 @@ import org.jivesoftware.smackx.blocking.element.BlockListIQ; import org.jxmpp.jid.Jid; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * Block list IQ provider class. @@ -38,7 +40,7 @@ import org.xmlpull.v1.XmlPullParser; public class BlockListIQProvider extends IQProvider { @Override - public BlockListIQ parse(XmlPullParser parser, int initialDepth) throws Exception { + public BlockListIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { List jids = null; outerloop: while (true) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/provider/BlockedErrorExtensionProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/provider/BlockedErrorExtensionProvider.java index 441a84139..d21aae77c 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/provider/BlockedErrorExtensionProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/provider/BlockedErrorExtensionProvider.java @@ -32,7 +32,7 @@ import org.xmlpull.v1.XmlPullParser; public class BlockedErrorExtensionProvider extends ExtensionElementProvider { @Override - public BlockedErrorExtension parse(XmlPullParser parser, int initialDepth) throws Exception { + public BlockedErrorExtension parse(XmlPullParser parser, int initialDepth) { return new BlockedErrorExtension(); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/provider/UnblockContactsIQProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/provider/UnblockContactsIQProvider.java index c0a3b7c11..e69cb1c43 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/provider/UnblockContactsIQProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/provider/UnblockContactsIQProvider.java @@ -16,6 +16,7 @@ */ package org.jivesoftware.smackx.blocking.provider; +import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -26,6 +27,7 @@ import org.jivesoftware.smackx.blocking.element.UnblockContactsIQ; import org.jxmpp.jid.Jid; import org.jxmpp.jid.impl.JidCreate; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * Unblock contact IQ provider class. @@ -37,7 +39,7 @@ import org.xmlpull.v1.XmlPullParser; public class UnblockContactsIQProvider extends IQProvider { @Override - public UnblockContactsIQ parse(XmlPullParser parser, int initialDepth) throws Exception { + public UnblockContactsIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { List jids = null; outerloop: while (true) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bob/provider/BoBIQProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bob/provider/BoBIQProvider.java index 5eccdff17..c38c3ee8c 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bob/provider/BoBIQProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bob/provider/BoBIQProvider.java @@ -16,6 +16,8 @@ */ package org.jivesoftware.smackx.bob.provider; +import java.io.IOException; + import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.util.ParserUtils; @@ -24,6 +26,7 @@ import org.jivesoftware.smackx.bob.BoBHash; import org.jivesoftware.smackx.bob.element.BoBIQ; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * Bits of Binary IQ provider class. @@ -35,7 +38,7 @@ import org.xmlpull.v1.XmlPullParser; public class BoBIQProvider extends IQProvider { @Override - public BoBIQ parse(XmlPullParser parser, int initialDepth) throws Exception { + public BoBIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { String cid = parser.getAttributeValue("", "cid"); BoBHash bobHash = BoBHash.fromCid(cid); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/provider/DataPacketProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/provider/DataPacketProvider.java index 90c019f75..4304baa2b 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/provider/DataPacketProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/provider/DataPacketProvider.java @@ -17,6 +17,7 @@ package org.jivesoftware.smackx.bytestreams.ibb.provider; import java.io.IOException; +import java.text.ParseException; import org.jivesoftware.smackx.bytestreams.ibb.packet.Data; import org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtension; @@ -38,7 +39,7 @@ public class DataPacketProvider { @Override public Data parse(XmlPullParser parser, int initialDepth) - throws Exception { + throws IOException, XmlPullParserException, ParseException { DataPacketExtension data = packetExtensionProvider.parse(parser); return new Data(data); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/provider/CapsExtensionProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/provider/CapsExtensionProvider.java index 3bf27e9a6..82fdd7bd7 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/provider/CapsExtensionProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/provider/CapsExtensionProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright © 2009 Jonas Ådahl, 2011-2014 Florian Schmaus + * Copyright © 2009 Jonas Ådahl, 2011-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ package org.jivesoftware.smackx.caps.provider; import java.io.IOException; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.caps.EntityCapsManager; @@ -30,8 +29,7 @@ import org.xmlpull.v1.XmlPullParserException; public class CapsExtensionProvider extends ExtensionElementProvider { @Override - public CapsExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, - SmackException { + public CapsExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { String hash, version, node; if (parser.getEventType() == XmlPullParser.START_TAG && parser.getName().equalsIgnoreCase(EntityCapsManager.ELEMENT)) { @@ -39,20 +37,23 @@ public class CapsExtensionProvider extends ExtensionElementProvider { @Override - public ChatStateExtension parse(XmlPullParser parser, int initialDepth) throws Exception { + public ChatStateExtension parse(XmlPullParser parser, int initialDepth) { String chatStateString = parser.getName(); ChatState state = ChatState.valueOf(chatStateString); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/provider/AdHocCommandDataProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/provider/AdHocCommandDataProvider.java index 79866ffb6..e7b934409 100755 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/provider/AdHocCommandDataProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/provider/AdHocCommandDataProvider.java @@ -17,6 +17,9 @@ package org.jivesoftware.smackx.commands.provider; +import java.io.IOException; +import java.text.ParseException; + import org.jivesoftware.smack.packet.StanzaError; import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.IQProvider; @@ -29,6 +32,7 @@ import org.jivesoftware.smackx.commands.packet.AdHocCommandData; import org.jivesoftware.smackx.xdata.provider.DataFormProvider; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * The AdHocCommandDataProvider parses AdHocCommandData packets. @@ -38,8 +42,7 @@ import org.xmlpull.v1.XmlPullParser; public class AdHocCommandDataProvider extends IQProvider { @Override - public AdHocCommandData parse(XmlPullParser parser, int initialDepth) - throws Exception { + public AdHocCommandData parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { boolean done = false; AdHocCommandData adHocCommandData = new AdHocCommandData(); DataFormProvider dataFormProvider = new DataFormProvider(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/provider/AbstractDelayInformationProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/provider/AbstractDelayInformationProvider.java index 7f11c2657..87e174d0c 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/provider/AbstractDelayInformationProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/provider/AbstractDelayInformationProvider.java @@ -20,7 +20,6 @@ import java.io.IOException; import java.text.ParseException; import java.util.Date; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.delay.packet.DelayInformation; @@ -33,7 +32,7 @@ public abstract class AbstractDelayInformationProvider extends ExtensionElementP @Override public final DelayInformation parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, - IOException, SmackException { + IOException, ParseException { String stampString = (parser.getAttributeValue("", "stamp")); String from = parser.getAttributeValue("", "from"); String reason = null; @@ -48,17 +47,14 @@ public abstract class AbstractDelayInformationProvider extends ExtensionElementP reason = ""; break; default: - throw new IllegalStateException("Unexpected event: " + event); + // TODO: Should be SmackParseException. + throw new IOException("Unexpected event: " + event); } } else { parser.next(); } - Date stamp; - try { - stamp = parseDate(stampString); - } catch (ParseException e) { - throw new SmackException(e); - } + + Date stamp = parseDate(stampString); return new DelayInformation(stamp, from, reason); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/provider/DiscoverInfoProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/provider/DiscoverInfoProvider.java index 28c1d0c31..062b18986 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/provider/DiscoverInfoProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/provider/DiscoverInfoProvider.java @@ -17,12 +17,16 @@ package org.jivesoftware.smackx.disco.provider; +import java.io.IOException; +import java.text.ParseException; + import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smackx.disco.packet.DiscoverInfo; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * The DiscoverInfoProvider parses Service Discovery information packets. @@ -32,8 +36,7 @@ import org.xmlpull.v1.XmlPullParser; public class DiscoverInfoProvider extends IQProvider { @Override - public DiscoverInfo parse(XmlPullParser parser, int initialDepth) - throws Exception { + public DiscoverInfo parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { DiscoverInfo discoverInfo = new DiscoverInfo(); boolean done = false; DiscoverInfo.Identity identity; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/forward/provider/ForwardedProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/forward/provider/ForwardedProvider.java index b63fe4d76..0800a03f7 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/forward/provider/ForwardedProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/forward/provider/ForwardedProvider.java @@ -16,9 +16,10 @@ */ package org.jivesoftware.smackx.forward.provider; +import java.io.IOException; +import java.text.ParseException; import java.util.logging.Logger; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.provider.ExtensionElementProvider; @@ -29,6 +30,7 @@ import org.jivesoftware.smackx.delay.provider.DelayInformationProvider; import org.jivesoftware.smackx.forward.packet.Forwarded; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * This class implements the {@link ExtensionElementProvider} to parse @@ -43,7 +45,7 @@ public class ForwardedProvider extends ExtensionElementProvider { private static final Logger LOGGER = Logger.getLogger(ForwardedProvider.class.getName()); @Override - public Forwarded parse(XmlPullParser parser, int initialDepth) throws Exception { + public Forwarded parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { DelayInformation di = null; Stanza packet = null; @@ -77,8 +79,10 @@ public class ForwardedProvider extends ExtensionElementProvider { } } - if (packet == null) - throw new SmackException("forwarded extension must contain a packet"); + if (packet == null) { + // TODO: Should be SmackParseException. + throw new IOException("forwarded extension must contain a packet"); + } return new Forwarded(di, packet); } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/geoloc/provider/GeoLocationProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/geoloc/provider/GeoLocationProvider.java index aeee98ee7..57187c686 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/geoloc/provider/GeoLocationProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/geoloc/provider/GeoLocationProvider.java @@ -17,7 +17,6 @@ package org.jivesoftware.smackx.geoloc.provider; import java.io.IOException; -import java.net.URISyntaxException; import java.text.ParseException; import org.jivesoftware.smack.provider.ExtensionElementProvider; @@ -32,7 +31,7 @@ public class GeoLocationProvider extends ExtensionElementProvider { @Override public GeoLocation parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, - ParseException, URISyntaxException { + ParseException { GeoLocation.Builder builder = GeoLocation.builder(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqlast/packet/LastActivity.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqlast/packet/LastActivity.java index 7c404f3a4..cc9d84f5a 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqlast/packet/LastActivity.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqlast/packet/LastActivity.java @@ -1,6 +1,6 @@ /** * - * Copyright 2003-2007 Jive Software, 2014 Florian Schmaus + * Copyright 2003-2007 Jive Software, 2014-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ package org.jivesoftware.smackx.iqlast.packet; import java.io.IOException; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.provider.IQProvider; @@ -103,21 +102,18 @@ public class LastActivity extends IQ { public static class Provider extends IQProvider { @Override - public LastActivity parse(XmlPullParser parser, int initialDepth) throws SmackException, XmlPullParserException { + public LastActivity parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { LastActivity lastActivity = new LastActivity(); String seconds = parser.getAttributeValue("", "seconds"); if (seconds != null) { try { lastActivity.setLastActivity(Long.parseLong(seconds)); } catch (NumberFormatException e) { - throw new SmackException("Could not parse last activity number", e); + // TODO: Should be SmackParseException (or a SmackParseNumberException subclass of). + throw new IOException("Could not parse last activity number", e); } } - try { - lastActivity.setMessage(parser.nextText()); - } catch (IOException e) { - throw new SmackException(e); - } + lastActivity.setMessage(parser.nextText()); return lastActivity; } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java index 60a3f0d72..9e5dff4d6 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java @@ -23,7 +23,6 @@ import java.util.Map; import java.util.WeakHashMap; import org.jivesoftware.smack.Manager; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.XMPPConnection; @@ -237,7 +236,7 @@ public final class PrivateDataManager extends Manager { @Override public PrivateDataIQ parse(XmlPullParser parser, int initialDepth) - throws XmlPullParserException, IOException, SmackException { + throws XmlPullParserException, IOException { PrivateData privateData = null; boolean done = false; while (!done) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/provider/PrivateDataProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/provider/PrivateDataProvider.java index 9cda3218e..a4332d667 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/provider/PrivateDataProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/provider/PrivateDataProvider.java @@ -19,8 +19,6 @@ package org.jivesoftware.smackx.iqprivate.provider; import java.io.IOException; -import org.jivesoftware.smack.SmackException; - import org.jivesoftware.smackx.iqprivate.packet.PrivateData; import org.xmlpull.v1.XmlPullParser; @@ -45,7 +43,6 @@ public interface PrivateDataProvider { * @return a new PrivateData instance. * @throws XmlPullParserException * @throws IOException - * @throws SmackException */ - PrivateData parsePrivateData(XmlPullParser parser) throws XmlPullParserException, IOException, SmackException; + PrivateData parsePrivateData(XmlPullParser parser) throws XmlPullParserException, IOException; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/provider/RegistrationProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/provider/RegistrationProvider.java index c0d13b2f6..a91d49b4e 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/provider/RegistrationProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/provider/RegistrationProvider.java @@ -16,6 +16,8 @@ */ package org.jivesoftware.smackx.iqregister.provider; +import java.io.IOException; +import java.text.ParseException; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -29,12 +31,12 @@ import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smackx.iqregister.packet.Registration; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; public class RegistrationProvider extends IQProvider { @Override - public Registration parse(XmlPullParser parser, int initialDepth) - throws Exception { + public Registration parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { String instruction = null; Map fields = new HashMap<>(); List packetExtensions = new LinkedList<>(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleContentDescriptionProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleContentDescriptionProvider.java index 2b5f9c771..4f6166d68 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleContentDescriptionProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleContentDescriptionProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2017 Florian Schmaus + * Copyright 2017-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,16 +16,20 @@ */ package org.jivesoftware.smackx.jingle.provider; +import java.io.IOException; +import java.text.ParseException; + import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.jingle.element.JingleContentDescription; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; public abstract class JingleContentDescriptionProvider extends ExtensionElementProvider { @Override - public abstract D parse(XmlPullParser parser, int initialDepth) throws Exception; + public abstract D parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleContentTransportProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleContentTransportProvider.java index 20c987f62..ae8be00f3 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleContentTransportProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleContentTransportProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2017 Florian Schmaus + * Copyright 2017-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,16 +16,19 @@ */ package org.jivesoftware.smackx.jingle.provider; +import java.io.IOException; + import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.jingle.element.JingleContentTransport; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; public abstract class JingleContentTransportProvider extends ExtensionElementProvider { @Override - public abstract T parse(XmlPullParser parser, int initialDepth) throws Exception; + public abstract T parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleErrorProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleErrorProvider.java index 14144ae0d..5b83b0f34 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleErrorProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleErrorProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2017 Florian Schmaus + * Copyright 2017-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import org.xmlpull.v1.XmlPullParser; public class JingleErrorProvider extends ExtensionElementProvider { @Override - public JingleError parse(XmlPullParser parser, int initialDepth) throws Exception { + public JingleError parse(XmlPullParser parser, int initialDepth) { String errorName = parser.getName(); return JingleError.fromString(errorName); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleProvider.java index a040d0ffc..c49fb80c5 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleProvider.java @@ -16,6 +16,8 @@ */ package org.jivesoftware.smackx.jingle.provider; +import java.io.IOException; +import java.text.ParseException; import java.util.logging.Logger; import org.jivesoftware.smack.packet.StandardExtensionElement; @@ -35,13 +37,14 @@ 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 { private static final Logger LOGGER = Logger.getLogger(JingleProvider.class.getName()); @Override - public Jingle parse(XmlPullParser parser, int initialDepth) throws Exception { + public Jingle parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { Jingle.Builder builder = Jingle.getBuilder(); String actionString = parser.getAttributeValue("", Jingle.ACTION_ATTRIBUTE_NAME); @@ -99,7 +102,7 @@ public class JingleProvider extends IQProvider { } public static JingleContent parseJingleContent(XmlPullParser parser, final int initialDepth) - throws Exception { + throws XmlPullParserException, IOException, ParseException { JingleContent.Builder builder = JingleContent.getBuilder(); String creatorString = parser.getAttributeValue("", JingleContent.CREATOR_ATTRIBUTE_NAME); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_ibb/provider/JingleIBBTransportProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_ibb/provider/JingleIBBTransportProvider.java index 73b027748..66484f0b0 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_ibb/provider/JingleIBBTransportProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_ibb/provider/JingleIBBTransportProvider.java @@ -26,7 +26,7 @@ import org.xmlpull.v1.XmlPullParser; */ public class JingleIBBTransportProvider extends JingleContentTransportProvider { @Override - public JingleIBBTransport parse(XmlPullParser parser, int initialDepth) throws Exception { + public JingleIBBTransport parse(XmlPullParser parser, int initialDepth) { String blockSizeString = parser.getAttributeValue(null, JingleIBBTransport.ATTR_BLOCK_SIZE); String sid = parser.getAttributeValue(null, JingleIBBTransport.ATTR_SID); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/provider/JingleS5BTransportProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/provider/JingleS5BTransportProvider.java index ad681e9e7..d093373da 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/provider/JingleS5BTransportProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/provider/JingleS5BTransportProvider.java @@ -27,6 +27,8 @@ import static org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.Jing import static org.xmlpull.v1.XmlPullParser.END_TAG; import static org.xmlpull.v1.XmlPullParser.START_TAG; +import java.io.IOException; + import org.jivesoftware.smackx.jingle.element.JingleContentTransport; import org.jivesoftware.smackx.jingle.provider.JingleContentTransportProvider; import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransport; @@ -35,6 +37,7 @@ import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTr 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. @@ -42,7 +45,7 @@ import org.xmlpull.v1.XmlPullParser; public class JingleS5BTransportProvider extends JingleContentTransportProvider { @Override - public JingleS5BTransport parse(XmlPullParser parser, int initialDepth) throws Exception { + public JingleS5BTransport parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { JingleS5BTransport.Builder builder = JingleS5BTransport.getBuilder(); String streamId = parser.getAttributeValue(null, JingleS5BTransport.ATTR_SID); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/last_interaction/provider/IdleProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/last_interaction/provider/IdleProvider.java index 102edc7df..8c0790f60 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/last_interaction/provider/IdleProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/last_interaction/provider/IdleProvider.java @@ -16,6 +16,7 @@ */ package org.jivesoftware.smackx.last_interaction.provider; +import java.text.ParseException; import java.util.Date; import org.jivesoftware.smack.provider.ExtensionElementProvider; @@ -28,11 +29,8 @@ public class IdleProvider extends ExtensionElementProvider { public static final IdleProvider TEST_INSTANCE = new IdleProvider(); - /** - * {@inheritDoc} - */ @Override - public IdleElement parse(XmlPullParser parser, int initialDepth) throws Exception { + public IdleElement parse(XmlPullParser parser, int initialDepth) throws ParseException { String dateString = parser.getAttributeValue(null, IdleElement.ATTR_SINCE); Date since = XmppDateTime.parseXEP0082Date(dateString); return new IdleElement(since); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/message_correct/provider/MessageCorrectProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/message_correct/provider/MessageCorrectProvider.java index ec1c2fc27..3a3d256c6 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/message_correct/provider/MessageCorrectProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/message_correct/provider/MessageCorrectProvider.java @@ -16,15 +16,11 @@ */ package org.jivesoftware.smackx.message_correct.provider; -import java.io.IOException; - -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.message_correct.element.MessageCorrectExtension; import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; /** * A ExtensionElementProvider for the MessageCorrectExtension. As @@ -35,8 +31,7 @@ import org.xmlpull.v1.XmlPullParserException; public class MessageCorrectProvider extends ExtensionElementProvider { @Override - public MessageCorrectExtension parse(XmlPullParser parser, int initialDepth) - throws XmlPullParserException, IOException, SmackException { + public MessageCorrectExtension parse(XmlPullParser parser, int initialDepth) { String idMessageToReplace = parser.getAttributeValue("", MessageCorrectExtension.ID_TAG); return new MessageCorrectExtension(idMessageToReplace); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/mood/provider/MoodConcretisationProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/mood/provider/MoodConcretisationProvider.java index 5b6764853..1ee3af639 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/mood/provider/MoodConcretisationProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/mood/provider/MoodConcretisationProvider.java @@ -16,13 +16,17 @@ */ package org.jivesoftware.smackx.mood.provider; +import java.io.IOException; +import java.text.ParseException; + import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.mood.element.MoodConcretisation; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; public abstract class MoodConcretisationProvider extends ExtensionElementProvider { @Override - public abstract C parse(XmlPullParser parser, int initialDepth) throws Exception; + public abstract C parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException, ParseException; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/mood/provider/MoodProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/mood/provider/MoodProvider.java index 7ac71eb12..dcc515b29 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/mood/provider/MoodProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/mood/provider/MoodProvider.java @@ -19,6 +19,8 @@ package org.jivesoftware.smackx.mood.provider; import static org.xmlpull.v1.XmlPullParser.END_TAG; import static org.xmlpull.v1.XmlPullParser.START_TAG; +import java.io.IOException; +import java.text.ParseException; import java.util.logging.Level; import java.util.logging.Logger; @@ -37,7 +39,8 @@ public class MoodProvider extends ExtensionElementProvider { public static final MoodProvider INSTANCE = new MoodProvider(); @Override - public MoodElement parse(XmlPullParser parser, int initialDepth) throws Exception { + public MoodElement parse(XmlPullParser parser, int initialDepth) + throws XmlPullParserException, IOException, ParseException { String text = null; Mood mood = null; MoodConcretisation concretisation = null; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/mood/provider/SimpleMoodConcretisationProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/mood/provider/SimpleMoodConcretisationProvider.java index 9d360febb..688488c7d 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/mood/provider/SimpleMoodConcretisationProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/mood/provider/SimpleMoodConcretisationProvider.java @@ -16,9 +16,13 @@ */ package org.jivesoftware.smackx.mood.provider; +import java.io.IOException; +import java.text.ParseException; + import org.jivesoftware.smackx.mood.element.MoodConcretisation; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * Simple {@link MoodConcretisationProvider} implementation, suitable for really simple {@link MoodConcretisation}s, @@ -30,7 +34,7 @@ import org.xmlpull.v1.XmlPullParser; public abstract class SimpleMoodConcretisationProvider extends MoodConcretisationProvider { @Override - public C parse(XmlPullParser parser, int initialDepth) throws Exception { + public C parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException, ParseException { // Since the elements name and namespace is known, we can just return an instance of the MoodConcretisation. return simpleExtension(); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/provider/MUCOwnerProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/provider/MUCOwnerProvider.java index d53a244d1..7861a990c 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/provider/MUCOwnerProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/provider/MUCOwnerProvider.java @@ -17,12 +17,16 @@ package org.jivesoftware.smackx.muc.provider; +import java.io.IOException; +import java.text.ParseException; + import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smackx.muc.packet.MUCOwner; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * The MUCOwnerProvider parses MUCOwner packets. (@see MUCOwner) @@ -32,8 +36,7 @@ import org.xmlpull.v1.XmlPullParser; public class MUCOwnerProvider extends IQProvider { @Override - public MUCOwner parse(XmlPullParser parser, int initialDepth) - throws Exception { + public MUCOwner parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { MUCOwner mucOwner = new MUCOwner(); boolean done = false; while (!done) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/provider/PrivacyProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/provider/PrivacyProvider.java index 41f845a68..6e7d325ec 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/provider/PrivacyProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/provider/PrivacyProvider.java @@ -19,7 +19,6 @@ package org.jivesoftware.smackx.privacy.provider; import java.io.IOException; import java.util.ArrayList; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.util.ParserUtils; @@ -41,7 +40,7 @@ public class PrivacyProvider extends IQProvider { @Override public Privacy parse(XmlPullParser parser, int initialDepth) - throws XmlPullParserException, IOException, SmackException { + throws XmlPullParserException, IOException { Privacy privacy = new Privacy(); boolean done = false; while (!done) { @@ -80,7 +79,7 @@ public class PrivacyProvider extends IQProvider { } // Parse the list complex type - private static void parseList(XmlPullParser parser, Privacy privacy) throws XmlPullParserException, IOException, SmackException { + private static void parseList(XmlPullParser parser, Privacy privacy) throws XmlPullParserException, IOException { boolean done = false; String listName = parser.getAttributeValue("", "name"); ArrayList items = new ArrayList<>(); @@ -105,7 +104,7 @@ public class PrivacyProvider extends IQProvider { } // Parse the list complex type - private static PrivacyItem parseItem(XmlPullParser parser) throws XmlPullParserException, IOException, SmackException { + private static PrivacyItem parseItem(XmlPullParser parser) throws XmlPullParserException, IOException { // CHECKSTYLE:ON // Retrieves the required attributes String actionValue = parser.getAttributeValue("", "action"); @@ -128,7 +127,8 @@ public class PrivacyProvider extends IQProvider { allow = false; break; default: - throw new SmackException("Unknown action value '" + actionValue + "'"); + // TODO: Should be SmackParsingException. + throw new IOException("Unknown action value '" + actionValue + "'"); } PrivacyItem item; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/AffiliationProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/AffiliationProvider.java index 6b6d83a64..d1fdac11e 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/AffiliationProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/AffiliationProvider.java @@ -16,7 +16,8 @@ */ package org.jivesoftware.smackx.pubsub.provider; -import org.jivesoftware.smack.SmackException; +import java.io.IOException; + import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.util.ParserUtils; @@ -35,8 +36,7 @@ import org.xmlpull.v1.XmlPullParser; public class AffiliationProvider extends ExtensionElementProvider { @Override - public Affiliation parse(XmlPullParser parser, int initialDepth) - throws Exception { + public Affiliation parse(XmlPullParser parser, int initialDepth) throws IOException { String node = parser.getAttributeValue(null, "node"); BareJid jid = ParserUtils.getBareJidAttribute(parser); String namespaceString = parser.getNamespace(); @@ -56,7 +56,8 @@ public class AffiliationProvider extends ExtensionElementProvider { affiliation = new Affiliation(jid, affiliationType, namespace); } else { - throw new SmackException("Invalid affililation. Either one of 'node' or 'jid' must be set" + // TODO: Should be SmackParsingException. + throw new IOException("Invalid affililation. Either one of 'node' or 'jid' must be set" + ". Node: " + node + ". Jid: " + jid + '.'); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/ItemProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/ItemProvider.java index 932b91837..727ab0833 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/ItemProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/ItemProvider.java @@ -16,6 +16,9 @@ */ package org.jivesoftware.smackx.pubsub.provider; +import java.io.IOException; +import java.text.ParseException; + import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ProviderManager; @@ -28,6 +31,7 @@ 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 item element as is defined in both the {@link PubSubNamespace#basic} and @@ -40,7 +44,7 @@ import org.xmlpull.v1.XmlPullParser; public class ItemProvider extends ExtensionElementProvider { @Override public Item parse(XmlPullParser parser, int initialDepth) - throws Exception { + throws XmlPullParserException, IOException, ParseException { String id = parser.getAttributeValue(null, "id"); String node = parser.getAttributeValue(null, "node"); String xmlns = parser.getNamespace(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/PubSubProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/PubSubProvider.java index 72c6bb2b0..973cd8475 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/PubSubProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/PubSubProvider.java @@ -16,6 +16,9 @@ */ package org.jivesoftware.smackx.pubsub.provider; +import java.io.IOException; +import java.text.ParseException; + import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.util.PacketParserUtils; @@ -24,6 +27,7 @@ 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 stanza extensions of the {@link IQ} stanza and returns @@ -33,8 +37,7 @@ import org.xmlpull.v1.XmlPullParser; */ public class PubSubProvider extends IQProvider { @Override - public PubSub parse(XmlPullParser parser, int initialDepth) - throws Exception { + public PubSub parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { String namespace = parser.getNamespace(); PubSubNamespace pubSubNamespace = PubSubNamespace.valueOfFromXmlns(namespace); PubSub pubsub = new PubSub(pubSubNamespace); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/search/UserSearch.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/search/UserSearch.java index 1aef0575a..dbdf485ba 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/search/UserSearch.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/search/UserSearch.java @@ -16,6 +16,9 @@ */ package org.jivesoftware.smackx.search; +import java.io.IOException; +import java.text.ParseException; + import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.XMPPConnection; @@ -31,6 +34,7 @@ import org.jivesoftware.smackx.xdata.packet.DataForm; import org.jxmpp.jid.DomainBareJid; 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 @@ -125,7 +129,7 @@ public class UserSearch extends SimpleIQ { // FIXME this provider does return two different types of IQs @Override - public IQ parse(XmlPullParser parser, int initialDepth) throws Exception { + public IQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { UserSearch search = null; SimpleUserSearch simpleUserSearch = new SimpleUserSearch(); @@ -160,8 +164,7 @@ public class UserSearch extends SimpleIQ { } private static void buildDataForm(SimpleUserSearch search, - String instructions, XmlPullParser parser) - throws Exception { + String instructions, XmlPullParser parser) throws XmlPullParserException, IOException, ParseException { DataForm dataForm = new DataForm(DataForm.Type.form); boolean done = false; dataForm.setTitle("User Search"); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/si/provider/StreamInitiationProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/si/provider/StreamInitiationProvider.java index 10caea879..20182e987 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/si/provider/StreamInitiationProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/si/provider/StreamInitiationProvider.java @@ -16,6 +16,7 @@ */ package org.jivesoftware.smackx.si.provider; +import java.io.IOException; import java.text.ParseException; import java.util.Date; import java.util.logging.Level; @@ -30,6 +31,7 @@ import org.jivesoftware.smackx.xdata.provider.DataFormProvider; import org.jxmpp.util.XmppDateTime; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * The StreamInitiationProvider parses StreamInitiation packets. @@ -41,8 +43,7 @@ public class StreamInitiationProvider extends IQProvider { private static final Logger LOGGER = Logger.getLogger(StreamInitiationProvider.class.getName()); @Override - public StreamInitiation parse(XmlPullParser parser, int initialDepth) - throws Exception { + public StreamInitiation parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { boolean done = false; // si diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/provider/VCardProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/provider/VCardProvider.java index f823147da..bebd68fd3 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/provider/VCardProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/provider/VCardProvider.java @@ -18,7 +18,6 @@ package org.jivesoftware.smackx.vcardtemp.provider; import java.io.IOException; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.util.StringUtils; @@ -69,8 +68,7 @@ public class VCardProvider extends IQProvider { // @formatter:on @Override - public VCard parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, - SmackException { + public VCard parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { VCard vCard = new VCard(); String name = null; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/provider/DataFormProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/provider/DataFormProvider.java index fcb3cb6a5..7000ff0b9 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/provider/DataFormProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/provider/DataFormProvider.java @@ -18,6 +18,7 @@ package org.jivesoftware.smackx.xdata.provider; import java.io.IOException; +import java.text.ParseException; import java.util.ArrayList; import java.util.List; @@ -45,8 +46,7 @@ public class DataFormProvider extends ExtensionElementProvider { public static final DataFormProvider INSTANCE = new DataFormProvider(); @Override - public DataForm parse(XmlPullParser parser, int initialDepth) throws - Exception { + public DataForm parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { DataForm.Type dataFormType = DataForm.Type.fromString(parser.getAttributeValue("", "type")); DataForm dataForm = new DataForm(dataFormType); outerloop: while (true) { diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/provider/RosterPacketProvider.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/provider/RosterPacketProvider.java index f61dce36d..5b883097a 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/provider/RosterPacketProvider.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/provider/RosterPacketProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright © 2003-2007 Jive Software, 2014-2015 Florian Schmaus + * Copyright © 2003-2007 Jive Software, 2014-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ package org.jivesoftware.smack.roster.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.roster.packet.RosterPacket; @@ -34,8 +33,7 @@ public class RosterPacketProvider extends IQProvider { public static final RosterPacketProvider INSTANCE = new RosterPacketProvider(); @Override - public RosterPacket parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, - SmackException { + public RosterPacket parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { RosterPacket roster = new RosterPacket(); String version = parser.getAttributeValue("", "ver"); roster.setVersion(version); diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/provider/RosterVerStreamFeatureProvider.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/provider/RosterVerStreamFeatureProvider.java index 175c807c6..ea2dee54a 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/provider/RosterVerStreamFeatureProvider.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/provider/RosterVerStreamFeatureProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright © 2015 Florian Schmaus + * Copyright © 2015-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,20 +16,15 @@ */ package org.jivesoftware.smack.roster.provider; -import java.io.IOException; - -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.roster.packet.RosterVer; import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; public class RosterVerStreamFeatureProvider extends ExtensionElementProvider { @Override - public RosterVer parse(XmlPullParser parser, int initialDepth) - throws XmlPullParserException, IOException, SmackException { + public RosterVer parse(XmlPullParser parser, int initialDepth) { return RosterVer.INSTANCE; } diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/provider/SubscriptionPreApprovalStreamFeatureProvider.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/provider/SubscriptionPreApprovalStreamFeatureProvider.java index 2c0f83d42..2c01c757c 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/provider/SubscriptionPreApprovalStreamFeatureProvider.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/provider/SubscriptionPreApprovalStreamFeatureProvider.java @@ -16,20 +16,15 @@ */ package org.jivesoftware.smack.roster.provider; -import java.io.IOException; - -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.roster.packet.SubscriptionPreApproval; import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; public class SubscriptionPreApprovalStreamFeatureProvider extends ExtensionElementProvider { @Override - public SubscriptionPreApproval parse(XmlPullParser parser, int initialDepth) - throws XmlPullParserException, IOException, SmackException { + public SubscriptionPreApproval parse(XmlPullParser parser, int initialDepth) { return SubscriptionPreApproval.INSTANCE; } diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java index e8d4ca9fc..c908b479b 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java @@ -25,7 +25,6 @@ import java.util.Enumeration; import java.util.logging.Level; import java.util.logging.Logger; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.StanzaCollector; @@ -330,7 +329,7 @@ public class RTPBridge extends IQ { @Override public RTPBridge parse(XmlPullParser parser, int initialDepth) - throws SmackException, XmlPullParserException, + throws XmlPullParserException, IOException { boolean done = false; @@ -339,7 +338,8 @@ public class RTPBridge extends IQ { String elementName; if (!parser.getNamespace().equals(RTPBridge.NAMESPACE)) - throw new SmackException("Not a RTP Bridge packet"); + // TODO: Should be SmackParseException. + throw new IOException("Not a RTP Bridge packet"); RTPBridge iq = new RTPBridge(); diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/STUN.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/STUN.java index 26a7925a2..f7f721eac 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/STUN.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/STUN.java @@ -117,7 +117,7 @@ public class STUN extends SimpleIQ { @Override public STUN parse(XmlPullParser parser, int initialDepth) - throws SmackException, XmlPullParserException, + throws XmlPullParserException, IOException { boolean done = false; @@ -126,7 +126,7 @@ public class STUN extends SimpleIQ { String elementName; if (!parser.getNamespace().equals(NAMESPACE)) - throw new SmackException("Not a STUN packet"); + throw new IOException("Not a STUN packet"); STUN iq = new STUN(); diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleContentDescriptionProvider.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleContentDescriptionProvider.java index a9ceb57c8..4af9f884e 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleContentDescriptionProvider.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleContentDescriptionProvider.java @@ -18,7 +18,6 @@ package org.jivesoftware.smackx.jingleold.provider; import java.io.IOException; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.jingleold.media.PayloadType; @@ -68,12 +67,11 @@ public abstract class JingleContentDescriptionProvider extends ExtensionElementP * @return a description element * @throws IOException * @throws XmlPullParserException - * @throws SmackException */ @Override public JingleContentDescription parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, - IOException, SmackException { + IOException { boolean done = false; JingleContentDescription desc = getInstance(); @@ -85,7 +83,8 @@ public abstract class JingleContentDescriptionProvider extends ExtensionElementP if (name.equals(JingleContentDescription.JinglePayloadType.NODENAME)) { desc.addJinglePayloadType(parsePayload(parser)); } else { - throw new SmackException("Unknow element \"" + name + "\" in content."); + // TODO: Should be SmackParseException. + throw new IOException("Unknow element \"" + name + "\" in content."); } } else if (eventType == XmlPullParser.END_TAG) { if (name.equals(JingleContentDescription.NODENAME)) { diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleDescriptionProvider.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleDescriptionProvider.java index 3a01c74d1..efa03ad4a 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleDescriptionProvider.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleDescriptionProvider.java @@ -18,7 +18,6 @@ package org.jivesoftware.smackx.jingleold.provider; import java.io.IOException; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.jingleold.media.PayloadType; @@ -67,12 +66,11 @@ public abstract class JingleDescriptionProvider extends ExtensionElementProvider * @param parser * the input to parse * @return a description element - * @throws SmackException * @throws IOException * @throws XmlPullParserException */ @Override - public JingleDescription parse(XmlPullParser parser, int initialDepth) throws SmackException, XmlPullParserException, IOException { + public JingleDescription parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { boolean done = false; JingleDescription desc = getInstance(); @@ -84,7 +82,8 @@ public abstract class JingleDescriptionProvider extends ExtensionElementProvider if (name.equals(PayloadType.NODENAME)) { desc.addPayloadType(parsePayload(parser)); } else { - throw new SmackException("Unknow element \"" + name + "\" in content."); + // TODO: Should be SmackParseException. + throw new IOException("Unknow element \"" + name + "\" in content."); } } else if (eventType == XmlPullParser.END_TAG) { if (name.equals(JingleDescription.NODENAME)) { diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleProvider.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleProvider.java index d3fb96dc8..9ef138aff 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleProvider.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleProvider.java @@ -17,7 +17,9 @@ package org.jivesoftware.smackx.jingleold.provider; -import org.jivesoftware.smack.SmackException; +import java.io.IOException; +import java.text.ParseException; + import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.util.ParserUtils; @@ -31,6 +33,7 @@ import org.jivesoftware.smackx.jingleold.packet.JingleTransport; import org.jxmpp.jid.Jid; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * The JingleProvider parses Jingle packets. @@ -41,11 +44,12 @@ public class JingleProvider extends IQProvider { /** * Parse a iq/jingle element. - * @throws Exception + * @throws ParseException + * @throws XmlPullParserException + * @throws IOException */ @Override - public Jingle parse(XmlPullParser parser, int intialDepth) - throws Exception { + public Jingle parse(XmlPullParser parser, int intialDepth) throws IOException, XmlPullParserException, ParseException { Jingle jingle = new Jingle(); String sid = ""; @@ -103,12 +107,14 @@ public class JingleProvider extends IQProvider { } else if (namespace.equals(JingleTransport.Ice.NAMESPACE)) { currentContent.addJingleTransport(jtpIce.parse(parser)); } else { - throw new SmackException("Unknown transport namespace \"" + namespace + "\" in Jingle packet."); + // TODO: Should be SmackParseException. + throw new IOException("Unknown transport namespace \"" + namespace + "\" in Jingle packet."); } } else if (namespace.equals(JingleContentInfo.Audio.NAMESPACE)) { jingle.setContentInfo((JingleContentInfo) jmipAudio.parse(parser)); } else { - throw new SmackException("Unknown combination of namespace \"" + namespace + "\" and element name \"" + // TODO: Should be SmackParseException. + throw new IOException("Unknown combination of namespace \"" + namespace + "\" and element name \"" + elementName + "\" in Jingle packet."); } diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleTransportProvider.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleTransportProvider.java index 7b05d1a4e..01759f866 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleTransportProvider.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleTransportProvider.java @@ -18,7 +18,6 @@ package org.jivesoftware.smackx.jingleold.provider; import java.io.IOException; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.jingleold.nat.ICECandidate; @@ -52,10 +51,9 @@ public abstract class JingleTransportProvider extends ExtensionElementProvider { @Override - public WorkgroupForm parse(XmlPullParser parser, int initialDepth) - throws Exception { + public WorkgroupForm parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { WorkgroupForm answer = new WorkgroupForm(); boolean done = false; diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/OccupantsInfo.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/OccupantsInfo.java index bbc8e35c4..a667c2267 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/OccupantsInfo.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/OccupantsInfo.java @@ -26,7 +26,6 @@ import java.util.HashSet; import java.util.Set; import java.util.TimeZone; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.provider.IQProvider; @@ -136,7 +135,7 @@ public class OccupantsInfo extends IQ { public static class Provider extends IQProvider { @Override - public OccupantsInfo parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException { + public OccupantsInfo parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { OccupantsInfo occupantsInfo = new OccupantsInfo(parser.getAttributeValue("", "roomID")); boolean done = false; @@ -153,7 +152,7 @@ public class OccupantsInfo extends IQ { return occupantsInfo; } - private OccupantInfo parseOccupantInfo(XmlPullParser parser) throws XmlPullParserException, IOException, SmackException { + private OccupantInfo parseOccupantInfo(XmlPullParser parser) throws XmlPullParserException, IOException, ParseException { boolean done = false; String jid = null; @@ -168,13 +167,9 @@ public class OccupantsInfo extends IQ { nickname = parser.nextText(); } else if (eventType == XmlPullParser.START_TAG && "joined".equals(parser.getName())) { - try { synchronized (UTC_FORMAT) { joined = UTC_FORMAT.parse(parser.nextText()); } - } catch (ParseException e) { - throw new SmackException(e); - } } else if (eventType == XmlPullParser.END_TAG && "occupant".equals(parser.getName())) { done = true; diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/OfferRequestProvider.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/OfferRequestProvider.java index 03c66e344..c92296289 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/OfferRequestProvider.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/OfferRequestProvider.java @@ -17,6 +17,8 @@ package org.jivesoftware.smackx.workgroup.packet; +import java.io.IOException; +import java.text.ParseException; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -35,6 +37,7 @@ import org.jivesoftware.smackx.workgroup.util.MetaDataUtils; import org.jxmpp.jid.Jid; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * An IQProvider for agent offer requests. @@ -48,7 +51,7 @@ public class OfferRequestProvider extends IQProvider { // happen anytime soon. @Override - public OfferRequestPacket parse(XmlPullParser parser, int initialDepth) throws Exception { + public OfferRequestPacket parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { int eventType = parser.getEventType(); String sessionID = null; int timeout = -1; diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java index fa6e277e0..0b39d1f13 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java @@ -26,7 +26,6 @@ import java.util.Iterator; import java.util.Set; import java.util.logging.Logger; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.provider.ExtensionElementProvider; @@ -146,7 +145,7 @@ public final class QueueDetails implements ExtensionElement { @Override public QueueDetails parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, - IOException, SmackException { + IOException, ParseException { SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT); QueueDetails queueDetails = new QueueDetails(); @@ -177,19 +176,10 @@ public final class QueueDetails implements ExtensionElement { time = Integer.parseInt(parser.nextText()); } else if ("join-time".equals(parser.getName())) { - try { joinTime = dateFormat.parse(parser.nextText()); - } catch (ParseException e) { - throw new SmackException(e); - } } else if (parser.getName().equals("waitTime")) { - Date wait; - try { - wait = dateFormat.parse(parser.nextText()); - } catch (ParseException e) { - throw new SmackException(e); - } + Date wait = dateFormat.parse(parser.nextText()); LOGGER.fine(wait.toString()); } diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueOverview.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueOverview.java index eb722b579..2259f6332 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueOverview.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueOverview.java @@ -22,7 +22,6 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; -import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.XmlEnvironment; import org.jivesoftware.smack.provider.ExtensionElementProvider; @@ -128,7 +127,7 @@ public class QueueOverview implements ExtensionElement { @Override public QueueOverview parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, - IOException, SmackException { + IOException, ParseException { int eventType = parser.getEventType(); QueueOverview queueOverview = new QueueOverview(); SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT); @@ -143,11 +142,7 @@ public class QueueOverview implements ExtensionElement { queueOverview.setAverageWaitTime(Integer.parseInt(parser.nextText())); } else if ("oldest".equals(parser.getName())) { - try { - queueOverview.setOldestEntry(dateFormat.parse(parser.nextText())); - } catch (ParseException e) { - throw new SmackException(e); - } + queueOverview.setOldestEntry(dateFormat.parse(parser.nextText())); } else if ("status".equals(parser.getName())) { queueOverview.setStatus(WorkgroupQueue.Status.fromString(parser.nextText())); diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/TranscriptProvider.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/TranscriptProvider.java index 0acff6859..7443d1abd 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/TranscriptProvider.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/TranscriptProvider.java @@ -17,6 +17,8 @@ package org.jivesoftware.smackx.workgroup.packet; +import java.io.IOException; +import java.text.ParseException; import java.util.ArrayList; import java.util.List; @@ -25,6 +27,7 @@ import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.util.PacketParserUtils; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * An IQProvider for transcripts. @@ -34,7 +37,7 @@ import org.xmlpull.v1.XmlPullParser; public class TranscriptProvider extends IQProvider { @Override - public Transcript parse(XmlPullParser parser, int initialDepth) throws Exception { + public Transcript parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { String sessionID = parser.getAttributeValue("", "sessionID"); List packets = new ArrayList<>(); diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/TranscriptSearch.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/TranscriptSearch.java index 0e53e7a54..f9fc324d4 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/TranscriptSearch.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/TranscriptSearch.java @@ -17,11 +17,15 @@ package org.jivesoftware.smackx.workgroup.packet; +import java.io.IOException; +import java.text.ParseException; + import org.jivesoftware.smack.packet.SimpleIQ; import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.util.PacketParserUtils; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * IQ stanza for retrieving the transcript search form, submitting the completed search form @@ -53,7 +57,7 @@ public class TranscriptSearch extends SimpleIQ { public static class Provider extends IQProvider { @Override - public TranscriptSearch parse(XmlPullParser parser, int initialDepth) throws Exception { + public TranscriptSearch parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { TranscriptSearch answer = new TranscriptSearch(); boolean done = false; diff --git a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/provider/OmemoBundleVAxolotlProvider.java b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/provider/OmemoBundleVAxolotlProvider.java index d79aea302..c01d2653b 100644 --- a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/provider/OmemoBundleVAxolotlProvider.java +++ b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/provider/OmemoBundleVAxolotlProvider.java @@ -27,6 +27,7 @@ import static org.jivesoftware.smackx.omemo.element.OmemoBundleElement.SIGNED_PR import static org.xmlpull.v1.XmlPullParser.END_TAG; import static org.xmlpull.v1.XmlPullParser.START_TAG; +import java.io.IOException; import java.util.HashMap; import org.jivesoftware.smack.provider.ExtensionElementProvider; @@ -34,6 +35,7 @@ import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.omemo.element.OmemoBundleElement_VAxolotl; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * Smack ExtensionProvider that parses OMEMO bundle element into OmemoBundleElement objects. @@ -42,7 +44,7 @@ import org.xmlpull.v1.XmlPullParser; */ public class OmemoBundleVAxolotlProvider extends ExtensionElementProvider { @Override - public OmemoBundleElement_VAxolotl parse(XmlPullParser parser, int initialDepth) throws Exception { + public OmemoBundleElement_VAxolotl parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { boolean stop = false; boolean inPreKeys = false; diff --git a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/provider/OmemoDeviceListVAxolotlProvider.java b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/provider/OmemoDeviceListVAxolotlProvider.java index e2b5efd56..e48e87705 100644 --- a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/provider/OmemoDeviceListVAxolotlProvider.java +++ b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/provider/OmemoDeviceListVAxolotlProvider.java @@ -22,6 +22,7 @@ import static org.jivesoftware.smackx.omemo.element.OmemoDeviceListElement.LIST; import static org.xmlpull.v1.XmlPullParser.END_TAG; import static org.xmlpull.v1.XmlPullParser.START_TAG; +import java.io.IOException; import java.util.HashSet; import java.util.Set; @@ -30,6 +31,7 @@ import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.omemo.element.OmemoDeviceListElement_VAxolotl; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * Smack ExtensionProvider that parses OMEMO device list element into OmemoDeviceListElement objects. @@ -39,7 +41,7 @@ import org.xmlpull.v1.XmlPullParser; public class OmemoDeviceListVAxolotlProvider extends ExtensionElementProvider { @Override - public OmemoDeviceListElement_VAxolotl parse(XmlPullParser parser, int initialDepth) throws Exception { + public OmemoDeviceListElement_VAxolotl parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { Set deviceListIds = new HashSet<>(); boolean stop = false; while (!stop) { diff --git a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/provider/OmemoVAxolotlProvider.java b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/provider/OmemoVAxolotlProvider.java index 147ab2344..b4bf762c8 100644 --- a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/provider/OmemoVAxolotlProvider.java +++ b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/provider/OmemoVAxolotlProvider.java @@ -21,6 +21,7 @@ import static org.jivesoftware.smackx.omemo.element.OmemoElement.NAME_ENCRYPTED; import static org.xmlpull.v1.XmlPullParser.END_TAG; import static org.xmlpull.v1.XmlPullParser.START_TAG; +import java.io.IOException; import java.util.ArrayList; import org.jivesoftware.smack.provider.ExtensionElementProvider; @@ -31,6 +32,7 @@ import org.jivesoftware.smackx.omemo.element.OmemoHeaderElement_VAxolotl; import org.jivesoftware.smackx.omemo.element.OmemoKeyElement; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * Smack ExtensionProvider that parses incoming OMEMO Message element into OmemoMessageElement objects. @@ -40,7 +42,7 @@ import org.xmlpull.v1.XmlPullParser; public class OmemoVAxolotlProvider extends ExtensionElementProvider { @Override - public OmemoElement_VAxolotl parse(XmlPullParser parser, int initialDepth) throws Exception { + public OmemoElement_VAxolotl parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { boolean inEncrypted = true; int sid = -1; ArrayList keys = new ArrayList<>(); diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/provider/CryptElementProvider.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/provider/CryptElementProvider.java index 26b1fe8ab..830a76964 100644 --- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/provider/CryptElementProvider.java +++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/provider/CryptElementProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2017 Florian Schmaus. + * Copyright 2017-2019 Florian Schmaus. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,13 @@ */ package org.jivesoftware.smackx.ox.provider; +import java.io.IOException; +import java.text.ParseException; + import org.jivesoftware.smackx.ox.element.CryptElement; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * {@link org.jivesoftware.smack.provider.ExtensionElementProvider} implementation for the {@link CryptElement}. @@ -28,8 +32,7 @@ public class CryptElementProvider extends OpenPgpContentElementProvider to = new HashSet<>(); Date timestamp = null; String rpad = null; diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/provider/OpenPgpElementProvider.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/provider/OpenPgpElementProvider.java index 163c09a7c..582f8ef7c 100644 --- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/provider/OpenPgpElementProvider.java +++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/provider/OpenPgpElementProvider.java @@ -1,6 +1,6 @@ /** * - * Copyright 2017 Florian Schmaus. + * Copyright 2017-2019 Florian Schmaus. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,13 @@ */ package org.jivesoftware.smackx.ox.provider; +import java.io.IOException; + import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.ox.element.OpenPgpElement; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * {@link ExtensionElementProvider} implementation for the {@link OpenPgpElement}. @@ -29,7 +32,7 @@ public class OpenPgpElementProvider extends ExtensionElementProvider { public static final PublicKeysListElementProvider TEST_INSTANCE = new PublicKeysListElementProvider(); @Override - public PublicKeysListElement parse(XmlPullParser parser, int initialDepth) throws Exception { + public PublicKeysListElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { PublicKeysListElement.Builder builder = PublicKeysListElement.builder(); diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/provider/SecretkeyElementProvider.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/provider/SecretkeyElementProvider.java index 12a6aad1a..c99b3ba35 100644 --- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/provider/SecretkeyElementProvider.java +++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/provider/SecretkeyElementProvider.java @@ -16,12 +16,14 @@ */ package org.jivesoftware.smackx.ox.provider; +import java.io.IOException; import java.nio.charset.Charset; import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.ox.element.SecretkeyElement; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * {@link ExtensionElementProvider} implementation for the {@link SecretkeyElement}. @@ -31,7 +33,7 @@ public class SecretkeyElementProvider extends ExtensionElementProvider