mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 09:09:38 +02:00
Rework exceptions in the parsing / provider subsystem
This commit is contained in:
parent
4c42d0cd32
commit
083dac8b83
130 changed files with 504 additions and 342 deletions
|
@ -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);
|
||||
|
|
|
@ -42,7 +42,7 @@ public class IoTFieldsExtensionProvider extends ExtensionElementProvider<IoTFiel
|
|||
private static final Logger LOGGER = Logger.getLogger(IoTFieldsExtensionProvider.class.getName());
|
||||
|
||||
@Override
|
||||
public IoTFieldsExtension parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||
public IoTFieldsExtension parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException, ParseException {
|
||||
int seqNr = ParserUtils.getIntegerAttributeOrThrow(parser, "seqnr", "IoT data request <accepted/> without sequence number");
|
||||
boolean done = ParserUtils.getBooleanAttribute(parser, "done", false);
|
||||
List<NodeElement> nodes = new ArrayList<>();
|
||||
|
|
|
@ -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<IoTClaimed> {
|
||||
|
||||
@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);
|
||||
|
|
|
@ -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<IoTDisown> {
|
||||
|
||||
@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);
|
||||
|
|
|
@ -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<IoTDisowned> {
|
||||
|
||||
@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);
|
||||
}
|
||||
|
|
|
@ -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<IoTRegister> {
|
||||
|
||||
@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<Tag> tags = new ArrayList<>();
|
||||
|
|
|
@ -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<IoTRemove> {
|
||||
|
||||
@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);
|
||||
|
|
|
@ -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<IoTRemoved> {
|
||||
|
||||
@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);
|
||||
}
|
||||
|
|
|
@ -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<IoTUnregister> {
|
||||
|
||||
@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);
|
||||
}
|
||||
|
|
|
@ -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<ClearCache> {
|
||||
|
||||
@Override
|
||||
public ClearCache parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||
public ClearCache parse(XmlPullParser parser, int initialDepth) {
|
||||
return new ClearCache();
|
||||
}
|
||||
|
||||
|
|
|
@ -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<ClearCacheResponse> {
|
||||
|
||||
@Override
|
||||
public ClearCacheResponse parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||
public ClearCacheResponse parse(XmlPullParser parser, int initialDepth) {
|
||||
return new ClearCacheResponse();
|
||||
}
|
||||
|
||||
|
|
|
@ -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<IoTIsFriend> {
|
||||
|
||||
@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);
|
||||
}
|
||||
|
|
|
@ -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<IoTIsFriendResponse> {
|
||||
|
||||
@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");
|
||||
|
|
|
@ -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<Unfriend> {
|
||||
|
||||
@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);
|
||||
}
|
||||
|
|
|
@ -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<Checksum> {
|
||||
@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) {
|
||||
|
|
|
@ -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<JingleFileTransfer> {
|
||||
|
||||
@Override
|
||||
public JingleFileTransfer parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||
public JingleFileTransfer parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException {
|
||||
ArrayList<JingleContentDescriptionChildElement> payloads = new ArrayList<>();
|
||||
boolean inRange = false;
|
||||
JingleFileTransferChild.Builder builder = JingleFileTransferChild.getBuilder();
|
||||
|
|
|
@ -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<J extends AbstractJsonPacket
|
|||
|
||||
@Override
|
||||
public J parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException,
|
||||
IOException, SmackException {
|
||||
IOException {
|
||||
String json = PacketParserUtils.parseElementText(parser);
|
||||
return from(json);
|
||||
}
|
||||
|
|
|
@ -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.smack.util.ParserUtils;
|
||||
|
||||
|
@ -24,6 +27,7 @@ import org.jivesoftware.smackx.rsm.packet.RSMSet;
|
|||
import org.jivesoftware.smackx.rsm.provider.RSMSetProvider;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/**
|
||||
* MAM Fin IQ Provider class.
|
||||
|
@ -36,7 +40,7 @@ import org.xmlpull.v1.XmlPullParser;
|
|||
public class MamFinIQProvider extends IQProvider<MamFinIQ> {
|
||||
|
||||
@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);
|
||||
|
|
|
@ -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<MamQueryIQ> {
|
||||
|
||||
@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");
|
||||
|
|
|
@ -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<MamResultExtension> {
|
||||
|
||||
@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");
|
||||
|
|
|
@ -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<MarkupElement> {
|
||||
|
||||
@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<MarkupElemen
|
|||
case ListElement.ELEMENT:
|
||||
MarkupElement.Builder.ListBuilder listBuilder = markup.beginList();
|
||||
if (lis.size() > 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++) {
|
||||
|
|
|
@ -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<AffiliationsChangeExtension> {
|
||||
|
||||
@Override
|
||||
public AffiliationsChangeExtension parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||
public AffiliationsChangeExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
|
||||
HashMap<Jid, MUCLightAffiliation> affiliations = new HashMap<>();
|
||||
String prevVersion = null;
|
||||
String version = null;
|
||||
|
|
|
@ -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<MUCLightAffiliationsIQ> {
|
||||
|
||||
@Override
|
||||
public MUCLightAffiliationsIQ parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||
public MUCLightAffiliationsIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
|
||||
String version = null;
|
||||
HashMap<Jid, MUCLightAffiliation> occupants = new HashMap<>();
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.xmlpull.v1.XmlPullParserException;
|
|||
public class MUCLightBlockingIQProvider extends IQProvider<MUCLightBlockingIQ> {
|
||||
|
||||
@Override
|
||||
public MUCLightBlockingIQ parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||
public MUCLightBlockingIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
|
||||
HashMap<Jid, Boolean> rooms = null;
|
||||
HashMap<Jid, Boolean> users = null;
|
||||
|
||||
|
|
|
@ -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<MUCLightConfigurationIQ> {
|
||||
|
||||
@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;
|
||||
|
|
|
@ -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<ConfigurationsChangeExtension> {
|
||||
|
||||
@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;
|
||||
|
|
|
@ -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<MUCLightInfoIQ> {
|
||||
|
||||
@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<MUCLightInfoIQ> {
|
|||
return new MUCLightInfoIQ(version, new MUCLightRoomConfiguration(roomName, subject, customConfigs), occupants);
|
||||
}
|
||||
|
||||
private static HashMap<Jid, MUCLightAffiliation> iterateOccupants(XmlPullParser parser) throws Exception {
|
||||
private static HashMap<Jid, MUCLightAffiliation> iterateOccupants(XmlPullParser parser) throws XmlPullParserException, IOException {
|
||||
HashMap<Jid, MUCLightAffiliation> occupants = new HashMap<>();
|
||||
int depth = parser.getDepth();
|
||||
|
||||
|
|
|
@ -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<RemoteDisablingExtension> {
|
||||
|
||||
@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");
|
||||
|
||||
|
|
|
@ -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<ReferenceElement> {
|
||||
|
||||
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();
|
||||
|
|
|
@ -26,7 +26,7 @@ public class OriginIdProvider extends ExtensionElementProvider<OriginIdElement>
|
|||
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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class StanzaIdProvider extends ExtensionElementProvider<StanzaIdElement>
|
|||
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);
|
||||
|
|
|
@ -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<SpoilerElement> {
|
||||
|
||||
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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue