From 999c86ef4cd74f40bda84d478355c74a46b0ab13 Mon Sep 17 00:00:00 2001 From: rcollier Date: Sat, 23 Mar 2013 11:55:43 +0000 Subject: [PATCH] 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 --- source/org/jivesoftware/smack/util/DNSUtil.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/source/org/jivesoftware/smack/util/DNSUtil.java b/source/org/jivesoftware/smack/util/DNSUtil.java index 628d8e8f3..20a143faf 100644 --- a/source/org/jivesoftware/smack/util/DNSUtil.java +++ b/source/org/jivesoftware/smack/util/DNSUtil.java @@ -81,7 +81,12 @@ public class DNSUtil { * @return List of HostAddress, which encompasses the hostname and port that the * XMPP server can be reached at for the specified domain. */ - public static List resolveXMPPDomain(String domain) { + public static List resolveXMPPDomain(final String domain) { + if (dnsResolver == null) { + List addresses = new ArrayList(1); + addresses.add(new HostAddress(domain, 5222)); + return addresses; + } return resolveDomain(domain, 'c'); } @@ -102,7 +107,12 @@ public class DNSUtil { * @return List of HostAddress, which encompasses the hostname and port that the * XMPP server can be reached at for the specified domain. */ - public static List resolveXMPPServerDomain(String domain) { + public static List resolveXMPPServerDomain(final String domain) { + if (dnsResolver == null) { + List addresses = new ArrayList(1); + addresses.add(new HostAddress(domain, 5269)); + return addresses; + } return resolveDomain(domain, 's'); } @@ -117,9 +127,6 @@ public class DNSUtil { } } - if (dnsResolver == null) - throw new IllegalStateException("No DNS resolver active."); - List addresses = new ArrayList(); // Step one: Do SRV lookups