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="" to="" type="chat" id="14FD4351"><cha:inactive xmlns:cha=""/></message>

10:18:43 AM RCV  (1910846198): <message type="groupchat" from="" to=""><body><user:x xmlns:user=""><user:item nick="494d6dbca32b6c6d" status="available" jid=""/></user:x></body><nos:x value="disabled" xmlns:nos="google:nosave"/><arc:record otr="false" xmlns:arc=""/></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

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

        at org.jivesoftware.smack.tcp.PacketReader.parsePackets(

        at org.jivesoftware.smack.tcp.PacketReader.access$000(

        at org.jivesoftware.smack.tcp.PacketReader$



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.