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:
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 reason = null;
|
||||
if (!parser.isEmptyElementTag()) {
|
||||
parser.next();
|
||||
assert(parser.getEventType() == XmlPullParser.TEXT);
|
||||
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.END_TAG);
|
||||
Date stamp = parseDate(stampString);
|
||||
return new DelayInformation(stamp, from, reason);
|
||||
|
|
Loading…
Reference in a new issue