1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-23 02:58:00 +01:00

SMACK-225 Modified DNSUtils to return a default HostAddress when no DNS resolver is available. This restores the previous default behaviour.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_3_0@13587 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
rcollier 2013-03-23 11:55:43 +00:00
parent 07a0b8f722
commit 999c86ef4c

View file

@ -81,7 +81,12 @@ public class DNSUtil {
* @return List of HostAddress, which encompasses the hostname and port that the * @return List of HostAddress, which encompasses the hostname and port that the
* XMPP server can be reached at for the specified domain. * XMPP server can be reached at for the specified domain.
*/ */
public static List<HostAddress> resolveXMPPDomain(String domain) { public static List<HostAddress> resolveXMPPDomain(final String domain) {
if (dnsResolver == null) {
List<HostAddress> addresses = new ArrayList<HostAddress>(1);
addresses.add(new HostAddress(domain, 5222));
return addresses;
}
return resolveDomain(domain, 'c'); return resolveDomain(domain, 'c');
} }
@ -102,7 +107,12 @@ public class DNSUtil {
* @return List of HostAddress, which encompasses the hostname and port that the * @return List of HostAddress, which encompasses the hostname and port that the
* XMPP server can be reached at for the specified domain. * XMPP server can be reached at for the specified domain.
*/ */
public static List<HostAddress> resolveXMPPServerDomain(String domain) { public static List<HostAddress> resolveXMPPServerDomain(final String domain) {
if (dnsResolver == null) {
List<HostAddress> addresses = new ArrayList<HostAddress>(1);
addresses.add(new HostAddress(domain, 5269));
return addresses;
}
return resolveDomain(domain, 's'); return resolveDomain(domain, 's');
} }
@ -117,9 +127,6 @@ public class DNSUtil {
} }
} }
if (dnsResolver == null)
throw new IllegalStateException("No DNS resolver active.");
List<HostAddress> addresses = new ArrayList<HostAddress>(); List<HostAddress> addresses = new ArrayList<HostAddress>();
// Step one: Do SRV lookups // Step one: Do SRV lookups