mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 00:59:39 +02:00
Introduce SmackParsingException
This commit is contained in:
parent
163ca2b009
commit
7dee3b88a2
54 changed files with 277 additions and 155 deletions
|
@ -18,9 +18,9 @@
|
|||
package org.jivesoftware.smackx.workgroup.ext.forms;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
|
||||
import org.jivesoftware.smack.packet.SimpleIQ;
|
||||
import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||
import org.jivesoftware.smack.provider.IQProvider;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class WorkgroupForm extends SimpleIQ {
|
|||
public static class InternalProvider extends IQProvider<WorkgroupForm> {
|
||||
|
||||
@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();
|
||||
|
||||
boolean done = false;
|
||||
|
|
|
@ -27,6 +27,8 @@ import java.util.Set;
|
|||
import java.util.TimeZone;
|
||||
|
||||
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.xmlpull.v1.XmlPullParser;
|
||||
|
@ -135,7 +137,7 @@ public class OccupantsInfo extends IQ {
|
|||
public static class Provider extends IQProvider<OccupantsInfo> {
|
||||
|
||||
@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"));
|
||||
|
||||
boolean done = false;
|
||||
|
@ -152,7 +154,7 @@ public class OccupantsInfo extends IQ {
|
|||
return occupantsInfo;
|
||||
}
|
||||
|
||||
private OccupantInfo parseOccupantInfo(XmlPullParser parser) throws XmlPullParserException, IOException, ParseException {
|
||||
private OccupantInfo parseOccupantInfo(XmlPullParser parser) throws XmlPullParserException, IOException, SmackTextParseException {
|
||||
|
||||
boolean done = false;
|
||||
String jid = null;
|
||||
|
@ -168,7 +170,11 @@ public class OccupantsInfo extends IQ {
|
|||
} else if (eventType == XmlPullParser.START_TAG &&
|
||||
"joined".equals(parser.getName())) {
|
||||
synchronized (UTC_FORMAT) {
|
||||
try {
|
||||
joined = UTC_FORMAT.parse(parser.nextText());
|
||||
} catch (ParseException e) {
|
||||
throw new SmackParsingException.SmackTextParseException(e);
|
||||
}
|
||||
}
|
||||
} else if (eventType == XmlPullParser.END_TAG &&
|
||||
"occupant".equals(parser.getName())) {
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
package org.jivesoftware.smackx.workgroup.packet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||
import org.jivesoftware.smack.provider.IQProvider;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
import org.jivesoftware.smack.util.ParserUtils;
|
||||
|
@ -51,7 +51,7 @@ public class OfferRequestProvider extends IQProvider<IQ> {
|
|||
// happen anytime soon.
|
||||
|
||||
@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();
|
||||
String sessionID = null;
|
||||
int timeout = -1;
|
||||
|
|
|
@ -27,6 +27,8 @@ import java.util.Set;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
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.smackx.workgroup.QueueUser;
|
||||
|
@ -145,7 +147,7 @@ public final class QueueDetails implements ExtensionElement {
|
|||
@Override
|
||||
public QueueDetails parse(XmlPullParser parser,
|
||||
int initialDepth) throws XmlPullParserException,
|
||||
IOException, ParseException {
|
||||
IOException, SmackTextParseException {
|
||||
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
|
||||
QueueDetails queueDetails = new QueueDetails();
|
||||
|
@ -176,10 +178,19 @@ public final class QueueDetails implements ExtensionElement {
|
|||
time = Integer.parseInt(parser.nextText());
|
||||
}
|
||||
else if ("join-time".equals(parser.getName())) {
|
||||
joinTime = dateFormat.parse(parser.nextText());
|
||||
try {
|
||||
joinTime = dateFormat.parse(parser.nextText());
|
||||
} catch (ParseException e) {
|
||||
throw new SmackParsingException.SmackTextParseException(e);
|
||||
}
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ import java.util.Date;
|
|||
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
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.smackx.workgroup.agent.WorkgroupQueue;
|
||||
|
@ -127,7 +129,7 @@ public class QueueOverview implements ExtensionElement {
|
|||
@Override
|
||||
public QueueOverview parse(XmlPullParser parser,
|
||||
int initialDepth) throws XmlPullParserException,
|
||||
IOException, ParseException {
|
||||
IOException, SmackTextParseException {
|
||||
int eventType = parser.getEventType();
|
||||
QueueOverview queueOverview = new QueueOverview();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
|
||||
|
@ -142,7 +144,11 @@ public class QueueOverview implements ExtensionElement {
|
|||
queueOverview.setAverageWaitTime(Integer.parseInt(parser.nextText()));
|
||||
}
|
||||
else if ("oldest".equals(parser.getName())) {
|
||||
queueOverview.setOldestEntry(dateFormat.parse(parser.nextText()));
|
||||
try {
|
||||
queueOverview.setOldestEntry(dateFormat.parse(parser.nextText()));
|
||||
} catch (ParseException e) {
|
||||
throw new SmackParsingException.SmackTextParseException(e);
|
||||
}
|
||||
}
|
||||
else if ("status".equals(parser.getName())) {
|
||||
queueOverview.setStatus(WorkgroupQueue.Status.fromString(parser.nextText()));
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
package org.jivesoftware.smackx.workgroup.packet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||
import org.jivesoftware.smack.provider.IQProvider;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
||||
|
@ -37,7 +37,7 @@ import org.xmlpull.v1.XmlPullParserException;
|
|||
public class TranscriptProvider extends IQProvider<Transcript> {
|
||||
|
||||
@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");
|
||||
List<Stanza> packets = new ArrayList<>();
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
package org.jivesoftware.smackx.workgroup.packet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
|
||||
import org.jivesoftware.smack.packet.SimpleIQ;
|
||||
import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||
import org.jivesoftware.smack.provider.IQProvider;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class TranscriptSearch extends SimpleIQ {
|
|||
public static class Provider extends IQProvider<TranscriptSearch> {
|
||||
|
||||
@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();
|
||||
|
||||
boolean done = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue