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

Make AbstractDelayInformationProvider handle empty string as reason

This commit is contained in:
Florian Schmaus 2014-08-21 13:13:33 +02:00
parent 28629e0e7f
commit 229e526f6d

View file

@ -31,11 +31,21 @@ public abstract class AbstractDelayInformationProvider implements PacketExtensio
String from = parser.getAttributeValue("", "from");
String reason = null;
if (!parser.isEmptyElementTag()) {
int event = parser.next();
switch (event) {
case XmlPullParser.TEXT:
reason = parser.getText();
parser.next();
break;
case XmlPullParser.END_TAG:
reason = "";
break;
default:
throw new IllegalStateException("Unexpected event: " + event);
}
} else {
parser.next();
assert(parser.getEventType() == XmlPullParser.TEXT);
reason = parser.getText();
}
parser.next();
assert(parser.getEventType() == XmlPullParser.END_TAG);
Date stamp = parseDate(stampString);
return new DelayInformation(stamp, from, reason);