I am seeing a similar issue (using Smack 4.2.0 and Open Fire 4.1.6 with Monitoring Service plugin). Currently reading up on XEP-0313 to determine which is true:
a) My code is in error, or
b) Smack library is in error (by requiring “set” on the “fin”) when set should be optional, or
c) Openfire/Monitoring plugin is in error (by not sending a required “set” on the “fin”)
Do you know is true?
Here is the code snippet I am using to query to the server
MamManager.MamQueryResult queryResult = archive.queryArchiveWithStartDate(new Date(syncPoint));
After configuring the Openfire/Monitoring plugin, I do seem to get messages back if appropriate, but the Smack library errors out on the “fin” stanza, regardless of how many messages proceed the fin. Whether no messages match, or 3, as in the case below
And here is the traffic log.
03-22 15:47:55.612 5904-6132/com.usermap.app I/System.out: 15:47:55 SENT (0): <iq from='byoung@localtest.net/ANDROID-355301074232615' id='70Uhv-219' type='set'><query xmlns='urn:xmpp:mam:1' queryid='0a3037dd-ecea-4800-ba12-6e1ae032b8f9'><x xmlns='jabber:x:data' type='submit'><field var='FORM_TYPE' type='hidden'><value>urn:xmpp:mam:1</value></field><field var='start'><value>2018-03-21T19:47:55.622+00:00</value></field></x></query></iq>
03-22 15:47:55.732 5904-6133/com.usermap.app I/System.out: 15:47:55 RECV (0): <message to="byoung@localtest.net/ANDROID-355301074232615"><result xmlns="urn:xmpp:mam:1" queryid="0a3037dd-ecea-4800-ba12-6e1ae032b8f9" id="1"><forwarded xmlns="urn:xmpp:forward:0"><delay xmlns="urn:xmpp:delay" stamp="2018-03-22T19:45:25.652Z"/><message xmlns="jabber:client" to="user1@localtest.net" from="byoung@localtest.net/ANDROID-355301074232615" id="t9832-222" type="chat"><body>hit</body><thread>10d5fdf7-3aa0-4d6f-a291-c5e2fb84c8b0</thread><active xmlns="http://jabber.org/protocol/chatstates"></active><request xmlns="urn:xmpp:receipts"></request><tak xmlns="urn:xmpp:tak"><uid>ANDROID-355301074232615</uid></tak></message></forwarded></result></message>
03-22 15:47:55.872 5904-6133/com.usermap.app I/System.out: 15:47:55 RECV (0): <message to="byoung@localtest.net/ANDROID-355301074232615"><result xmlns="urn:xmpp:mam:1" queryid="0a3037dd-ecea-4800-ba12-6e1ae032b8f9" id="2"><forwarded xmlns="urn:xmpp:forward:0"><delay xmlns="urn:xmpp:delay" stamp="2018-03-22T19:45:47.976Z"/><message xmlns="jabber:client" to="byoung@localtest.net/ANDROID-355301074232615" from="test1@conference.localtest.net/byoung" id="t9832-292" type="groupchat"><body>well</body><tak xmlns="urn:xmpp:tak"><uid>ANDROID-355301074232615</uid></tak></message></forwarded></result></message>
03-22 15:47:55.872 5904-6133/com.usermap.app I/System.out: 15:47:55 RECV (0): <r xmlns='urn:xmpp:sm:3' />
03-22 15:47:55.882 5904-6132/com.usermap.app I/System.out: 15:47:55 SENT (0): <a xmlns='urn:xmpp:sm:3' h='20'/>
03-22 15:47:55.882 5904-6133/com.usermap.app I/System.out: 15:47:55 RECV (0): <message to="byoung@localtest.net/ANDROID-355301074232615"><result xmlns="urn:xmpp:mam:1" queryid="0a3037dd-ecea-4800-ba12-6e1ae032b8f9" id="3"><forwarded xmlns="urn:xmpp:forward:0"><delay xmlns="urn:xmpp:delay" stamp="2018-03-22T19:45:49.914Z"/><message xmlns="jabber:client" to="byoung@localtest.net/ANDROID-355301074232615" from="test1@conference.localtest.net/byoung" id="t9832-296" type="groupchat"><body>see</body><tak xmlns="urn:xmpp:tak"><uid>ANDROID-355301074232615</uid></tak></message></forwarded></result></message>
03-22 15:47:55.882 5904-6133/com.usermap.app I/System.out: 15:47:55 RECV (0): <iq type="result" id="70Uhv-219" to="byoung@localtest.net/ANDROID-355301074232615"><fin xmlns="urn:xmpp:mam:1" queryid="0a3037dd-ecea-4800-ba12-6e1ae032b8f9"/></iq>
03-22 15:47:55.892 5904-6133/com.usermap.app E/xceptionLoggingCallback: Smack message parsing exception. Content: '</fin></iq>'
java.lang.IllegalArgumentException: rsmSet must not be null
at org.jivesoftware.smackx.mam.element.MamFinIQ.<init>(MamFinIQ.java:73)
at org.jivesoftware.smackx.mam.provider.MamFinIQProvider.parse(MamFinIQProvider.java:59)
at org.jivesoftware.smackx.mam.provider.MamFinIQProvider.parse(MamFinIQProvider.java:34)
at org.jivesoftware.smack.provider.Provider.parse(Provider.java:31)
at org.jivesoftware.smack.util.PacketParserUtils.parseIQ(PacketParserUtils.java:632)
at org.jivesoftware.smack.util.PacketParserUtils.parseStanza(PacketParserUtils.java:152)
at org.jivesoftware.smack.AbstractXMPPConnection.parseAndProcessStanza(AbstractXMPPConnection.java:1025)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$500(XMPPTCPConnection.java:149)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1026)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPConnection.java:980)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:996)
at java.lang.Thread.run(Thread.java:818)