mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-25 21:42:07 +01:00
Fix IllegalArgumentException on DNS lookup if XMPP domain is wrong
Fixes the following exception thrown if the user had entered a non-existend XMPP domain: java.lang.IllegalArgumentException: Must provide at least one InetAddress at org.jivesoftware.smack.util.dns.HostAddress.<init>(HostAddress.java:55) at org.jivesoftware.smack.util.dns.DNSResolver.lookupHostAddress(DNSResolver.java: 56) at org.jivesoftware.smack.util.DNSUtil.resolveDomain(DNSUtil.java:209) at org.jivesoftware.smack.util.DNSUtil.resolveXMPPServiceDomain(DNSUtil.java:136) at org.jivesoftware.smack.AbstractXMPPConnection.populateHostAddresses(AbstractXMP PConnection.java:626) at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectUsingConfiguration(XMPPTCPC onnection.java:556) at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection. java:888) at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.ja va:377) Thanks to Grigory Fedorov for reporting.
This commit is contained in:
parent
9d8caf0563
commit
f31cc6e043
1 changed files with 2 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2013-2016 Florian Schmaus
|
* Copyright 2013-2017 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -50,7 +50,7 @@ public abstract class DNSResolver {
|
||||||
public final HostAddress lookupHostAddress(String name, int port, List<HostAddress> failedAddresses, DnssecMode dnssecMode) {
|
public final HostAddress lookupHostAddress(String name, int port, List<HostAddress> failedAddresses, DnssecMode dnssecMode) {
|
||||||
checkIfDnssecRequestedAndSupported(dnssecMode);
|
checkIfDnssecRequestedAndSupported(dnssecMode);
|
||||||
List<InetAddress> inetAddresses = lookupHostAddress0(name, failedAddresses, dnssecMode);
|
List<InetAddress> inetAddresses = lookupHostAddress0(name, failedAddresses, dnssecMode);
|
||||||
if (inetAddresses == null) {
|
if (inetAddresses == null || inetAddresses.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new HostAddress(name, port, inetAddresses);
|
return new HostAddress(name, port, inetAddresses);
|
||||||
|
|
Loading…
Reference in a new issue