AnsweredAssumed Answered

Smack 4.1.0-Alpha3 and XMPPTCPConnection Stream Management problem

Question asked by peteattrifork on Oct 13, 2014
Latest reply on Oct 13, 2014 by Flow

I am currently in the middle of an Android XMPP implementation which is working really well using Smack 4.1.0-Alpha3.


Unfortunately, I have come up against an issue with Stream Management which is giving me a hard time.


When enabled SM for a chat, I am getting NullPointerException in XMPPTCPConnection. The variable that is null is 'unacknowledgedStanzas' and it seems that this is never being initialised.


The only place it seems to be initialised is in the login method of XMPPTCPConnection but this only happens if, as seen on line 407, 'isSmAvailable() && useSm'.


The useSm flag is set as I have done that on the connection already, but the 'isSmAvailable' method looks up the SM namespace in a 'streamFeatures' variable in AbstractXMPPConnection which seems to rely on the server advertising the fact that it supports SM through service discovery.


Sadly, XEP-0198 does not require a server implementation of SM to advertise the fact that it supports it. This means that the 'unacknowledgedStanzas' variable in XMPPTCPConnection is never initialised and therefore when accessed, throughs a NPE.


Any idea of a good way around this problem?