mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-09-19 06:09:32 +02:00
Rework exceptions in the parsing / provider subsystem
This commit is contained in:
parent
4c42d0cd32
commit
083dac8b83
|
@ -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) {
|
||||
|
|
|
@ -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<Failure> {
|
||||
|
||||
|
@ -36,7 +39,7 @@ public final class FailureProvider extends NonzaProvider<Failure> {
|
|||
}
|
||||
|
||||
@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;
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()."
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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<Bind> {
|
||||
|
||||
@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) {
|
||||
|
|
|
@ -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<Message.Body> {
|
||||
|
||||
@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);
|
||||
|
||||
|
|
|
@ -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<PE extends ExtensionElement> extends ExtensionElementProvider<PE> {
|
||||
|
||||
@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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<E extends Element> {
|
|||
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<E extends Element> {
|
|||
return e;
|
||||
}
|
||||
|
||||
public abstract E parse(XmlPullParser parser, int initialDepth) throws Exception;
|
||||
public abstract E parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException;
|
||||
}
|
||||
|
|
|
@ -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<TlsProceed> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TlsProceed parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||
public TlsProceed parse(XmlPullParser parser, int initialDepth) {
|
||||
return TlsProceed.INSTANCE;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<TlsFailure> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TlsFailure parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||
public TlsFailure parse(XmlPullParser parser, int initialDepth) {
|
||||
return TlsFailure.INSTANCE;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<ExtensionElement> extensions = new ArrayList<>();
|
||||
Map<String, String> 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<String, String> descriptiveTexts = null;
|
||||
List<ExtensionElement> 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<ExtensionElement> 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<ExtensionElement> collection,
|
||||
XmlPullParser parser) throws Exception {
|
||||
public static void addExtensionElement(Collection<ExtensionElement> collection, XmlPullParser parser)
|
||||
throws XmlPullParserException, IOException, ParseException {
|
||||
addExtensionElement(collection, parser, parser.getName(), parser.getNamespace());
|
||||
}
|
||||
|
||||
public static void addExtensionElement(Collection<ExtensionElement> collection,
|
||||
XmlPullParser parser, String elementName, String namespace)
|
||||
throws Exception {
|
||||
public static void addExtensionElement(Collection<ExtensionElement> collection, XmlPullParser parser,
|
||||
String elementName, String namespace) throws XmlPullParserException, IOException, ParseException {
|
||||
ExtensionElement packetExtension = parseExtensionElement(elementName, namespace, parser);
|
||||
collection.add(packetExtension);
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<CarbonExtens
|
|||
private static final ForwardedProvider FORWARDED_PROVIDER = new ForwardedProvider();
|
||||
|
||||
@Override
|
||||
public CarbonExtension parse(XmlPullParser parser, int initialDepth)
|
||||
throws Exception {
|
||||
public CarbonExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException {
|
||||
Direction dir = Direction.valueOf(parser.getName());
|
||||
Forwarded fwd = null;
|
||||
|
||||
|
@ -52,8 +54,10 @@ public class CarbonManagerProvider extends ExtensionElementProvider<CarbonExtens
|
|||
else if (eventType == XmlPullParser.END_TAG && dir == Direction.valueOf(parser.getName()))
|
||||
done = true;
|
||||
}
|
||||
if (fwd == null)
|
||||
throw new SmackException("sent/received must contain exactly one <forwarded> tag");
|
||||
if (fwd == null) {
|
||||
// TODO: Should be SmackParseException.
|
||||
throw new IOException("sent/received must contain exactly one <forwarded> tag");
|
||||
}
|
||||
return new CarbonExtension(dir, fwd);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.xmlpull.v1.XmlPullParser;
|
|||
public class AcknowledgedProvider extends ExtensionElementProvider<AcknowledgedExtension> {
|
||||
|
||||
@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);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.xmlpull.v1.XmlPullParser;
|
|||
public class DisplayedProvider extends ExtensionElementProvider<DisplayedExtension> {
|
||||
|
||||
@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);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.xmlpull.v1.XmlPullParser;
|
|||
public class MarkableProvider extends ExtensionElementProvider<MarkableExtension> {
|
||||
|
||||
@Override
|
||||
public MarkableExtension parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||
public MarkableExtension parse(XmlPullParser parser, int initialDepth) {
|
||||
return MarkableExtension.INSTANCE;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.xmlpull.v1.XmlPullParser;
|
|||
public class ReceivedProvider extends ExtensionElementProvider<ReceivedExtension> {
|
||||
|
||||
@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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<ExplicitMessageEncryptionElement> {
|
||||
|
||||
@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);
|
||||
|
|
|
@ -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<HashElement> {
|
||||
|
||||
@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);
|
||||
|
|
|
@ -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<H extends MessageProcessingHint> extends ExtensionElementProvider<H> {
|
||||
|
||||
@Override
|
||||
public H parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||
public H parse(XmlPullParser parser, int initialDepth) {
|
||||
return getHint();
|
||||
}
|
||||
|
||||
|
|
|
@ -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<H extends AbstractHttpOverXmp
|
|||
*
|
||||
* @param parser parser
|
||||
* @return HeadersExtension or null if no headers
|
||||
* @throws Exception
|
||||
* @throws ParseException
|
||||
* @throws XmlPullParserException
|
||||
* @throws IOException
|
||||
*/
|
||||
protected HeadersExtension parseHeaders(XmlPullParser parser) throws Exception {
|
||||
protected HeadersExtension parseHeaders(XmlPullParser parser) throws IOException, XmlPullParserException, ParseException {
|
||||
HeadersExtension headersExtension = null;
|
||||
/* We are either at start of headers, start of data or end of req/res */
|
||||
if (parser.next() == XmlPullParser.START_TAG && parser.getName().equals(HeadersExtension.ELEMENT)) {
|
||||
|
|
|
@ -16,12 +16,16 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.hoxt.provider;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
|
||||
import org.jivesoftware.smack.util.ParserUtils;
|
||||
|
||||
import org.jivesoftware.smackx.hoxt.packet.HttpMethod;
|
||||
import org.jivesoftware.smackx.hoxt.packet.HttpOverXmppReq;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/**
|
||||
* Req stanza provider.
|
||||
|
@ -36,7 +40,7 @@ public class HttpOverXmppReqProvider extends AbstractHttpOverXmppProvider<HttpOv
|
|||
private static final String ATTRIBUTE_MAX_CHUNK_SIZE = "maxChunkSize";
|
||||
|
||||
@Override
|
||||
public HttpOverXmppReq parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||
public HttpOverXmppReq parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException, ParseException {
|
||||
HttpOverXmppReq.Builder builder = HttpOverXmppReq.builder();
|
||||
builder.setResource(parser.getAttributeValue("", ATTRIBUTE_RESOURCE));
|
||||
builder.setVersion(parser.getAttributeValue("", ATTRIBUTE_VERSION));
|
||||
|
|
|
@ -16,11 +16,15 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.hoxt.provider;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
|
||||
import org.jivesoftware.smackx.hoxt.packet.AbstractHttpOverXmpp;
|
||||
import org.jivesoftware.smackx.hoxt.packet.HttpOverXmppResp;
|
||||
import org.jivesoftware.smackx.shim.packet.HeadersExtension;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/**
|
||||
* Resp stanza provider.
|
||||
|
@ -34,7 +38,7 @@ public class HttpOverXmppRespProvider extends AbstractHttpOverXmppProvider<HttpO
|
|||
private static final String ATTRIBUTE_STATUS_CODE = "statusCode";
|
||||
|
||||
@Override
|
||||
public HttpOverXmppResp parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||
public HttpOverXmppResp parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException, ParseException {
|
||||
String version = parser.getAttributeValue("", ATTRIBUTE_VERSION);
|
||||
String statusMessage = parser.getAttributeValue("", ATTRIBUTE_STATUS_MESSAGE);
|
||||
String statusCodeString = parser.getAttributeValue("", ATTRIBUTE_STATUS_CODE);
|
||||
|
|
|
@ -16,12 +16,15 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.httpfileupload.provider;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||
|
||||
import org.jivesoftware.smackx.httpfileupload.element.FileTooLargeError;
|
||||
import org.jivesoftware.smackx.httpfileupload.element.FileTooLargeError_V0_2;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/**
|
||||
* Provider for File Too Large error extension.
|
||||
|
@ -32,7 +35,7 @@ import org.xmlpull.v1.XmlPullParser;
|
|||
public class FileTooLargeErrorProvider extends ExtensionElementProvider<FileTooLargeError> {
|
||||
|
||||
@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;
|
||||
|
||||
|
|
|
@ -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<Slot> {
|
||||
|
||||
@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);
|
||||
|
|
|
@ -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<IoTSetRequest> {
|
||||
|
||||
@Override
|
||||
public IoTSetRequest parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||
public IoTSetRequest parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
|
||||
List<SetData> data = new ArrayList<>(4);
|
||||
outerloop: while (true) {
|
||||
final int eventType = parser.next();
|
||||
|
|
|
@ -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<IoTSetResponse> {
|
||||
|
||||
@Override
|
||||
public IoTSetResponse parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||
public IoTSetResponse parse(XmlPullParser parser, int initialDepth) {
|
||||
return new IoTSetResponse();
|
||||
}
|
||||
|
||||
|
|
|
@ -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<IoTDataReadOutAccepted> {
|
||||
|
||||
@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 <accepted/> without sequence number");
|
||||
boolean queued = ParserUtils.getBooleanAttribute(parser, "queued", false);
|
||||
return new IoTDataReadOutAccepted(seqNr, queued);
|
||||
|
|
|
@ -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<IoTDataRequest> {
|
||||
|
||||
@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) |