powered by Jive Software

MultiUserChat: No ServiceDiscoveryManager when reconnecting/ConnectionCreationListener setup

Hi,

Scenario:

Step 1. Setup

XMPPConnection.connect()

XMPPConnection.addPacketListener() for Message

XMPPConnection.addConnectionListener()

XMPPConnection.login()

new MultiUserChat() for XMPPConnection

MultiUserChat.join()

Step 2. Disconnect

MultiUserChat.leave()

XMPPConnection.disconnect()

Step 3. Repeat Step 1.

I get a NullPointerException in line 84:

ServiceDiscoveryManager.getInstanceFor(connection).addFeature(di

scoNamespace);

because in ServiceDiscoveryManager, Map<XMPPConnection, ServiceDiscoveryManager> instances is null for the new XMPPConnection,

because in XMPPConnection, we have:

private final static Set connectionEstablishedListeners =

new CopyOnWriteArraySet();

Shouldn’t this be non-static so that each XMPPConnection will have its own set of ConnectionCreationListeners?

I think the code is too dependent on static members.

Thanks.