1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-22 10:37:59 +01:00

Make getMulitipleRecipientServiceAddress() more robust

the method should not throw if one of server's items fail to query.
This commit is contained in:
Florian Schmaus 2014-06-05 14:49:56 +02:00
parent f05f6bf901
commit 0680553ef7

View file

@ -22,6 +22,7 @@ import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.FeatureNotSupportedException;
import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Packet;
@ -310,8 +311,14 @@ public class MultipleRecipientManager {
DiscoverItems items = ServiceDiscoveryManager.getInstanceFor(connection).discoverItems(
serviceName);
for (DiscoverItems.Item item : items.getItems()) {
info = ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(
item.getEntityID(), item.getNode());
try {
info = ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(
item.getEntityID(), item.getNode());
}
catch (XMPPErrorException|NoResponseException e) {
// Don't throw this exceptions if one of the server's items fail
continue;
}
if (info.containsFeature("http://jabber.org/protocol/address")) {
serviceAddress = serviceName;
break;