XMPP-0313 MAM EMPTYIQ/Invalid Int Error

I am using the latest *smack-experimental:4.2.0-beta3-SNAPSHOT *

and my server (prosody 0.10, implementing the MAM module (Originally mam:0 namespace)), I edited it to fit in the new mam:1 namespace and some other tweaks…

And I of course also stripped the archive message to only the body (so I’m not sure if that has anything to the with the error).

Please [disregard the acknowledgement packet] - not marked in bold.

Here is my Code:

 try {

    MamManager.MamQueryResult mamQueryResult = mamManager.queryArchive(2);
 } catch (XMPPException.XMPPErrorException e) {

e.printStackTrace();
} catch (SmackException.NotLoggedInException e) {

e.printStackTrace();
} catch (SmackException.NotConnectedException e) {

e.printStackTrace();
} catch (InterruptedException e) {

e.printStackTrace();
} catch (SmackException.NoResponseException e) {

e.printStackTrace();
}

SMACK sent this (to the server) [relevant info in bold]:

D/SMACK: SENT (0):

*** ***

*** ***

*** 2***

*** ***

*** ***

SMACK received this (from the server):

D/SMACK: RECV (0):

** **

** **

** fdsdf**

** **

** **

*** ***

*** ***

*** stop***

*** ***

*** ***

*** ***

*** ***

*** 702878b8-2d93-4a51-adaa-2a49f20eb544***

*** 9.8813129168249e-324***

*** 40f9cb2d-3bb2-493a-b89b-bb258f7deb38***

*** ***

*** ***

And then the error comes after (which force-closed my APP)

E/AndroidRuntime: FATAL EXCEPTION:main

  •                                                              java.lang.ClassCastException: org.jivesoftware.smack.packet.EmptyResultIQ cannot be cast to org.jivesoftware.smackx.mam.element.MamFinIQ*
    
  •                                                                  at org.jivesoftware.smackx.mam.MamManager.queryArchive(MamManager.java:396)*
    
  •                                                                  at org.jivesoftware.smackx.mam.MamManager.queryArchive(MamManager.java:232)*
    
  •                                                                  at org.jivesoftware.smackx.mam.MamManager.queryArchive(MamManager.java:109)*
    

Looking at the error, I am having a feeling the first packet received has something to do with it… so I went with the latest 0.5 revision which replaced the parent element with instead of :http://xmpp.org/extensions/diff/api/xep/0313/diff/0.3/vs/0.5#query-limit

So instead of the result arriving first, it arrives last after all the messages have been completed:

SMACK Received (from server):

D/SMACK: RECV (0):

*** ***

*** ***

*** fdsdf***

*** ***

*** ***

*** ***

*** ***

*** stop***

*** ***

*** ***

*** ***

*** ***

*** 702878b8-2d93-4a51-adaa-2a49f20eb544***

*** 9.8813129168249e-324***

*** 40f9cb2d-3bb2-493a-b89b-bb258f7deb38***

*** ***

*** ***

But Connection closed immediately after the message (with Invalid Int at the count):

AbstractXMPPConnection: Connection XMPPTCPConnection[admin@myServer.com/LG-D855@g3_global_com@LGE] (0) closed with error

                                                                      java.lang.NumberFormatException: **Invalid int: "9.8813129168249e-324"**

                                                                          at java.lang.Integer.invalidInt(Integer.java:138)

                                                                          at java.lang.Integer.parse(Integer.java:410)

                                                                          at java.lang.Integer.parseInt(Integer.java:367)

                                                                          at java.lang.Integer.parseInt(Integer.java:334)

                                                                          at java.lang.Integer.valueOf(Integer.java:525)

                                                                          at org.jivesoftware.smack.util.ParserUtils.getIntegerFromNextText(ParserUtils.java :153)

                                                                          at org.jivesoftware.smackx.rsm.provider.RSMSetProvider.parse(RSMSetProvider.java:5 6)

                                                                          at org.jivesoftware.smackx.rsm.provider.RSMSetProvider.parse(RSMSetProvider.java:2 7)

                                                                          at org.jivesoftware.smack.provider.Provider.parse(Provider.java:31)

                                                                          at org.jivesoftware.smackx.mam.provider.MamFinIQProvider.parse(MamFinIQProvider.ja va:48)

                                                                          at org.jivesoftware.smackx.mam.provider.MamFinIQProvider.parse(MamFinIQProvider.ja va:34)

                                                                          at org.jivesoftware.smack.provider.Provider.parse(Provider.java:31)

                                                                          at org.jivesoftware.smack.util.PacketParserUtils.parseIQ(PacketParserUtils.java:63 1)

                                                                          at org.jivesoftware.smack.util.PacketParserUtils.parseStanza(PacketParserUtils.jav a:151)

                                                                          at org.jivesoftware.smack.AbstractXMPPConnection.parseAndProcessStanza(AbstractXMP PConnection.java:981)

                                                                          at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$500(XMPPTCPConnection.java: 146)

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

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

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

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

Is this because of the “index=’?’” missing at the element or something else? Please Help…Thank you.

Is this because of the “index=‘?’” missing at the element or something else?
No, it’s because of

9.8813129168249e-324

Thanks fro the response… But That doesn’t really solve or explain things at all…

Are you referring to the first error or second? And why is it the count? and what is the count for?
I did a little research on it… and I kinda get what it does, but it seems like it is not something you can control.

ANy solution? Which packet format is correct?

EDIT: I know that you are of course referring to the second error… BUt I just want ot know which returning format is right.

And also do you think it would help if I post the MAM module lua code responsible for the process on my server?

OK…I think…I may have figured it out…or at the very least…Perhaps it was a mistake by the original author.
I seem to have insert the correct value to the count element…

Glad that I could help.

The second received format is the correct one. The “fin” should be an IQ, not a message, according to work fine with the Smack MAM implementation

I’d say both formats are correct. It’s just the difference between MAM 0.3 and 0.4+.

Yes, I know. But the Smack’s implementation works with a fin IQ because it was based on MAM 0.5

are you saying it should be like this:

  • <iq type='result' complete='true' queryid='dafcab44-4064-4d11-9d12-4960d636bf3f' xmlns='urn:xmpp:mam:1'>*
    
  •      <set xmlns='http://jabber.org/protocol/rsm'>*
    
  •           <first>702878b8-2d93-4a51-adaa-2a49f20eb544</first>*
    
  •           <count>9.8813129168249e-324</count>*
    
  •           <last>40f9cb2d-3bb2-493a-b89b-bb258f7deb38</last>*
    
  •      </set>*
    
  • </iq>*
    

instead of this:

  • <fin complete='true' queryid='dafcab44-4064-4d11-9d12-4960d636bf3f' xmlns='urn:xmpp:mam:1'>*
    
  •      <set xmlns='http://jabber.org/protocol/rsm'>*
    
  •           <first>702878b8-2d93-4a51-adaa-2a49f20eb544</first>*
    
  •           <count>9.8813129168249e-324</count>*
    
  •           <last>40f9cb2d-3bb2-493a-b89b-bb258f7deb38</last>*
    
  •      </set>*
    
  • </fin>*
    

These are the changes between v0.3(red) and v0.5(green)

28482-98726-73623

09af3-cc343-b409f

20

iq>