mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-12-26 22:27:58 +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")) {
|
||||
String modeText = parser.nextText();
|
||||
presence.setMode(Presence.Mode.fromString(modeText));
|
||||
if (StringUtils.isNotEmpty(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")) {
|
||||
presence.setError(parseError(parser));
|
||||
|
|
Loading…
Reference in a new issue