Monitoring Plugin

Hi,

my company uses Openfire since version 3.8.2. and we have recently began using the monitoring plugin for archiving and synchronization purposes using XEP-0136 automatic archiving and retrieval.

However, both the old 1.3.3 version and the newer 1.4.2 have a bug in chatsession list retrieval, though it may go unnoticed.

In our case this resulted in more bandwidth being spent downloading conversations we had already downloaded once.

Specifically he monitoring plugin fails to handle correctly the start attribute in list requests. An example request would be:

<set xmlns="[http://jabber.org/protocol/rsm](http://jabber.org/protocol/rsm)"/>

The expected result would be that only chat sessions started at or after the given date will be added to the resultset.

However this does not get parsed correctly, and the data returned does not use the given date, and returns all the chat sessions regardless of date.

Internally the bug seems to depend on the getAuditedStartDate inside JdbcPersistenceManager that checks for valid retrieval dates within the configured ranges, but returns null on valid retrieval dates.

public Date getAuditedStartDate(Date startDate) {

long maxRetrievable = JiveGlobals.getIntProperty(“conversation.maxRetrievable”, ConversationManager.DEFAULT_MAX_RETRIEVABLE) * JiveConstants.DAY;

Date result = null;

if (maxRetrievable > 0) {

Date now = new Date();

Date maxRetrievableDate = new Date(now.getTime() - maxRetrievable);

if (startDate == null) {

result = maxRetrievableDate;

} else if (startDate.before(maxRetrievableDate)) {

result = maxRetrievableDate;

}

}

return result;

}

We fixed it by adding the “else” condition:

public Date getAuditedStartDate(Date startDate) {

long maxRetrievable = JiveGlobals.getIntProperty(“conversation.maxRetrievable”, ConversationManager.DEFAULT_MAX_RETRIEVABLE) * JiveConstants.DAY;

Date result = null;

if (maxRetrievable > 0) {

Date now = new Date();

Date maxRetrievableDate = new Date(now.getTime() - maxRetrievable);

if (startDate == null) {

result = maxRetrievableDate;

} else if (startDate.before(maxRetrievableDate)) {

result = maxRetrievableDate;

}else{

        result = startDate;

      }

}

return result;

}

I looked over the open issues and couldn’t find it so I thought I would point it out.

Thanks for reading ,

Paolo Manili

—EDIT—

I’m attaching the patched jar, I have changed the version number to 1.4.21 compatibility is Openfire 3.9.0 and above.

Messaggio modificato da Paolo Manili 27/08/2014

Thanks, filed OF-812 to track this