powered by Jive Software

MUC - History retrieval question from review of MUCPersistanceManager.java

Hello all,

This is a follow on to this issue point #2.

The problem I am experiencing is that after a server restart a multi-user chat room no longer displays any history, it essentially starts fresh. The data however, is still stored in the DB (Oracle in our case).

I have acquired the source to Openfire 3.3.2 and after some digging around in the persistance manager I have come across two SQL queries that I don’'t quite understand.

I am referring to Revision: 1623 of MUCPersistanceManager.java as part of the 3.3.2 source bundle.

private static final String LOAD_HISTORY =
"SELECT sender, nickname, time, subject, body FROM mucConversationLog " +
"WHERE time>? AND roomID=? AND (nickname <> '''' OR subject IS NOT NULL) ORDER BY time";
private static final String LOAD_ALL_HISTORY =
"SELECT roomID, sender, nickname, time, subject, body FROM mucConversationLog " +
"WHERE time>? AND (nickname <> '''' OR subject IS NOT NULL) ORDER BY time";

I have run these queries from a SQL prompt and they only seem to return the create room message and any messages that changed the subject. “Normal” messages sent from users are not retrieved.

If I remove the “AND (nickname ‘’’’ OR subject IS NOT NULL)” from the SQL queries I get all the history of the chat room.

What is the intended behaviour of this component?



There is a bug in the query in MUCPersistanceManager.java on Oracle.

The queries for LOAD_ALL_HISTORY and LOAD_HISTORY use nickname <> ‘’’’ in their queries. This does not work on Oracle. It does, however, work in MySQL.

If you replace nickname <> ‘’’’ with nickname is not null for both these queries you will get all the results back properly in both MySQL and Oracle.

Could one of the developers please apply this fix for a future release?



I have just done a quick look at Fisheye to see if Openfire 3.3.3 has fixed this reported bug (and the fix I have suggested). Sadly, it was not fixed.

How can I ensure that the next build of Openfire has this fixed? What process do I need to follow??

I am super keen to get this bug fixed as it causes all sorts of pain when I have to restart the server daemon!


Hi Evan,

follow the brand new Ignite Process for Community Bug Reporting & Patches and create a new thread to do this, being the first one to use this process entitles you not to get a virtual dishwasher, a virtual motorboat or something else of your choice.


Noted and done.

The process to become a patch contributer is a little onerous (IMHO) but I have commented on the link you posted about how this can be improved.