mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-26 08:12:05 +01:00
Make presence parsing more robust
by allowing 'show' to be an empty element: '<show />'
This commit is contained in:
parent
218dc66cf7
commit
5a5524623c
1 changed files with 12 additions and 1 deletions
|
@ -439,7 +439,18 @@ public class PacketParserUtils {
|
||||||
}
|
}
|
||||||
else if (elementName.equals("show")) {
|
else if (elementName.equals("show")) {
|
||||||
String modeText = parser.nextText();
|
String modeText = parser.nextText();
|
||||||
|
if (StringUtils.isNotEmpty(modeText)) {
|
||||||
presence.setMode(Presence.Mode.fromString(modeText));
|
presence.setMode(Presence.Mode.fromString(modeText));
|
||||||
|
} else {
|
||||||
|
// Some implementations send presence stanzas with a
|
||||||
|
// '<show />' element, which is a invalid XMPP presence
|
||||||
|
// stanza according to RFC 6121 4.7.2.1
|
||||||
|
LOGGER.warning("Empty or null mode text in presence show element form "
|
||||||
|
+ presence.getFrom()
|
||||||
|
+ " with id '"
|
||||||
|
+ presence.getPacketID()
|
||||||
|
+ "' which is invalid according to RFC6121 4.7.2.1");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (elementName.equals("error")) {
|
else if (elementName.equals("error")) {
|
||||||
presence.setError(parseError(parser));
|
presence.setError(parseError(parser));
|
||||||
|
|
Loading…
Reference in a new issue