Stream Management can't handle unexpected input

Discussion created by amb on Nov 6, 2014
Latest reply on Nov 7, 2014 by Flow

Current stream management code does not handle unexpected input well. I have a server that is returning the message id as the "h" attribute on stream management ack requests, which results in the exception below and a complete shutdown of the XMPPConnection.


11-06 14:13:37.147 W/AbstractXMPPConnection﹕ Connection closed with error

    java.lang.NumberFormatException: Invalid long: "w49kv-15"

            at java.lang.Long.invalidLong(

            at java.lang.Long.parse(

            at java.lang.Long.parseLong(

            at java.lang.Long.parseLong(

            at java.lang.Long.valueOf(

            at org.jivesoftware.smack.util.ParserUtils.getLongAttribute(


            at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPC

            at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPCon

            at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$


Seems like just ignoring the ack when encountering a parse failure would be better.


Incidentally, I don't think shutting down the XMPPConnection on an unexpected exception is desirable behavior either, but that's probably a discussion for another thread.