mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-16 04:12:04 +01:00
Return empty list instead of null in DNSUtil
This commit is contained in:
parent
42d0557682
commit
c59a6010e1
1 changed files with 3 additions and 4 deletions
|
@ -122,7 +122,6 @@ public class DNSUtil {
|
|||
}
|
||||
List<SRVRecord> srvRecords = dnsResolver.lookupSRVRecords(srvDomain);
|
||||
List<HostAddress> sortedRecords = sortSRVRecords(srvRecords);
|
||||
if (sortedRecords != null)
|
||||
addresses.addAll(sortedRecords);
|
||||
|
||||
// Step two: Add the hostname to the end of the list
|
||||
|
@ -139,11 +138,11 @@ public class DNSUtil {
|
|||
* @param records
|
||||
* @return the list of resolved HostAddresses
|
||||
*/
|
||||
protected static List<HostAddress> sortSRVRecords(List<SRVRecord> records) {
|
||||
private static List<HostAddress> sortSRVRecords(List<SRVRecord> records) {
|
||||
// RFC 2782, Usage rules: "If there is precisely one SRV RR, and its Target is "."
|
||||
// (the root domain), abort."
|
||||
if (records.size() == 1 && records.get(0).getFQDN().equals("."))
|
||||
return null;
|
||||
return Collections.emptyList();
|
||||
|
||||
// sorting the records improves the performance of the bisection later
|
||||
Collections.sort(records);
|
||||
|
|
Loading…
Reference in a new issue