diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/dns/DNSResolver.java b/smack-core/src/main/java/org/jivesoftware/smack/util/dns/DNSResolver.java
index f5e4518f9..c2823213c 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/dns/DNSResolver.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/dns/DNSResolver.java
@@ -59,6 +59,20 @@ public abstract class DNSResolver {
return new HostAddress(name, port, inetAddresses);
}
+ /**
+ * Lookup the IP addresses of a given host name. Returns null
if there was an error, in which the error
+ * reason will be added in form of a HostAddress
to failedAddresses
. Returns a empty list
+ * in case the DNS name exists but has no associated A or AAAA resource records. Otherwise, if the resolution was
+ * successful and there is at least one A or AAAA resource record, then a non-empty list will be returned.
+ *
+ * Concrete DNS resolver implementations are free to overwrite this, but have to stick to the interface contract.
+ *
+ *
+ * @param name the DNS name to lookup
+ * @param failedAddresses a list with the failed addresses
+ * @param dnssecMode the selected DNSSEC mode
+ * @return A list, either empty or non-empty, or null
+ */
protected List lookupHostAddress0(String name, List failedAddresses, DnssecMode dnssecMode) {
// Default implementation of a DNS name lookup for A/AAAA records. It is assumed that this method does never
// support DNSSEC. Subclasses are free to override this method.
diff --git a/smack-resolver-dnsjava/src/main/java/org/jivesoftware/smack/util/dns/dnsjava/DNSJavaResolver.java b/smack-resolver-dnsjava/src/main/java/org/jivesoftware/smack/util/dns/dnsjava/DNSJavaResolver.java
index 0d29ed344..dd449fce3 100644
--- a/smack-resolver-dnsjava/src/main/java/org/jivesoftware/smack/util/dns/dnsjava/DNSJavaResolver.java
+++ b/smack-resolver-dnsjava/src/main/java/org/jivesoftware/smack/util/dns/dnsjava/DNSJavaResolver.java
@@ -19,6 +19,7 @@ package org.jivesoftware.smack.util.dns.dnsjava;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;
+import java.util.logging.Level;
import org.jivesoftware.smack.ConnectionConfiguration.DnssecMode;
import org.jivesoftware.smack.initializer.SmackInitializer;
@@ -73,7 +74,13 @@ public class DNSJavaResolver extends DNSResolver implements SmackInitializer {
int weight = srvRecord.getWeight();
List hostAddresses = lookupHostAddress0(host, failedAddresses, dnssecMode);
- if (hostAddresses == null) {
+ if (hostAddresses == null || hostAddresses.isEmpty()) {
+ // If hostAddresses is not null but empty, then the DNS resolution was successful but the domain did not
+ // have any A or AAAA resource records.
+ if (hostAddresses.isEmpty()) {
+ LOGGER.log(Level.INFO, "The DNS name " + name + ", points to a hostname (" + host
+ + ") which has neither A or AAAA resource records. This is an indication of a broken DNS setup.");
+ }
continue;
}
diff --git a/smack-resolver-javax/src/main/java/org/jivesoftware/smack/util/dns/javax/JavaxResolver.java b/smack-resolver-javax/src/main/java/org/jivesoftware/smack/util/dns/javax/JavaxResolver.java
index 9ebec30a2..1afce4198 100644
--- a/smack-resolver-javax/src/main/java/org/jivesoftware/smack/util/dns/javax/JavaxResolver.java
+++ b/smack-resolver-javax/src/main/java/org/jivesoftware/smack/util/dns/javax/JavaxResolver.java
@@ -111,7 +111,13 @@ public class JavaxResolver extends DNSResolver implements SmackInitializer {
String host = srvRecordEntries[srvRecordEntries.length - 1];
List hostAddresses = lookupHostAddress0(host, failedAddresses, dnssecMode);
- if (hostAddresses == null) {
+ if (hostAddresses == null || hostAddresses.isEmpty()) {
+ // If hostAddresses is not null but empty, then the DNS resolution was successful but the domain did not
+ // have any A or AAAA resource records.
+ if (hostAddresses.isEmpty()) {
+ LOGGER.log(Level.INFO, "The DNS name " + name + ", points to a hostname (" + host
+ + ") which has neither A or AAAA resource records. This is an indication of a broken DNS setup.");
+ }
continue;
}
diff --git a/smack-resolver-minidns/src/main/java/org/jivesoftware/smack/util/dns/minidns/MiniDnsResolver.java b/smack-resolver-minidns/src/main/java/org/jivesoftware/smack/util/dns/minidns/MiniDnsResolver.java
index ff5906ff7..24e4c985c 100644
--- a/smack-resolver-minidns/src/main/java/org/jivesoftware/smack/util/dns/minidns/MiniDnsResolver.java
+++ b/smack-resolver-minidns/src/main/java/org/jivesoftware/smack/util/dns/minidns/MiniDnsResolver.java
@@ -24,6 +24,7 @@ import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
+import java.util.logging.Level;
import org.jivesoftware.smack.ConnectionConfiguration.DnssecMode;
import org.jivesoftware.smack.initializer.SmackInitializer;
@@ -90,7 +91,13 @@ public class MiniDnsResolver extends DNSResolver implements SmackInitializer {
for (SRV srv : result.getAnswers()) {
String hostname = srv.name.ace;
List hostAddresses = lookupHostAddress0(hostname, failedAddresses, dnssecMode);
- if (hostAddresses == null) {
+ if (hostAddresses == null || hostAddresses.isEmpty()) {
+ // If hostAddresses is not null but empty, then the DNS resolution was successful but the domain did not
+ // have any A or AAAA resource records.
+ if (hostAddresses.isEmpty()) {
+ LOGGER.log(Level.INFO, "The DNS name " + name + ", points to a hostname (" + hostname
+ + ") which has neither A or AAAA resource records. This is an indication of a broken DNS setup.");
+ }
continue;
}