1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 20:12:07 +01:00

Introduce SmackParsingException

This commit is contained in:
Florian Schmaus 2019-02-10 19:01:47 +01:00
parent 163ca2b009
commit 7dee3b88a2
54 changed files with 277 additions and 155 deletions

View file

@ -33,7 +33,6 @@ import java.security.SecureRandom;
import java.security.Security; import java.security.Security;
import java.security.UnrecoverableKeyException; import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException; import java.security.cert.CertificateException;
import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
@ -106,6 +105,7 @@ import org.jivesoftware.smack.packet.StreamError;
import org.jivesoftware.smack.packet.StreamOpen; import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smack.packet.TopLevelStreamElement; import org.jivesoftware.smack.packet.TopLevelStreamElement;
import org.jivesoftware.smack.parsing.ParsingExceptionCallback; import org.jivesoftware.smack.parsing.ParsingExceptionCallback;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.provider.NonzaProvider; import org.jivesoftware.smack.provider.NonzaProvider;
import org.jivesoftware.smack.provider.ProviderManager; import org.jivesoftware.smack.provider.ProviderManager;
@ -1167,7 +1167,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
return successNonza; return successNonza;
} }
protected final void parseAndProcessNonza(XmlPullParser parser) throws IOException, XmlPullParserException, ParseException { protected final void parseAndProcessNonza(XmlPullParser parser) throws IOException, XmlPullParserException, SmackParsingException {
final String element = parser.getName(); final String element = parser.getName();
final String namespace = parser.getNamespace(); final String namespace = parser.getNamespace();
final String key = XmppStringUtils.generateKey(element, namespace); final String key = XmppStringUtils.generateKey(element, namespace);
@ -1567,7 +1567,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
return this.fromMode; return this.fromMode;
} }
protected final void parseFeatures(XmlPullParser parser) throws XmlPullParserException, IOException, ParseException { protected final void parseFeatures(XmlPullParser parser) throws XmlPullParserException, IOException, SmackParsingException {
streamFeatures.clear(); streamFeatures.clear();
final int initialDepth = parser.getDepth(); final int initialDepth = parser.getDepth();
while (true) { while (true) {

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2018 Florian Schmaus * Copyright 2018-2019 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -17,12 +17,12 @@
package org.jivesoftware.smack.compress.provider; package org.jivesoftware.smack.compress.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.compress.packet.Failure; import org.jivesoftware.smack.compress.packet.Failure;
import org.jivesoftware.smack.packet.StanzaError; import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.packet.StreamOpen; import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.NonzaProvider; import org.jivesoftware.smack.provider.NonzaProvider;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
@ -39,7 +39,7 @@ public final class FailureProvider extends NonzaProvider<Failure> {
} }
@Override @Override
public Failure parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public Failure parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
Failure.CompressFailureError compressFailureError = null; Failure.CompressFailureError compressFailureError = null;
StanzaError stanzaError = null; StanzaError stanzaError = null;

View file

@ -17,7 +17,6 @@
package org.jivesoftware.smack.fsm; package org.jivesoftware.smack.fsm;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -51,6 +50,7 @@ import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Presence; import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.packet.StreamError; import org.jivesoftware.smack.packet.StreamError;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.sasl.SASLErrorException; import org.jivesoftware.smack.sasl.SASLErrorException;
import org.jivesoftware.smack.sasl.SASLMechanism; import org.jivesoftware.smack.sasl.SASLMechanism;
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.Challenge; import org.jivesoftware.smack.sasl.packet.SaslStreamElements.Challenge;
@ -304,7 +304,7 @@ public abstract class AbstractXmppStateMachineConnection extends AbstractXMPPCon
} }
protected final void parseAndProcessElement(String element) throws XmlPullParserException, IOException, protected final void parseAndProcessElement(String element) throws XmlPullParserException, IOException,
InterruptedException, StreamErrorException, SmackException, ParseException { InterruptedException, StreamErrorException, SmackException, SmackParsingException {
XmlPullParser parser = PacketParserUtils.getParserFor(element); XmlPullParser parser = PacketParserUtils.getParserFor(element);
// Skip the enclosing stream open what is guaranteed to be there. // Skip the enclosing stream open what is guaranteed to be there.

View file

@ -0,0 +1,54 @@
/**
*
* Copyright 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smack.parsing;
import java.net.URISyntaxException;
import java.text.ParseException;
public class SmackParsingException extends Exception {
/**
*
*/
private static final long serialVersionUID = 1L;
protected SmackParsingException(Exception exception) {
super(exception);
}
public static class SmackTextParseException extends SmackParsingException {
/**
*
*/
private static final long serialVersionUID = 1L;
public SmackTextParseException(ParseException parsingException) {
super(parsingException);
}
}
public static class SmackUriSyntaxParsingException extends SmackParsingException {
/**
*
*/
private static final long serialVersionUID = 1L;
public SmackUriSyntaxParsingException(URISyntaxException uriSyntaxException) {
super(uriSyntaxException);
}
}
}

View file

@ -17,13 +17,13 @@
package org.jivesoftware.smack.provider; package org.jivesoftware.smack.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
@ -85,7 +85,7 @@ import org.xmlpull.v1.XmlPullParserException;
public abstract class EmbeddedExtensionProvider<PE extends ExtensionElement> extends ExtensionElementProvider<PE> { public abstract class EmbeddedExtensionProvider<PE extends ExtensionElement> extends ExtensionElementProvider<PE> {
@Override @Override
public final PE parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public final PE parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
final String namespace = parser.getNamespace(); final String namespace = parser.getNamespace();
final String name = parser.getName(); final String name = parser.getName();
final int attributeCount = parser.getAttributeCount(); final int attributeCount = parser.getAttributeCount();

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright © 2014-2018 Florian Schmaus * Copyright © 2014-2019 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -20,9 +20,9 @@ package org.jivesoftware.smack.provider;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.ParameterizedType; import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.text.ParseException;
import org.jivesoftware.smack.packet.Element; import org.jivesoftware.smack.packet.Element;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smack.util.ParserUtils;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
@ -61,7 +61,7 @@ public abstract class Provider<E extends Element> {
return elementClass; return elementClass;
} }
public final E parse(XmlPullParser parser) throws IOException, XmlPullParserException, ParseException { public final E parse(XmlPullParser parser) throws IOException, XmlPullParserException, SmackParsingException {
// XPP3 calling convention assert: Parser should be at start tag // XPP3 calling convention assert: Parser should be at start tag
ParserUtils.assertAtStartTag(parser); ParserUtils.assertAtStartTag(parser);
@ -73,5 +73,5 @@ public abstract class Provider<E extends Element> {
return e; return e;
} }
public abstract E parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException; public abstract E parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException;
} }

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2003-2007 Jive Software. * Copyright 2003-2007 Jive Software, 2019 Florian Schmaus.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -19,7 +19,6 @@ package org.jivesoftware.smack.util;
import java.io.IOException; import java.io.IOException;
import java.io.Reader; import java.io.Reader;
import java.io.StringReader; import java.io.StringReader;
import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
@ -43,6 +42,7 @@ import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.packet.StartTls; import org.jivesoftware.smack.packet.StartTls;
import org.jivesoftware.smack.packet.StreamError; import org.jivesoftware.smack.packet.StreamError;
import org.jivesoftware.smack.packet.UnparsedIQ; import org.jivesoftware.smack.packet.UnparsedIQ;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.parsing.StandardExtensionElementProvider; import org.jivesoftware.smack.parsing.StandardExtensionElementProvider;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
@ -218,9 +218,9 @@ public class PacketParserUtils {
* @return a Message packet. * @return a Message packet.
* @throws XmlPullParserException * @throws XmlPullParserException
* @throws IOException * @throws IOException
* @throws ParseException * @throws SmackParsingException
*/ */
public static Message parseMessage(XmlPullParser parser) throws XmlPullParserException, IOException, ParseException { public static Message parseMessage(XmlPullParser parser) throws XmlPullParserException, IOException, SmackParsingException {
ParserUtils.assertAtStartTag(parser); ParserUtils.assertAtStartTag(parser);
assert (parser.getName().equals(Message.ELEMENT)); assert (parser.getName().equals(Message.ELEMENT));
@ -504,9 +504,9 @@ public class PacketParserUtils {
* @return a Presence packet. * @return a Presence packet.
* @throws IOException * @throws IOException
* @throws XmlPullParserException * @throws XmlPullParserException
* @throws ParseException * @throws SmackParsingException
*/ */
public static Presence parsePresence(XmlPullParser parser) throws XmlPullParserException, IOException, ParseException { public static Presence parsePresence(XmlPullParser parser) throws XmlPullParserException, IOException, SmackParsingException {
ParserUtils.assertAtStartTag(parser); ParserUtils.assertAtStartTag(parser);
final int initialDepth = parser.getDepth(); final int initialDepth = parser.getDepth();
@ -791,9 +791,9 @@ public class PacketParserUtils {
* @return an stream error packet. * @return an stream error packet.
* @throws IOException * @throws IOException
* @throws XmlPullParserException * @throws XmlPullParserException
* @throws ParseException * @throws SmackParsingException
*/ */
public static StreamError parseStreamError(XmlPullParser parser) throws XmlPullParserException, IOException, ParseException { public static StreamError parseStreamError(XmlPullParser parser) throws XmlPullParserException, IOException, SmackParsingException {
final int initialDepth = parser.getDepth(); final int initialDepth = parser.getDepth();
List<ExtensionElement> extensions = new ArrayList<>(); List<ExtensionElement> extensions = new ArrayList<>();
Map<String, String> descriptiveTexts = null; Map<String, String> descriptiveTexts = null;
@ -843,9 +843,9 @@ public class PacketParserUtils {
* @return an error sub-packet. * @return an error sub-packet.
* @throws IOException * @throws IOException
* @throws XmlPullParserException * @throws XmlPullParserException
* @throws ParseException * @throws SmackParsingException
*/ */
public static StanzaError.Builder parseError(XmlPullParser parser) throws XmlPullParserException, IOException, ParseException { public static StanzaError.Builder parseError(XmlPullParser parser) throws XmlPullParserException, IOException, SmackParsingException {
final int initialDepth = parser.getDepth(); final int initialDepth = parser.getDepth();
Map<String, String> descriptiveTexts = null; Map<String, String> descriptiveTexts = null;
List<ExtensionElement> extensions = new ArrayList<>(); List<ExtensionElement> extensions = new ArrayList<>();
@ -916,10 +916,10 @@ public class PacketParserUtils {
* @return an extension element. * @return an extension element.
* @throws XmlPullParserException * @throws XmlPullParserException
* @throws IOException * @throws IOException
* @throws ParseException * @throws SmackParsingException
*/ */
public static ExtensionElement parseExtensionElement(String elementName, String namespace, public static ExtensionElement parseExtensionElement(String elementName, String namespace,
XmlPullParser parser) throws XmlPullParserException, IOException, ParseException { XmlPullParser parser) throws XmlPullParserException, IOException, SmackParsingException {
ParserUtils.assertAtStartTag(parser); ParserUtils.assertAtStartTag(parser);
// See if a provider is registered to handle the extension. // See if a provider is registered to handle the extension.
ExtensionElementProvider<ExtensionElement> provider = ProviderManager.getExtensionProvider(elementName, namespace); ExtensionElementProvider<ExtensionElement> provider = ProviderManager.getExtensionProvider(elementName, namespace);
@ -988,24 +988,24 @@ public class PacketParserUtils {
} }
public static void addExtensionElement(Stanza packet, XmlPullParser parser) public static void addExtensionElement(Stanza packet, XmlPullParser parser)
throws XmlPullParserException, IOException, ParseException { throws XmlPullParserException, IOException, SmackParsingException {
ParserUtils.assertAtStartTag(parser); ParserUtils.assertAtStartTag(parser);
addExtensionElement(packet, parser, parser.getName(), parser.getNamespace()); addExtensionElement(packet, parser, parser.getName(), parser.getNamespace());
} }
public static void addExtensionElement(Stanza packet, XmlPullParser parser, String elementName, public static void addExtensionElement(Stanza packet, XmlPullParser parser, String elementName,
String namespace) throws XmlPullParserException, IOException, ParseException { String namespace) throws XmlPullParserException, IOException, SmackParsingException {
ExtensionElement packetExtension = parseExtensionElement(elementName, namespace, parser); ExtensionElement packetExtension = parseExtensionElement(elementName, namespace, parser);
packet.addExtension(packetExtension); packet.addExtension(packetExtension);
} }
public static void addExtensionElement(Collection<ExtensionElement> collection, XmlPullParser parser) public static void addExtensionElement(Collection<ExtensionElement> collection, XmlPullParser parser)
throws XmlPullParserException, IOException, ParseException { throws XmlPullParserException, IOException, SmackParsingException {
addExtensionElement(collection, parser, parser.getName(), parser.getNamespace()); addExtensionElement(collection, parser, parser.getName(), parser.getNamespace());
} }
public static void addExtensionElement(Collection<ExtensionElement> collection, XmlPullParser parser, public static void addExtensionElement(Collection<ExtensionElement> collection, XmlPullParser parser,
String elementName, String namespace) throws XmlPullParserException, IOException, ParseException { String elementName, String namespace) throws XmlPullParserException, IOException, SmackParsingException {
ExtensionElement packetExtension = parseExtensionElement(elementName, namespace, parser); ExtensionElement packetExtension = parseExtensionElement(elementName, namespace, parser);
collection.add(packetExtension); collection.add(packetExtension);
} }

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright © 2014-2018 Florian Schmaus * Copyright © 2014-2019 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -26,6 +26,10 @@ import java.util.Locale;
import javax.xml.XMLConstants; import javax.xml.XMLConstants;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackUriSyntaxParsingException;
import org.jxmpp.jid.EntityBareJid; import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.EntityFullJid; import org.jxmpp.jid.EntityFullJid;
import org.jxmpp.jid.EntityJid; import org.jxmpp.jid.EntityJid;
@ -261,19 +265,41 @@ public class ParserUtils {
return s; return s;
} }
public static Date getDateFromNextText(XmlPullParser parser) throws XmlPullParserException, IOException, ParseException { public static Date getDateFromOptionalXep82String(String dateString) throws SmackTextParseException {
String dateString = parser.nextText(); if (dateString == null) {
return XmppDateTime.parseDate(dateString); return null;
}
return getDateFromXep82String(dateString);
} }
public static URI getUriFromNextText(XmlPullParser parser) throws XmlPullParserException, IOException { public static Date getDateFromXep82String(String dateString) throws SmackTextParseException {
try {
return XmppDateTime.parseXEP0082Date(dateString);
} catch (ParseException e) {
throw new SmackParsingException.SmackTextParseException(e);
}
}
public static Date getDateFromString(String dateString) throws SmackTextParseException {
try {
return XmppDateTime.parseDate(dateString);
} catch (ParseException e) {
throw new SmackParsingException.SmackTextParseException(e);
}
}
public static Date getDateFromNextText(XmlPullParser parser) throws XmlPullParserException, IOException, SmackTextParseException {
String dateString = parser.nextText();
return getDateFromString(dateString);
}
public static URI getUriFromNextText(XmlPullParser parser) throws XmlPullParserException, IOException, SmackUriSyntaxParsingException {
String uriString = parser.nextText(); String uriString = parser.nextText();
try { try {
return new URI(uriString); return new URI(uriString);
} }
catch (URISyntaxException e) { catch (URISyntaxException e) {
// TODO: Should be SmackParseException (or subclass of). throw new SmackParsingException.SmackUriSyntaxParsingException(e);
throw new IOException(e);
} }
} }

View file

@ -17,8 +17,8 @@
package org.jivesoftware.smackx.carbons.provider; package org.jivesoftware.smackx.carbons.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.carbons.packet.CarbonExtension; import org.jivesoftware.smackx.carbons.packet.CarbonExtension;
@ -41,7 +41,7 @@ public class CarbonManagerProvider extends ExtensionElementProvider<CarbonExtens
private static final ForwardedProvider FORWARDED_PROVIDER = new ForwardedProvider(); private static final ForwardedProvider FORWARDED_PROVIDER = new ForwardedProvider();
@Override @Override
public CarbonExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public CarbonExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
Direction dir = Direction.valueOf(parser.getName()); Direction dir = Direction.valueOf(parser.getName());
Forwarded fwd = null; Forwarded fwd = null;

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2014 Andriy Tsykholyas, 2015 Florian Schmaus * Copyright 2014 Andriy Tsykholyas, 2015-2019 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -17,9 +17,9 @@
package org.jivesoftware.smackx.hoxt.provider; package org.jivesoftware.smackx.hoxt.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.packet.NamedElement; import org.jivesoftware.smack.packet.NamedElement;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
@ -56,11 +56,11 @@ public abstract class AbstractHttpOverXmppProvider<H extends AbstractHttpOverXmp
* *
* @param parser parser * @param parser parser
* @return HeadersExtension or null if no headers * @return HeadersExtension or null if no headers
* @throws ParseException
* @throws XmlPullParserException * @throws XmlPullParserException
* @throws IOException * @throws IOException
* @throws SmackParsingException
*/ */
protected HeadersExtension parseHeaders(XmlPullParser parser) throws IOException, XmlPullParserException, ParseException { protected HeadersExtension parseHeaders(XmlPullParser parser) throws IOException, XmlPullParserException, SmackParsingException {
HeadersExtension headersExtension = null; HeadersExtension headersExtension = null;
/* We are either at start of headers, start of data or end of req/res */ /* 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)) { if (parser.next() == XmlPullParser.START_TAG && parser.getName().equals(HeadersExtension.ELEMENT)) {

View file

@ -17,8 +17,8 @@
package org.jivesoftware.smackx.hoxt.provider; package org.jivesoftware.smackx.hoxt.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smackx.hoxt.packet.HttpMethod; import org.jivesoftware.smackx.hoxt.packet.HttpMethod;
@ -40,7 +40,7 @@ public class HttpOverXmppReqProvider extends AbstractHttpOverXmppProvider<HttpOv
private static final String ATTRIBUTE_MAX_CHUNK_SIZE = "maxChunkSize"; private static final String ATTRIBUTE_MAX_CHUNK_SIZE = "maxChunkSize";
@Override @Override
public HttpOverXmppReq parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException, ParseException { public HttpOverXmppReq parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException, SmackParsingException {
HttpOverXmppReq.Builder builder = HttpOverXmppReq.builder(); HttpOverXmppReq.Builder builder = HttpOverXmppReq.builder();
builder.setResource(parser.getAttributeValue("", ATTRIBUTE_RESOURCE)); builder.setResource(parser.getAttributeValue("", ATTRIBUTE_RESOURCE));
builder.setVersion(parser.getAttributeValue("", ATTRIBUTE_VERSION)); builder.setVersion(parser.getAttributeValue("", ATTRIBUTE_VERSION));

View file

@ -17,8 +17,8 @@
package org.jivesoftware.smackx.hoxt.provider; package org.jivesoftware.smackx.hoxt.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smackx.hoxt.packet.AbstractHttpOverXmpp; import org.jivesoftware.smackx.hoxt.packet.AbstractHttpOverXmpp;
import org.jivesoftware.smackx.hoxt.packet.HttpOverXmppResp; import org.jivesoftware.smackx.hoxt.packet.HttpOverXmppResp;
import org.jivesoftware.smackx.shim.packet.HeadersExtension; import org.jivesoftware.smackx.shim.packet.HeadersExtension;
@ -38,7 +38,7 @@ public class HttpOverXmppRespProvider extends AbstractHttpOverXmppProvider<HttpO
private static final String ATTRIBUTE_STATUS_CODE = "statusCode"; private static final String ATTRIBUTE_STATUS_CODE = "statusCode";
@Override @Override
public HttpOverXmppResp parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException, ParseException { public HttpOverXmppResp parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException, SmackParsingException {
String version = parser.getAttributeValue("", ATTRIBUTE_VERSION); String version = parser.getAttributeValue("", ATTRIBUTE_VERSION);
String statusMessage = parser.getAttributeValue("", ATTRIBUTE_STATUS_MESSAGE); String statusMessage = parser.getAttributeValue("", ATTRIBUTE_STATUS_MESSAGE);
String statusCodeString = parser.getAttributeValue("", ATTRIBUTE_STATUS_CODE); String statusCodeString = parser.getAttributeValue("", ATTRIBUTE_STATUS_CODE);

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright © 2016 Florian Schmaus * Copyright © 2016-2019 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -23,6 +23,8 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smack.util.ParserUtils;
@ -42,7 +44,7 @@ public class IoTFieldsExtensionProvider extends ExtensionElementProvider<IoTFiel
private static final Logger LOGGER = Logger.getLogger(IoTFieldsExtensionProvider.class.getName()); private static final Logger LOGGER = Logger.getLogger(IoTFieldsExtensionProvider.class.getName());
@Override @Override
public IoTFieldsExtension parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException, ParseException { public IoTFieldsExtension parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException, SmackTextParseException {
int seqNr = ParserUtils.getIntegerAttributeOrThrow(parser, "seqnr", "IoT data request <accepted/> without sequence number"); int seqNr = ParserUtils.getIntegerAttributeOrThrow(parser, "seqnr", "IoT data request <accepted/> without sequence number");
boolean done = ParserUtils.getBooleanAttribute(parser, "done", false); boolean done = ParserUtils.getBooleanAttribute(parser, "done", false);
List<NodeElement> nodes = new ArrayList<>(); List<NodeElement> nodes = new ArrayList<>();
@ -68,7 +70,7 @@ public class IoTFieldsExtensionProvider extends ExtensionElementProvider<IoTFiel
return new IoTFieldsExtension(seqNr, done, nodes); return new IoTFieldsExtension(seqNr, done, nodes);
} }
public NodeElement parseNode(XmlPullParser parser) throws XmlPullParserException, IOException, ParseException { public NodeElement parseNode(XmlPullParser parser) throws XmlPullParserException, IOException, SmackTextParseException {
final int initialDepth = parser.getDepth(); final int initialDepth = parser.getDepth();
final NodeInfo nodeInfo = NodeInfoParser.parse(parser); final NodeInfo nodeInfo = NodeInfoParser.parse(parser);
List<TimestampElement> timestampElements = new ArrayList<>(); List<TimestampElement> timestampElements = new ArrayList<>();
@ -94,10 +96,15 @@ public class IoTFieldsExtensionProvider extends ExtensionElementProvider<IoTFiel
return new NodeElement(nodeInfo, timestampElements); return new NodeElement(nodeInfo, timestampElements);
} }
public TimestampElement parseTimestampElement(XmlPullParser parser) throws ParseException, XmlPullParserException, IOException { public TimestampElement parseTimestampElement(XmlPullParser parser) throws XmlPullParserException, IOException, SmackTextParseException {
final int initialDepth = parser.getDepth(); final int initialDepth = parser.getDepth();
final String dateString = parser.getAttributeValue(null, "value"); final String dateString = parser.getAttributeValue(null, "value");
final Date date = XmppDateTime.parseDate(dateString); Date date;
try {
date = XmppDateTime.parseDate(dateString);
} catch (ParseException e) {
throw new SmackParsingException.SmackTextParseException(e);
}
List<IoTDataField> fields = new ArrayList<>(); List<IoTDataField> fields = new ArrayList<>();
outerloop: while (true) { outerloop: while (true) {
final int eventType = parser.next(); final int eventType = parser.next();

View file

@ -20,8 +20,8 @@ import static org.xmlpull.v1.XmlPullParser.END_TAG;
import static org.xmlpull.v1.XmlPullParser.START_TAG; import static org.xmlpull.v1.XmlPullParser.START_TAG;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.hashes.element.HashElement; import org.jivesoftware.smackx.hashes.element.HashElement;
import org.jivesoftware.smackx.hashes.provider.HashElementProvider; import org.jivesoftware.smackx.hashes.provider.HashElementProvider;
@ -38,7 +38,7 @@ import org.xmlpull.v1.XmlPullParserException;
*/ */
public class ChecksumProvider extends ExtensionElementProvider<Checksum> { public class ChecksumProvider extends ExtensionElementProvider<Checksum> {
@Override @Override
public Checksum parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public Checksum parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
JingleContent.Creator creator = null; JingleContent.Creator creator = null;
String creatorString = parser.getAttributeValue(null, Checksum.ATTR_CREATOR); String creatorString = parser.getAttributeValue(null, Checksum.ATTR_CREATOR);
if (creatorString != null) { if (creatorString != null) {

View file

@ -23,6 +23,7 @@ import java.io.IOException;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smackx.hashes.element.HashElement; import org.jivesoftware.smackx.hashes.element.HashElement;
import org.jivesoftware.smackx.hashes.provider.HashElementProvider; import org.jivesoftware.smackx.hashes.provider.HashElementProvider;
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement; import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
@ -42,7 +43,7 @@ public class JingleFileTransferProvider
extends JingleContentDescriptionProvider<JingleFileTransfer> { extends JingleContentDescriptionProvider<JingleFileTransfer> {
@Override @Override
public JingleFileTransfer parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public JingleFileTransfer parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
ArrayList<JingleContentDescriptionChildElement> payloads = new ArrayList<>(); ArrayList<JingleContentDescriptionChildElement> payloads = new ArrayList<>();
boolean inRange = false; boolean inRange = false;
JingleFileTransferChild.Builder builder = JingleFileTransferChild.getBuilder(); JingleFileTransferChild.Builder builder = JingleFileTransferChild.getBuilder();
@ -59,7 +60,11 @@ public class JingleFileTransferProvider
if (tag == START_TAG) { if (tag == START_TAG) {
switch (elem) { switch (elem) {
case JingleFileTransferChild.ELEM_DATE: case JingleFileTransferChild.ELEM_DATE:
try {
builder.setDate(XmppDateTime.parseXEP0082Date(parser.nextText())); builder.setDate(XmppDateTime.parseXEP0082Date(parser.nextText()));
} catch (ParseException e) {
throw new SmackParsingException.SmackTextParseException(e);
}
break; break;
case JingleFileTransferChild.ELEM_DESC: case JingleFileTransferChild.ELEM_DESC:

View file

@ -17,8 +17,8 @@
package org.jivesoftware.smackx.mam.provider; package org.jivesoftware.smackx.mam.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smack.util.ParserUtils;
@ -40,7 +40,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class MamFinIQProvider extends IQProvider<MamFinIQ> { public class MamFinIQProvider extends IQProvider<MamFinIQ> {
@Override @Override
public MamFinIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public MamFinIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
String queryId = parser.getAttributeValue("", "queryid"); String queryId = parser.getAttributeValue("", "queryid");
boolean complete = ParserUtils.getBooleanAttribute(parser, "complete", false); boolean complete = ParserUtils.getBooleanAttribute(parser, "complete", false);
boolean stable = ParserUtils.getBooleanAttribute(parser, "stable", true); boolean stable = ParserUtils.getBooleanAttribute(parser, "stable", true);

View file

@ -17,8 +17,8 @@
package org.jivesoftware.smackx.mam.provider; package org.jivesoftware.smackx.mam.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.mam.element.MamQueryIQ; import org.jivesoftware.smackx.mam.element.MamQueryIQ;
@ -40,7 +40,7 @@ public class MamQueryIQProvider extends IQProvider<MamQueryIQ> {
@Override @Override
public MamQueryIQ parse(XmlPullParser parser, int initialDepth) public MamQueryIQ parse(XmlPullParser parser, int initialDepth)
throws XmlPullParserException, IOException, ParseException { throws XmlPullParserException, IOException, SmackParsingException {
DataForm dataForm = null; DataForm dataForm = null;
String queryId = parser.getAttributeValue("", "queryid"); String queryId = parser.getAttributeValue("", "queryid");
String node = parser.getAttributeValue("", "node"); String node = parser.getAttributeValue("", "node");

View file

@ -17,8 +17,8 @@
package org.jivesoftware.smackx.mam.provider; package org.jivesoftware.smackx.mam.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.forward.packet.Forwarded; import org.jivesoftware.smackx.forward.packet.Forwarded;
@ -39,7 +39,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class MamResultProvider extends ExtensionElementProvider<MamResultExtension> { public class MamResultProvider extends ExtensionElementProvider<MamResultExtension> {
@Override @Override
public MamResultExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public MamResultExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
Forwarded forwarded = null; Forwarded forwarded = null;
String queryId = parser.getAttributeValue("", "queryid"); String queryId = parser.getAttributeValue("", "queryid");
String id = parser.getAttributeValue("", "id"); String id = parser.getAttributeValue("", "id");

View file

@ -19,9 +19,9 @@ package org.jivesoftware.smackx.reference.provider;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.text.ParseException;
import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.provider.ProviderManager; import org.jivesoftware.smack.provider.ProviderManager;
import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smack.util.ParserUtils;
@ -35,7 +35,7 @@ public class ReferenceProvider extends ExtensionElementProvider<ReferenceElement
public static final ReferenceProvider TEST_PROVIDER = new ReferenceProvider(); public static final ReferenceProvider TEST_PROVIDER = new ReferenceProvider();
@Override @Override
public ReferenceElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public ReferenceElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
Integer begin = ParserUtils.getIntegerAttribute(parser, ReferenceElement.ATTR_BEGIN); Integer begin = ParserUtils.getIntegerAttribute(parser, ReferenceElement.ATTR_BEGIN);
Integer end = ParserUtils.getIntegerAttribute(parser, ReferenceElement.ATTR_END); Integer end = ParserUtils.getIntegerAttribute(parser, ReferenceElement.ATTR_END);
String typeString = parser.getAttributeValue(null, ReferenceElement.ATTR_TYPE); String typeString = parser.getAttributeValue(null, ReferenceElement.ATTR_TYPE);

View file

@ -17,8 +17,8 @@
package org.jivesoftware.smackx.bytestreams.ibb.provider; package org.jivesoftware.smackx.bytestreams.ibb.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smackx.bytestreams.ibb.packet.Data; import org.jivesoftware.smackx.bytestreams.ibb.packet.Data;
import org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtension; import org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtension;
@ -39,7 +39,7 @@ public class DataPacketProvider {
@Override @Override
public Data parse(XmlPullParser parser, int initialDepth) public Data parse(XmlPullParser parser, int initialDepth)
throws IOException, XmlPullParserException, ParseException { throws IOException, XmlPullParserException, SmackParsingException {
DataPacketExtension data = packetExtensionProvider.parse(parser); DataPacketExtension data = packetExtensionProvider.parse(parser);
return new Data(data); return new Data(data);
} }

View file

@ -18,9 +18,9 @@
package org.jivesoftware.smackx.commands.provider; package org.jivesoftware.smackx.commands.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.packet.StanzaError; import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
@ -42,7 +42,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class AdHocCommandDataProvider extends IQProvider<AdHocCommandData> { public class AdHocCommandDataProvider extends IQProvider<AdHocCommandData> {
@Override @Override
public AdHocCommandData parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public AdHocCommandData parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
boolean done = false; boolean done = false;
AdHocCommandData adHocCommandData = new AdHocCommandData(); AdHocCommandData adHocCommandData = new AdHocCommandData();
DataFormProvider dataFormProvider = new DataFormProvider(); DataFormProvider dataFormProvider = new DataFormProvider();

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright © 2014 Florian Schmaus * Copyright © 2014-2019 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -17,9 +17,9 @@
package org.jivesoftware.smackx.delay.provider; package org.jivesoftware.smackx.delay.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.util.Date; import java.util.Date;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.delay.packet.DelayInformation; import org.jivesoftware.smackx.delay.packet.DelayInformation;
@ -32,7 +32,7 @@ public abstract class AbstractDelayInformationProvider extends ExtensionElementP
@Override @Override
public final DelayInformation parse(XmlPullParser parser, public final DelayInformation parse(XmlPullParser parser,
int initialDepth) throws XmlPullParserException, int initialDepth) throws XmlPullParserException,
IOException, ParseException { IOException, SmackTextParseException {
String stampString = (parser.getAttributeValue("", "stamp")); String stampString = (parser.getAttributeValue("", "stamp"));
String from = parser.getAttributeValue("", "from"); String from = parser.getAttributeValue("", "from");
String reason = null; String reason = null;
@ -58,5 +58,5 @@ public abstract class AbstractDelayInformationProvider extends ExtensionElementP
return new DelayInformation(stamp, from, reason); return new DelayInformation(stamp, from, reason);
} }
protected abstract Date parseDate(String string) throws ParseException; protected abstract Date parseDate(String string) throws SmackTextParseException;
} }

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright © 2014 Florian Schmaus * Copyright © 2014-2019 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,10 +16,10 @@
*/ */
package org.jivesoftware.smackx.delay.provider; package org.jivesoftware.smackx.delay.provider;
import java.text.ParseException;
import java.util.Date; import java.util.Date;
import org.jxmpp.util.XmppDateTime; import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
import org.jivesoftware.smack.util.ParserUtils;
/** /**
* The DelayInformationProvider parses DelayInformation packets. * The DelayInformationProvider parses DelayInformation packets.
@ -31,8 +31,8 @@ public class DelayInformationProvider extends AbstractDelayInformationProvider {
public static final DelayInformationProvider INSTANCE = new DelayInformationProvider(); public static final DelayInformationProvider INSTANCE = new DelayInformationProvider();
@Override @Override
protected Date parseDate(String string) throws ParseException { protected Date parseDate(String string) throws SmackTextParseException {
return XmppDateTime.parseXEP0082Date(string); return ParserUtils.getDateFromXep82String(string);
} }
} }

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright © 2014 Florian Schmaus * Copyright © 2014-2019 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,10 +16,10 @@
*/ */
package org.jivesoftware.smackx.delay.provider; package org.jivesoftware.smackx.delay.provider;
import java.text.ParseException;
import java.util.Date; import java.util.Date;
import org.jxmpp.util.XmppDateTime; import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
import org.jivesoftware.smack.util.ParserUtils;
/** /**
* The DelayInformationProvider parses DelayInformation packets. * The DelayInformationProvider parses DelayInformation packets.
@ -29,8 +29,8 @@ import org.jxmpp.util.XmppDateTime;
public class LegacyDelayInformationProvider extends AbstractDelayInformationProvider { public class LegacyDelayInformationProvider extends AbstractDelayInformationProvider {
@Override @Override
protected Date parseDate(String string) throws ParseException { protected Date parseDate(String string) throws SmackTextParseException {
return XmppDateTime.parseDate(string); return ParserUtils.getDateFromString(string);
} }
} }

View file

@ -18,8 +18,8 @@
package org.jivesoftware.smackx.disco.provider; package org.jivesoftware.smackx.disco.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
@ -36,7 +36,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class DiscoverInfoProvider extends IQProvider<DiscoverInfo> { public class DiscoverInfoProvider extends IQProvider<DiscoverInfo> {
@Override @Override
public DiscoverInfo parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public DiscoverInfo parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
DiscoverInfo discoverInfo = new DiscoverInfo(); DiscoverInfo discoverInfo = new DiscoverInfo();
boolean done = false; boolean done = false;
DiscoverInfo.Identity identity; DiscoverInfo.Identity identity;

View file

@ -17,11 +17,11 @@
package org.jivesoftware.smackx.forward.provider; package org.jivesoftware.smackx.forward.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
@ -45,7 +45,7 @@ public class ForwardedProvider extends ExtensionElementProvider<Forwarded> {
private static final Logger LOGGER = Logger.getLogger(ForwardedProvider.class.getName()); private static final Logger LOGGER = Logger.getLogger(ForwardedProvider.class.getName());
@Override @Override
public Forwarded parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public Forwarded parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
DelayInformation di = null; DelayInformation di = null;
Stanza packet = null; Stanza packet = null;

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2015-2017 Ishan Khanna, Fernando Ramirez * Copyright 2015-2017 Ishan Khanna, Fernando Ramirez, 2019 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -17,8 +17,9 @@
package org.jivesoftware.smackx.geoloc.provider; package org.jivesoftware.smackx.geoloc.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackUriSyntaxParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smack.util.ParserUtils;
@ -31,7 +32,7 @@ public class GeoLocationProvider extends ExtensionElementProvider<GeoLocation> {
@Override @Override
public GeoLocation parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, public GeoLocation parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException,
ParseException { SmackTextParseException, SmackUriSyntaxParsingException {
GeoLocation.Builder builder = GeoLocation.builder(); GeoLocation.Builder builder = GeoLocation.builder();

View file

@ -17,7 +17,6 @@
package org.jivesoftware.smackx.iqregister.provider; package org.jivesoftware.smackx.iqregister.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -25,6 +24,7 @@ import java.util.Map;
import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
@ -36,7 +36,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class RegistrationProvider extends IQProvider<Registration> { public class RegistrationProvider extends IQProvider<Registration> {
@Override @Override
public Registration parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public Registration parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
String instruction = null; String instruction = null;
Map<String, String> fields = new HashMap<>(); Map<String, String> fields = new HashMap<>();
List<ExtensionElement> packetExtensions = new LinkedList<>(); List<ExtensionElement> packetExtensions = new LinkedList<>();

View file

@ -17,8 +17,8 @@
package org.jivesoftware.smackx.jingle.provider; package org.jivesoftware.smackx.jingle.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.jingle.element.JingleContentDescription; import org.jivesoftware.smackx.jingle.element.JingleContentDescription;
@ -30,6 +30,6 @@ public abstract class JingleContentDescriptionProvider<D extends JingleContentDe
extends ExtensionElementProvider<D> { extends ExtensionElementProvider<D> {
@Override @Override
public abstract D parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException; public abstract D parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException;
} }

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2017 Florian Schmaus * Copyright 2017-2019 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -17,10 +17,10 @@
package org.jivesoftware.smackx.jingle.provider; package org.jivesoftware.smackx.jingle.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.packet.StandardExtensionElement; import org.jivesoftware.smack.packet.StandardExtensionElement;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.parsing.StandardExtensionElementProvider; import org.jivesoftware.smack.parsing.StandardExtensionElementProvider;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smack.util.ParserUtils;
@ -44,7 +44,7 @@ public class JingleProvider extends IQProvider<Jingle> {
private static final Logger LOGGER = Logger.getLogger(JingleProvider.class.getName()); private static final Logger LOGGER = Logger.getLogger(JingleProvider.class.getName());
@Override @Override
public Jingle parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public Jingle parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
Jingle.Builder builder = Jingle.getBuilder(); Jingle.Builder builder = Jingle.getBuilder();
String actionString = parser.getAttributeValue("", Jingle.ACTION_ATTRIBUTE_NAME); String actionString = parser.getAttributeValue("", Jingle.ACTION_ATTRIBUTE_NAME);
@ -102,7 +102,7 @@ public class JingleProvider extends IQProvider<Jingle> {
} }
public static JingleContent parseJingleContent(XmlPullParser parser, final int initialDepth) public static JingleContent parseJingleContent(XmlPullParser parser, final int initialDepth)
throws XmlPullParserException, IOException, ParseException { throws XmlPullParserException, IOException, SmackParsingException {
JingleContent.Builder builder = JingleContent.getBuilder(); JingleContent.Builder builder = JingleContent.getBuilder();
String creatorString = parser.getAttributeValue("", JingleContent.CREATOR_ATTRIBUTE_NAME); String creatorString = parser.getAttributeValue("", JingleContent.CREATOR_ATTRIBUTE_NAME);

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright © 2018 Paul Schaub * Copyright © 2018 Paul Schaub, 2019 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -19,6 +19,8 @@ package org.jivesoftware.smackx.last_interaction.provider;
import java.text.ParseException; import java.text.ParseException;
import java.util.Date; import java.util.Date;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.last_interaction.element.IdleElement; import org.jivesoftware.smackx.last_interaction.element.IdleElement;
@ -30,9 +32,14 @@ public class IdleProvider extends ExtensionElementProvider<IdleElement> {
public static final IdleProvider TEST_INSTANCE = new IdleProvider(); public static final IdleProvider TEST_INSTANCE = new IdleProvider();
@Override @Override
public IdleElement parse(XmlPullParser parser, int initialDepth) throws ParseException { public IdleElement parse(XmlPullParser parser, int initialDepth) throws SmackTextParseException {
String dateString = parser.getAttributeValue(null, IdleElement.ATTR_SINCE); String dateString = parser.getAttributeValue(null, IdleElement.ATTR_SINCE);
Date since = XmppDateTime.parseXEP0082Date(dateString); Date since;
try {
since = XmppDateTime.parseXEP0082Date(dateString);
} catch (ParseException e) {
throw new SmackParsingException.SmackTextParseException(e);
}
return new IdleElement(since); return new IdleElement(since);
} }
} }

View file

@ -17,7 +17,6 @@
package org.jivesoftware.smackx.mood.provider; package org.jivesoftware.smackx.mood.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.mood.element.MoodConcretisation; import org.jivesoftware.smackx.mood.element.MoodConcretisation;
@ -28,5 +27,5 @@ import org.xmlpull.v1.XmlPullParserException;
public abstract class MoodConcretisationProvider<C extends MoodConcretisation> extends ExtensionElementProvider<C> { public abstract class MoodConcretisationProvider<C extends MoodConcretisation> extends ExtensionElementProvider<C> {
@Override @Override
public abstract C parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException, ParseException; public abstract C parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException;
} }

View file

@ -20,10 +20,10 @@ import static org.xmlpull.v1.XmlPullParser.END_TAG;
import static org.xmlpull.v1.XmlPullParser.START_TAG; import static org.xmlpull.v1.XmlPullParser.START_TAG;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.provider.ProviderManager; import org.jivesoftware.smack.provider.ProviderManager;
import org.jivesoftware.smackx.mood.Mood; import org.jivesoftware.smackx.mood.Mood;
@ -40,7 +40,7 @@ public class MoodProvider extends ExtensionElementProvider<MoodElement> {
@Override @Override
public MoodElement parse(XmlPullParser parser, int initialDepth) public MoodElement parse(XmlPullParser parser, int initialDepth)
throws XmlPullParserException, IOException, ParseException { throws XmlPullParserException, IOException, SmackParsingException {
String text = null; String text = null;
Mood mood = null; Mood mood = null;
MoodConcretisation concretisation = null; MoodConcretisation concretisation = null;

View file

@ -17,7 +17,6 @@
package org.jivesoftware.smackx.mood.provider; package org.jivesoftware.smackx.mood.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smackx.mood.element.MoodConcretisation; import org.jivesoftware.smackx.mood.element.MoodConcretisation;
@ -34,7 +33,7 @@ import org.xmlpull.v1.XmlPullParserException;
public abstract class SimpleMoodConcretisationProvider<C extends MoodConcretisation> extends MoodConcretisationProvider<C> { public abstract class SimpleMoodConcretisationProvider<C extends MoodConcretisation> extends MoodConcretisationProvider<C> {
@Override @Override
public C parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException, ParseException { public C parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException {
// Since the elements name and namespace is known, we can just return an instance of the MoodConcretisation. // Since the elements name and namespace is known, we can just return an instance of the MoodConcretisation.
return simpleExtension(); return simpleExtension();
} }

View file

@ -18,8 +18,8 @@
package org.jivesoftware.smackx.muc.provider; package org.jivesoftware.smackx.muc.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
@ -36,7 +36,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class MUCOwnerProvider extends IQProvider<MUCOwner> { public class MUCOwnerProvider extends IQProvider<MUCOwner> {
@Override @Override
public MUCOwner parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public MUCOwner parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
MUCOwner mucOwner = new MUCOwner(); MUCOwner mucOwner = new MUCOwner();
boolean done = false; boolean done = false;
while (!done) { while (!done) {

View file

@ -17,9 +17,9 @@
package org.jivesoftware.smackx.pubsub.provider; package org.jivesoftware.smackx.pubsub.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.provider.ProviderManager; import org.jivesoftware.smack.provider.ProviderManager;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
@ -44,7 +44,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class ItemProvider extends ExtensionElementProvider<Item> { public class ItemProvider extends ExtensionElementProvider<Item> {
@Override @Override
public Item parse(XmlPullParser parser, int initialDepth) public Item parse(XmlPullParser parser, int initialDepth)
throws XmlPullParserException, IOException, ParseException { throws XmlPullParserException, IOException, SmackParsingException {
String id = parser.getAttributeValue(null, "id"); String id = parser.getAttributeValue(null, "id");
String node = parser.getAttributeValue(null, "node"); String node = parser.getAttributeValue(null, "node");
String xmlns = parser.getNamespace(); String xmlns = parser.getNamespace();

View file

@ -17,9 +17,9 @@
package org.jivesoftware.smackx.pubsub.provider; package org.jivesoftware.smackx.pubsub.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
@ -37,7 +37,7 @@ import org.xmlpull.v1.XmlPullParserException;
*/ */
public class PubSubProvider extends IQProvider<PubSub> { public class PubSubProvider extends IQProvider<PubSub> {
@Override @Override
public PubSub parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public PubSub parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
String namespace = parser.getNamespace(); String namespace = parser.getNamespace();
PubSubNamespace pubSubNamespace = PubSubNamespace.valueOfFromXmlns(namespace); PubSubNamespace pubSubNamespace = PubSubNamespace.valueOfFromXmlns(namespace);
PubSub pubsub = new PubSub(pubSubNamespace); PubSub pubsub = new PubSub(pubSubNamespace);

View file

@ -17,7 +17,6 @@
package org.jivesoftware.smackx.search; package org.jivesoftware.smackx.search;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
@ -25,6 +24,7 @@ import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.SimpleIQ; import org.jivesoftware.smack.packet.SimpleIQ;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
@ -129,7 +129,7 @@ public class UserSearch extends SimpleIQ {
// FIXME this provider does return two different types of IQs // FIXME this provider does return two different types of IQs
@Override @Override
public IQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public IQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
UserSearch search = null; UserSearch search = null;
SimpleUserSearch simpleUserSearch = new SimpleUserSearch(); SimpleUserSearch simpleUserSearch = new SimpleUserSearch();
@ -164,7 +164,7 @@ public class UserSearch extends SimpleIQ {
} }
private static void buildDataForm(SimpleUserSearch search, private static void buildDataForm(SimpleUserSearch search,
String instructions, XmlPullParser parser) throws XmlPullParserException, IOException, ParseException { String instructions, XmlPullParser parser) throws XmlPullParserException, IOException, SmackParsingException {
DataForm dataForm = new DataForm(DataForm.Type.form); DataForm dataForm = new DataForm(DataForm.Type.form);
boolean done = false; boolean done = false;
dataForm.setTitle("User Search"); dataForm.setTitle("User Search");

View file

@ -22,6 +22,7 @@ import java.util.Date;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.si.packet.StreamInitiation; import org.jivesoftware.smackx.si.packet.StreamInitiation;
@ -43,7 +44,7 @@ public class StreamInitiationProvider extends IQProvider<StreamInitiation> {
private static final Logger LOGGER = Logger.getLogger(StreamInitiationProvider.class.getName()); private static final Logger LOGGER = Logger.getLogger(StreamInitiationProvider.class.getName());
@Override @Override
public StreamInitiation parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public StreamInitiation parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
boolean done = false; boolean done = false;
// si // si

View file

@ -18,10 +18,10 @@
package org.jivesoftware.smackx.xdata.provider; package org.jivesoftware.smackx.xdata.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.roster.packet.RosterPacket; import org.jivesoftware.smack.roster.packet.RosterPacket;
import org.jivesoftware.smack.roster.provider.RosterPacketProvider; import org.jivesoftware.smack.roster.provider.RosterPacketProvider;
@ -46,7 +46,7 @@ public class DataFormProvider extends ExtensionElementProvider<DataForm> {
public static final DataFormProvider INSTANCE = new DataFormProvider(); public static final DataFormProvider INSTANCE = new DataFormProvider();
@Override @Override
public DataForm parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public DataForm parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
DataForm.Type dataFormType = DataForm.Type.fromString(parser.getAttributeValue("", "type")); DataForm.Type dataFormType = DataForm.Type.fromString(parser.getAttributeValue("", "type"));
DataForm dataForm = new DataForm(dataFormType); DataForm dataForm = new DataForm(dataFormType);
outerloop: while (true) { outerloop: while (true) {

View file

@ -18,8 +18,8 @@
package org.jivesoftware.smackx.jingleold.provider; package org.jivesoftware.smackx.jingleold.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smack.util.ParserUtils;
@ -44,12 +44,12 @@ public class JingleProvider extends IQProvider<Jingle> {
/** /**
* Parse a iq/jingle element. * Parse a iq/jingle element.
* @throws ParseException
* @throws XmlPullParserException * @throws XmlPullParserException
* @throws IOException * @throws IOException
* @throws SmackParsingException
*/ */
@Override @Override
public Jingle parse(XmlPullParser parser, int intialDepth) throws IOException, XmlPullParserException, ParseException { public Jingle parse(XmlPullParser parser, int intialDepth) throws IOException, XmlPullParserException, SmackParsingException {
Jingle jingle = new Jingle(); Jingle jingle = new Jingle();
String sid = ""; String sid = "";

View file

@ -18,9 +18,9 @@
package org.jivesoftware.smackx.workgroup.ext.forms; package org.jivesoftware.smackx.workgroup.ext.forms;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.packet.SimpleIQ; import org.jivesoftware.smack.packet.SimpleIQ;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
@ -51,7 +51,7 @@ public class WorkgroupForm extends SimpleIQ {
public static class InternalProvider extends IQProvider<WorkgroupForm> { public static class InternalProvider extends IQProvider<WorkgroupForm> {
@Override @Override
public WorkgroupForm parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public WorkgroupForm parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
WorkgroupForm answer = new WorkgroupForm(); WorkgroupForm answer = new WorkgroupForm();
boolean done = false; boolean done = false;

View file

@ -27,6 +27,8 @@ import java.util.Set;
import java.util.TimeZone; import java.util.TimeZone;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
@ -135,7 +137,7 @@ public class OccupantsInfo extends IQ {
public static class Provider extends IQProvider<OccupantsInfo> { public static class Provider extends IQProvider<OccupantsInfo> {
@Override @Override
public OccupantsInfo parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public OccupantsInfo parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackTextParseException {
OccupantsInfo occupantsInfo = new OccupantsInfo(parser.getAttributeValue("", "roomID")); OccupantsInfo occupantsInfo = new OccupantsInfo(parser.getAttributeValue("", "roomID"));
boolean done = false; boolean done = false;
@ -152,7 +154,7 @@ public class OccupantsInfo extends IQ {
return occupantsInfo; return occupantsInfo;
} }
private OccupantInfo parseOccupantInfo(XmlPullParser parser) throws XmlPullParserException, IOException, ParseException { private OccupantInfo parseOccupantInfo(XmlPullParser parser) throws XmlPullParserException, IOException, SmackTextParseException {
boolean done = false; boolean done = false;
String jid = null; String jid = null;
@ -168,7 +170,11 @@ public class OccupantsInfo extends IQ {
} else if (eventType == XmlPullParser.START_TAG && } else if (eventType == XmlPullParser.START_TAG &&
"joined".equals(parser.getName())) { "joined".equals(parser.getName())) {
synchronized (UTC_FORMAT) { synchronized (UTC_FORMAT) {
try {
joined = UTC_FORMAT.parse(parser.nextText()); joined = UTC_FORMAT.parse(parser.nextText());
} catch (ParseException e) {
throw new SmackParsingException.SmackTextParseException(e);
}
} }
} else if (eventType == XmlPullParser.END_TAG && } else if (eventType == XmlPullParser.END_TAG &&
"occupant".equals(parser.getName())) { "occupant".equals(parser.getName())) {

View file

@ -18,12 +18,12 @@
package org.jivesoftware.smackx.workgroup.packet; package org.jivesoftware.smackx.workgroup.packet;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smack.util.ParserUtils;
@ -51,7 +51,7 @@ public class OfferRequestProvider extends IQProvider<IQ> {
// happen anytime soon. // happen anytime soon.
@Override @Override
public OfferRequestPacket parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public OfferRequestPacket parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
int eventType = parser.getEventType(); int eventType = parser.getEventType();
String sessionID = null; String sessionID = null;
int timeout = -1; int timeout = -1;

View file

@ -27,6 +27,8 @@ import java.util.Set;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.workgroup.QueueUser; import org.jivesoftware.smackx.workgroup.QueueUser;
@ -145,7 +147,7 @@ public final class QueueDetails implements ExtensionElement {
@Override @Override
public QueueDetails parse(XmlPullParser parser, public QueueDetails parse(XmlPullParser parser,
int initialDepth) throws XmlPullParserException, int initialDepth) throws XmlPullParserException,
IOException, ParseException { IOException, SmackTextParseException {
SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT); SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
QueueDetails queueDetails = new QueueDetails(); QueueDetails queueDetails = new QueueDetails();
@ -176,10 +178,19 @@ public final class QueueDetails implements ExtensionElement {
time = Integer.parseInt(parser.nextText()); time = Integer.parseInt(parser.nextText());
} }
else if ("join-time".equals(parser.getName())) { else if ("join-time".equals(parser.getName())) {
try {
joinTime = dateFormat.parse(parser.nextText()); joinTime = dateFormat.parse(parser.nextText());
} catch (ParseException e) {
throw new SmackParsingException.SmackTextParseException(e);
}
} }
else if (parser.getName().equals("waitTime")) { else if (parser.getName().equals("waitTime")) {
Date wait = dateFormat.parse(parser.nextText()); Date wait;
try {
wait = dateFormat.parse(parser.nextText());
} catch (ParseException e) {
throw new SmackParsingException.SmackTextParseException(e);
}
LOGGER.fine(wait.toString()); LOGGER.fine(wait.toString());
} }

View file

@ -24,6 +24,8 @@ import java.util.Date;
import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.XmlEnvironment; import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.workgroup.agent.WorkgroupQueue; import org.jivesoftware.smackx.workgroup.agent.WorkgroupQueue;
@ -127,7 +129,7 @@ public class QueueOverview implements ExtensionElement {
@Override @Override
public QueueOverview parse(XmlPullParser parser, public QueueOverview parse(XmlPullParser parser,
int initialDepth) throws XmlPullParserException, int initialDepth) throws XmlPullParserException,
IOException, ParseException { IOException, SmackTextParseException {
int eventType = parser.getEventType(); int eventType = parser.getEventType();
QueueOverview queueOverview = new QueueOverview(); QueueOverview queueOverview = new QueueOverview();
SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT); SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
@ -142,7 +144,11 @@ public class QueueOverview implements ExtensionElement {
queueOverview.setAverageWaitTime(Integer.parseInt(parser.nextText())); queueOverview.setAverageWaitTime(Integer.parseInt(parser.nextText()));
} }
else if ("oldest".equals(parser.getName())) { else if ("oldest".equals(parser.getName())) {
try {
queueOverview.setOldestEntry(dateFormat.parse(parser.nextText())); queueOverview.setOldestEntry(dateFormat.parse(parser.nextText()));
} catch (ParseException e) {
throw new SmackParsingException.SmackTextParseException(e);
}
} }
else if ("status".equals(parser.getName())) { else if ("status".equals(parser.getName())) {
queueOverview.setStatus(WorkgroupQueue.Status.fromString(parser.nextText())); queueOverview.setStatus(WorkgroupQueue.Status.fromString(parser.nextText()));

View file

@ -18,11 +18,11 @@
package org.jivesoftware.smackx.workgroup.packet; package org.jivesoftware.smackx.workgroup.packet;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
@ -37,7 +37,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class TranscriptProvider extends IQProvider<Transcript> { public class TranscriptProvider extends IQProvider<Transcript> {
@Override @Override
public Transcript parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public Transcript parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
String sessionID = parser.getAttributeValue("", "sessionID"); String sessionID = parser.getAttributeValue("", "sessionID");
List<Stanza> packets = new ArrayList<>(); List<Stanza> packets = new ArrayList<>();

View file

@ -18,9 +18,9 @@
package org.jivesoftware.smackx.workgroup.packet; package org.jivesoftware.smackx.workgroup.packet;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.packet.SimpleIQ; import org.jivesoftware.smack.packet.SimpleIQ;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
@ -57,7 +57,7 @@ public class TranscriptSearch extends SimpleIQ {
public static class Provider extends IQProvider<TranscriptSearch> { public static class Provider extends IQProvider<TranscriptSearch> {
@Override @Override
public TranscriptSearch parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public TranscriptSearch parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
TranscriptSearch answer = new TranscriptSearch(); TranscriptSearch answer = new TranscriptSearch();
boolean done = false; boolean done = false;

View file

@ -17,8 +17,8 @@
package org.jivesoftware.smackx.ox.provider; package org.jivesoftware.smackx.ox.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smackx.ox.element.CryptElement; import org.jivesoftware.smackx.ox.element.CryptElement;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
@ -32,7 +32,7 @@ public class CryptElementProvider extends OpenPgpContentElementProvider<CryptEle
public static final CryptElementProvider INSTANCE = new CryptElementProvider(); public static final CryptElementProvider INSTANCE = new CryptElementProvider();
@Override @Override
public CryptElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public CryptElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
OpenPgpContentElementData data = parseOpenPgpContentElementData(parser, initialDepth); OpenPgpContentElementData data = parseOpenPgpContentElementData(parser, initialDepth);
return new CryptElement(data.to, data.rpad, data.timestamp, data.payload); return new CryptElement(data.to, data.rpad, data.timestamp, data.payload);

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2017 Florian Schmaus, 2018 Paul Schaub. * Copyright 2017-2019 Florian Schmaus, 2018 Paul Schaub.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -20,7 +20,6 @@ import static org.xmlpull.v1.XmlPullParser.END_TAG;
import static org.xmlpull.v1.XmlPullParser.START_TAG; import static org.xmlpull.v1.XmlPullParser.START_TAG;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.util.Date; import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedList; import java.util.LinkedList;
@ -30,9 +29,11 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.provider.ProviderManager; import org.jivesoftware.smack.provider.ProviderManager;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smackx.ox.element.CryptElement; import org.jivesoftware.smackx.ox.element.CryptElement;
import org.jivesoftware.smackx.ox.element.EncryptedOpenPgpContentElement; import org.jivesoftware.smackx.ox.element.EncryptedOpenPgpContentElement;
import org.jivesoftware.smackx.ox.element.OpenPgpContentElement; import org.jivesoftware.smackx.ox.element.OpenPgpContentElement;
@ -41,7 +42,6 @@ import org.jivesoftware.smackx.ox.element.SigncryptElement;
import org.jxmpp.jid.Jid; import org.jxmpp.jid.Jid;
import org.jxmpp.jid.impl.JidCreate; import org.jxmpp.jid.impl.JidCreate;
import org.jxmpp.util.XmppDateTime;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
@ -79,10 +79,10 @@ public abstract class OpenPgpContentElementProvider<O extends OpenPgpContentElem
} }
@Override @Override
public abstract O parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException; public abstract O parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException;
protected static OpenPgpContentElementData parseOpenPgpContentElementData(XmlPullParser parser, int initialDepth) protected static OpenPgpContentElementData parseOpenPgpContentElementData(XmlPullParser parser, int initialDepth)
throws XmlPullParserException, IOException, ParseException { throws XmlPullParserException, IOException, SmackParsingException {
Set<Jid> to = new HashSet<>(); Set<Jid> to = new HashSet<>();
Date timestamp = null; Date timestamp = null;
String rpad = null; String rpad = null;
@ -97,7 +97,7 @@ public abstract class OpenPgpContentElementProvider<O extends OpenPgpContentElem
case OpenPgpContentElement.ELEM_TIME: case OpenPgpContentElement.ELEM_TIME:
String stamp = parser.getAttributeValue("", OpenPgpContentElement.ATTR_STAMP); String stamp = parser.getAttributeValue("", OpenPgpContentElement.ATTR_STAMP);
timestamp = XmppDateTime.parseDate(stamp); timestamp = ParserUtils.getDateFromXep82String(stamp);
break; break;
case OpenPgpContentElement.ELEM_TO: case OpenPgpContentElement.ELEM_TO:

View file

@ -20,13 +20,13 @@ import static org.xmlpull.v1.XmlPullParser.START_TAG;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.text.ParseException;
import java.util.Date; import java.util.Date;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smackx.ox.element.PubkeyElement; import org.jivesoftware.smackx.ox.element.PubkeyElement;
import org.jxmpp.util.XmppDateTime;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
@ -38,9 +38,9 @@ public class PubkeyElementProvider extends ExtensionElementProvider<PubkeyElemen
public static final PubkeyElementProvider TEST_INSTANCE = new PubkeyElementProvider(); public static final PubkeyElementProvider TEST_INSTANCE = new PubkeyElementProvider();
@Override @Override
public PubkeyElement parse(XmlPullParser parser, int initialDepth) throws ParseException, XmlPullParserException, IOException { public PubkeyElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackTextParseException {
String dateString = parser.getAttributeValue(null, PubkeyElement.ATTR_DATE); String dateString = parser.getAttributeValue(null, PubkeyElement.ATTR_DATE);
Date date = dateString != null ? XmppDateTime.parseXEP0082Date(dateString) : null; Date date = ParserUtils.getDateFromOptionalXep82String(dateString);
while (true) { while (true) {
int tag = parser.next(); int tag = parser.next();
String name = parser.getName(); String name = parser.getName();

View file

@ -20,13 +20,13 @@ import static org.xmlpull.v1.XmlPullParser.END_TAG;
import static org.xmlpull.v1.XmlPullParser.START_TAG; import static org.xmlpull.v1.XmlPullParser.START_TAG;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.util.Date; import java.util.Date;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smackx.ox.element.PublicKeysListElement; import org.jivesoftware.smackx.ox.element.PublicKeysListElement;
import org.jxmpp.util.XmppDateTime;
import org.pgpainless.key.OpenPgpV4Fingerprint; import org.pgpainless.key.OpenPgpV4Fingerprint;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
@ -36,7 +36,7 @@ public final class PublicKeysListElementProvider extends ExtensionElementProvide
public static final PublicKeysListElementProvider TEST_INSTANCE = new PublicKeysListElementProvider(); public static final PublicKeysListElementProvider TEST_INSTANCE = new PublicKeysListElementProvider();
@Override @Override
public PublicKeysListElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public PublicKeysListElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackTextParseException {
PublicKeysListElement.Builder builder = PublicKeysListElement.builder(); PublicKeysListElement.Builder builder = PublicKeysListElement.builder();
@ -54,7 +54,7 @@ public final class PublicKeysListElementProvider extends ExtensionElementProvide
String dt = parser.getAttributeValue(null, String dt = parser.getAttributeValue(null,
PublicKeysListElement.PubkeyMetadataElement.ATTR_DATE); PublicKeysListElement.PubkeyMetadataElement.ATTR_DATE);
OpenPgpV4Fingerprint fingerprint = new OpenPgpV4Fingerprint(finger); OpenPgpV4Fingerprint fingerprint = new OpenPgpV4Fingerprint(finger);
Date date = XmppDateTime.parseXEP0082Date(dt); Date date = ParserUtils.getDateFromXep82String(dt);
builder.addMetadata(new PublicKeysListElement.PubkeyMetadataElement(fingerprint, date)); builder.addMetadata(new PublicKeysListElement.PubkeyMetadataElement(fingerprint, date));
} }
break; break;

View file

@ -17,9 +17,9 @@
package org.jivesoftware.smackx.ox.provider; package org.jivesoftware.smackx.ox.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.ox.element.SignElement; import org.jivesoftware.smackx.ox.element.SignElement;
@ -35,7 +35,7 @@ public class SignElementProvider extends OpenPgpContentElementProvider<SignEleme
public static final SignElementProvider INSTANCE = new SignElementProvider(); public static final SignElementProvider INSTANCE = new SignElementProvider();
@Override @Override
public SignElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public SignElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
OpenPgpContentElementData data = parseOpenPgpContentElementData(parser, initialDepth); OpenPgpContentElementData data = parseOpenPgpContentElementData(parser, initialDepth);
if (StringUtils.isNotEmpty(data.rpad)) { if (StringUtils.isNotEmpty(data.rpad)) {

View file

@ -17,8 +17,8 @@
package org.jivesoftware.smackx.ox.provider; package org.jivesoftware.smackx.ox.provider;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smackx.ox.element.SigncryptElement; import org.jivesoftware.smackx.ox.element.SigncryptElement;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
@ -32,7 +32,7 @@ public class SigncryptElementProvider extends OpenPgpContentElementProvider<Sign
public static final SigncryptElementProvider INSTANCE = new SigncryptElementProvider(); public static final SigncryptElementProvider INSTANCE = new SigncryptElementProvider();
@Override @Override
public SigncryptElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, ParseException { public SigncryptElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
OpenPgpContentElementData data = parseOpenPgpContentElementData(parser, initialDepth); OpenPgpContentElementData data = parseOpenPgpContentElementData(parser, initialDepth);
return new SigncryptElement(data.to, data.rpad, data.timestamp, data.payload); return new SigncryptElement(data.to, data.rpad, data.timestamp, data.payload);
} }