[Bug] Changing PubSub Node Configuration

When i tried to change the configuration of a PubSub node i noticed that the configuration is changed but:

  1. The subscribers are not correctly notified (just getting a 500 Server error)

  2. The change is not persisted to the DB (meaning the old config is loaded when Openfire is restarted.)

In the error log i found the following trace:

2015.11.26 16:43:39 org.jivesoftware.openfire.pubsub.PubSubModule - Internal server error

java.lang.NullPointerException

at org.jivesoftware.openfire.pubsub.Node.addFormFields(Node.java:878)

at org.jivesoftware.openfire.pubsub.LeafNode.addFormFields(LeafNode.java:127)

at org.jivesoftware.openfire.pubsub.Node.getConfigurationChangeForm(Node.java:1082 )

at org.jivesoftware.openfire.pubsub.Node.nodeConfigurationChanged(Node.java:765)

at org.jivesoftware.openfire.pubsub.Node.configure(Node.java:711)

at org.jivesoftware.openfire.pubsub.PubSubEngine.configureNode(PubSubEngine.java:1 362)

at org.jivesoftware.openfire.pubsub.PubSubEngine.process(PubSubEngine.java:184)

at org.jivesoftware.openfire.pubsub.PubSubModule.process(PubSubModule.java:168)

at org.jivesoftware.openfire.spi.RoutingTableImpl.routeToComponent(RoutingTableImp l.java:406)

at org.jivesoftware.openfire.spi.RoutingTableImpl.routePacket(RoutingTableImpl.jav a:248)

at org.jivesoftware.openfire.IQRouter.handle(IQRouter.java:331)

at org.jivesoftware.openfire.IQRouter.route(IQRouter.java:123)

at org.jivesoftware.openfire.spi.PacketRouterImpl.route(PacketRouterImpl.java:78)

at org.jivesoftware.openfire.SessionPacketRouter.route(SessionPacketRouter.java:10 8)

at org.jivesoftware.openfire.SessionPacketRouter.route(SessionPacketRouter.java:67 )

at org.jivesoftware.openfire.http.HttpSession.sendPendingPackets(HttpSession.java: 655)

at org.jivesoftware.openfire.http.HttpSession$HttpPacketSender.run(HttpSession.jav a:1280)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at java.lang.Thread.run(Thread.java:745)

In Node.java line 878 the following piece of code fails because there is no parent node:

if (!parent.isRootCollectionNode()) {

formField.addValue(parent.getNodeID());

}

I changed this to:

if (parent != null && !parent.isRootCollectionNode()) {

formField.addValue(parent.getNodeID());

}

And it seems to work fine now.

Florian

I’ve fixed it:

Fix NPE in Node.java when changing node configuration. by sco0ter · Pull Request #413 · igniterealtime/Openfire · GitHub