Openfire Hazelcast Clustering & REST API Room Creation NPE when no modificationDate sent
Description
Using Openfire 4.2.x, when the hazelcast and REST API Plugins, clustered(2+ nodes),
Overview Creating Room via REST API partially fails The Room is created, but without the Room Description and Topic correctly populated As well, the room state event is not sent to the other members of the cluster
Pre-conditions Openfire clustering turned on More than 1 node in the cluster Create a room via REST API w/o the modificationDate
Result:
The Room is created, but without the Room Description and Topic correctly populated Null Pointer Exception in the logs, upon trying to send the room updated event out to the cluster. It is making the assumption that the modifiedDate is not null … and boom
// LocalMUCRoom.writeExternal, line 2726 ExternalizableUtil.getInstance().writeLong(out, modificationDate.getTime());
Caused by: java.lang.NullPointerException at org.jivesoftware.openfire.muc.spi.LocalMUCRoom.writeExternal(LocalMUCRoom.java:2726) at org.jivesoftware.openfire.muc.cluster.RoomUpdatedEvent.writeExternal(RoomUpdatedEvent.java:62) at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1459)
Work-arounds
Turn off nodes 2 and 3 for Openfire, but leave Hazelcast running on node 1
Short-term work-around in the REST API call to create the room, also populate and send the modificationDate . Continue running in clustered mode, with multiple nodes.
Using Openfire 4.2.x, when the hazelcast and REST API Plugins, clustered(2+ nodes),
Overview
Creating Room via REST API partially fails
The Room is created, but without the Room Description and Topic correctly populated
As well, the room state event is not sent to the other members of the cluster
Pre-conditions
Openfire clustering turned on
More than 1 node in the cluster
Create a room via REST API w/o the modificationDate
Result:
The Room is created, but without the Room Description and Topic correctly populated
Null Pointer Exception in the logs, upon trying to send the room updated event out to the cluster. It is making the assumption that the modifiedDate is not null … and boom
// LocalMUCRoom.writeExternal, line 2726 ExternalizableUtil.getInstance().writeLong(out, modificationDate.getTime());
Caused by: java.lang.NullPointerException at org.jivesoftware.openfire.muc.spi.LocalMUCRoom.writeExternal(LocalMUCRoom.java:2726) at org.jivesoftware.openfire.muc.cluster.RoomUpdatedEvent.writeExternal(RoomUpdatedEvent.java:62) at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1459)
Work-arounds
Turn off nodes 2 and 3 for Openfire, but leave Hazelcast running on node 1
Short-term work-around in the REST API call to create the room, also populate and send the modificationDate . Continue running in clustered mode, with multiple nodes.
Fix the 1 line bug in Openfire, with a null check