6 Replies Latest reply on May 22, 2017 2:15 AM by Vishnu Prajapati

    Smack 4.2.0 is not handling the stream resumption error correctly

    Vishnu Prajapati

      Hi,

       

      We are using Smack 4.2.0 with stream management enable on the server side(Using Ejabbered). At the client side when user trying to resume the previous stream after stream resumption timeout we are getting resume failed error stating previous session timeout.

       

      SENT (0): <resume xmlns='urn:xmpp:sm:3' h='161' previd='g2gCbQAAAAQ5MDM5aANiAAAF1mIAA3xjYgAAA4Y='/>

       

      RECV (0): <?xml version='1.0'?><stream:stream id='17224807743219834289' version='1.0' xml:lang='en' xmlns:stream='http://etherx.jabber.org/streams' from='xmppalpha.livecare.ca' xmlns='jabber:client'>

       

      RECV (0): <stream:features><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'><optional/></session><c ver='3UiDJW2QJ09wIIOQ/cowlKEir7A=' node='http://www.process-one.net/en/ejabberd/' hash='sha-1' xmlns='http://jabber.org/protocol/caps'/><sm xmlns='urn:xmpp:sm:2'/><sm xmlns='urn:xmpp:sm:3'/><ver xmlns='urn:xmpp:features:rosterver'/><csi xmlns='urn:xmpp:csi:0'/></stream:features>

       

      RECV (0): <failed h='42' xmlns='urn:xmpp:sm:3'><item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><text xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Previous session timed out</text></failed>

       

      Smack is giving us some parsing error for this:

       

      Connection XMPPTCPConnection[155@xmppalpha.livecare.ca/9039] (0) closed with error

                                                                                  java.lang.IllegalStateException: Could not transform string 'text' to XMPPErrorCondition

                                                                                      at org.jivesoftware.smack.packet.XMPPError$Condition.fromString(XMPPError.java:414 )

                                                                                      at org.jivesoftware.smack.sm.provider.ParseStreamManagement.failed(ParseStreamMana gement.java:56)

                                                                                      at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPC onnection.java:1130)

                                                                                      at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPCon nection.java:980)

                                                                                      at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnecti on.java:996)

                                                                                      at java.lang.Thread.run(Thread.java:818)

       

      We are unable to recognize the exception to perform any further action. For creating a new session when previous session has been expired, we should get a specified stream resumption error from smack.