Hello,
We have found what we consider a “bug” in offline message storage process. Openfire fails trying to store a into the offline mesage repository if the tag is missing.
With the last review of this method, the following check has been added.
public void addMessage(Message message) {
if (message == null) {
return;
}
if (message.getBody() == null || message.getBody().length() == 0) {
// ignore empty bodied message (typically chat-state notifications).
return;
}******
*** *** …
The problem is that if the message has no tag, when message.getBody().length() is called, a NullPointerException is thrown. There is no problem in the server behaviour, since the exception is later on captured and the server keeps running. Anyway, I think it worths adding extra checking to this method, probably something like this:
public void addMessage(Message message) {
if (message == null) {
return;
}
String body = message.getBody();
if (body != null) {
int length = body.length();
if (length == 0) {
// ignore empty bodied message (typically chat-state
// notifications).
return;
}
*** …***
Another discussion is if this behaviour should change to store messages without a tag. In our case, we are using a private protocol extension based on but not using the standard architecture. Starting from 3.6.0 release, OpenFire doesn’t store messages without a tag. impying that when our service send a message to an offline destination, the message is lost since the server doesn’t store it for delayed delivery.
Don’t get me wrong, I’m not suggesting to support to this kind of messages (without tag), I just want to start a discussion about it. The decission is yours, of course.
Thanks for your time.