1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-12-17 00:11: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

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