mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-23 02:58:00 +01:00
Make AbstractDelayInformationProvider handle empty string as reason
This commit is contained in:
parent
28629e0e7f
commit
229e526f6d
1 changed files with 13 additions and 3 deletions
|
@ -31,11 +31,21 @@ public abstract class AbstractDelayInformationProvider implements PacketExtensio
|
||||||
String from = parser.getAttributeValue("", "from");
|
String from = parser.getAttributeValue("", "from");
|
||||||
String reason = null;
|
String reason = null;
|
||||||
if (!parser.isEmptyElementTag()) {
|
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();
|
parser.next();
|
||||||
assert(parser.getEventType() == XmlPullParser.TEXT);
|
|
||||||
reason = parser.getText();
|
|
||||||
}
|
}
|
||||||
parser.next();
|
|
||||||
assert(parser.getEventType() == XmlPullParser.END_TAG);
|
assert(parser.getEventType() == XmlPullParser.END_TAG);
|
||||||
Date stamp = parseDate(stampString);
|
Date stamp = parseDate(stampString);
|
||||||
return new DelayInformation(stamp, from, reason);
|
return new DelayInformation(stamp, from, reason);
|
||||||
|
|
Loading…
Reference in a new issue