Issue with Monitoring Plugin 1.8.2-Snapshot

Hello, i got problems that the plugin sometimes does not recognise the correct namespace for MAM:2

on IQQueryHandler.java arround line 363 findMessages is called with parameter this.usesUniqueAndStableIDs():

Collection <ArchivedMessage> result = getPersistenceManager(queryRequest.getArchive()).findMessages(
	                startDate,
	                endDate,
	                queryRequest.getArchive().toBareJID(),
	                withField,
	                queryRequest.getResultSet(),
                	this.usesUniqueAndStableIDs());

for MAM:2 this.usesUniqueAndStableIDs() should return true, but it often returns false so that i will get an exception:

java.lang.NumberFormatException: For input string: "64aa563b-8863-43a8-a391-bd260285ac3a"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:1.8.0_202]
        at java.lang.Long.parseLong(Long.java:589) ~[?:1.8.0_202]
        at java.lang.Long.parseLong(Long.java:631) ~[?:1.8.0_202]
        at com.reucon.openfire.plugin.archive.impl.MucMamPersistenceManager.parseIdentifier(MucMamPersistenceManager.java:239) ~[?:?]
        at com.reucon.openfire.plugin.archive.impl.MucMamPersistenceManager.findMessages(MucMamPersistenceManager.java:96) ~[?:?]
        at com.reucon.openfire.plugin.archive.xep0313.IQQueryHandler.retrieveMessages(IQQueryHandler.java:359) ~[?:?]
        at com.reucon.openfire.plugin.archive.xep0313.IQQueryHandler.lambda$handleIQ$0(IQQueryHandler.java:205) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_202]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_202]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_202]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_202]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_202]

i assume that the namespace is not read correctly
i tested it with adding a further field namespace to class QueryRequest, read it out in constructor
with this.namespace = queryElement.getNamespaceURI(); and read it before call findMessages:

String namespace = queryRequest.getNamespace();
Log.info(“NAMESPACE=”+namespace);

I think the object is not an instance of IQQueryHandler2.
So the request is not correctly parsed and routed to the right handler?

See https://github.com/igniterealtime/openfire-monitoring-plugin/issues/56
See https://github.com/igniterealtime/openfire-monitoring-plugin/releases/tag/v1.8.2-SNAPSHOT

I’ve set a breakpoint there and it seems conversejs sends this packet too:

<iq id="10608cea-60f6-44a5-a475-d42cb3a6f750:sendIQ" type="get" from="test2@mopbook/converse.js-75072354">
  <prefs xmlns="urn:xmpp:mam:2"></prefs>
</iq>

This results in a null object and therefore feauture not implemented and should be okay because
we dont have implemented mam configuration from client side.

Then it sends this normal mam2 query:

<iq id="62582888-1cf1-485f-b575-0ab904688d08:sendIQ" type="set" from="test2@mopbook/converse.js-75072354">
  <query xmlns="urn:xmpp:mam:2" queryid="0cc75303-9141-448a-b7b4-3ef1451f8e8f">
    <x xmlns="jabber:x:data" type="submit">
      <field type="hidden" var="FORM_TYPE">
        <value>urn:xmpp:mam:2</value>
      </field>
      <field var="with">
        <value>test1@mopbook</value>
      </field>
    </x>
    <set xmlns="http://jabber.org/protocol/rsm">
      <max>50</max>
      <before/>
    </set>
  </query>
</iq>

and then it gets a mam2-handler

Join the issue discussion at https://github.com/igniterealtime/openfire-monitoring-plugin/issues/56#issuecomment-569412995