mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 12:02:05 +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:
parent
f05f6bf901
commit
0680553ef7
1 changed files with 9 additions and 2 deletions
|
@ -22,6 +22,7 @@ import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||||
import org.jivesoftware.smack.SmackException.FeatureNotSupportedException;
|
import org.jivesoftware.smack.SmackException.FeatureNotSupportedException;
|
||||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Packet;
|
||||||
|
@ -310,8 +311,14 @@ public class MultipleRecipientManager {
|
||||||
DiscoverItems items = ServiceDiscoveryManager.getInstanceFor(connection).discoverItems(
|
DiscoverItems items = ServiceDiscoveryManager.getInstanceFor(connection).discoverItems(
|
||||||
serviceName);
|
serviceName);
|
||||||
for (DiscoverItems.Item item : items.getItems()) {
|
for (DiscoverItems.Item item : items.getItems()) {
|
||||||
info = ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(
|
try {
|
||||||
item.getEntityID(), item.getNode());
|
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")) {
|
if (info.containsFeature("http://jabber.org/protocol/address")) {
|
||||||
serviceAddress = serviceName;
|
serviceAddress = serviceName;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue