SDM: Follow guidelines, perform put() where get() is performed

This commit is contained in:
Florian Schmaus 2014-08-26 13:34:42 +02:00
parent 5d159c4be2
commit 6af5d5e462
1 changed files with 2 additions and 2 deletions

View File

@ -117,8 +117,6 @@ public class ServiceDiscoveryManager extends Manager {
*/ */
private ServiceDiscoveryManager(XMPPConnection connection) { private ServiceDiscoveryManager(XMPPConnection connection) {
super(connection); super(connection);
// Register the new instance and associate it with the connection
instances.put(connection, this);
addFeature(DiscoverInfo.NAMESPACE); addFeature(DiscoverInfo.NAMESPACE);
addFeature(DiscoverItems.NAMESPACE); addFeature(DiscoverItems.NAMESPACE);
@ -293,6 +291,8 @@ public class ServiceDiscoveryManager extends Manager {
ServiceDiscoveryManager sdm = instances.get(connection); ServiceDiscoveryManager sdm = instances.get(connection);
if (sdm == null) { if (sdm == null) {
sdm = new ServiceDiscoveryManager(connection); sdm = new ServiceDiscoveryManager(connection);
// Register the new instance and associate it with the connection
instances.put(connection, sdm);
} }
return sdm; return sdm;
} }