AnsweredAssumed Answered

Smack 4.0.4 - XmlPullParserException for gtalk MUC message (user status)

Question asked by ccitro on Oct 21, 2014
Latest reply on Oct 22, 2014 by ccitro

When joining a MUC with a user who is using Google Talk, PacketParserUtils will throw a XmlPullParserException.  Here is a log of the message which causes the exception, and the traceback.

 

10:18:43 AM RCV  (1910846198): <message from="otheruser@gmail.com" to="myuser@gmail.com" type="chat" id="14FD4351"><cha:inactive xmlns:cha="http://jabber.org/protocol/chatstates"/></message>

10:18:43 AM RCV  (1910846198): <message type="groupchat" from="private-chat-4c96c498-5b95-4534-be8d-47f10878142c@groupchat.google.com" to="myuser@gmail.com/Smack3696397D"><body><user:x xmlns:user="http://jabber.org/protocol/muc#user"><user:item nick="494d6dbca32b6c6d" status="available" jid="otheruser@gmail.com/gmail.2161CE02"/></user:x></body><nos:x value="disabled" xmlns:nos="google:nosave"/><arc:record otr="false" xmlns:arc="http://jabber.org/protocol/archive"/></message>

10:18:43 AM SENT (1910846198): </stream:stream>

10:18:43 AM XMPPConnection closed due to an exception (1910846198)

org.xmlpull.v1.XmlPullParserException: Non-empty element tag not followed by text, while Mixed Content (XML 3.2.2) is disallowed

        at org.jivesoftware.smack.util.PacketParserUtils.parseElementText(PacketParserUtil s.java:193)

        at org.jivesoftware.smack.util.PacketParserUtils.parseMessage(PacketParserUtils.ja va:130)

        at org.jivesoftware.smack.tcp.PacketReader.parsePackets(PacketReader.java:156)

        at org.jivesoftware.smack.tcp.PacketReader.access$000(PacketReader.java:47)

        at org.jivesoftware.smack.tcp.PacketReader$1.run(PacketReader.java:81)

 

 

It looks like the issue is caused by Google including XML inside the <body> tag, which the parser does not allow.  It may be that Google is violating the spec here, but even if they are, I'm not sure it should cause an exception to be thrown (which causes a disconnect/reconnect of the connection). 

 

Is there some way to catch/handle this exception or message type?  I'm using smack 4.0.4, with a XMPPTCPConnection, using core, extensions, and tcp. 

Outcomes