1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 20:12:07 +01:00

Return empty list instead of null in DNSUtil

This commit is contained in:
Florian Schmaus 2014-03-26 22:48:32 +01:00
parent 42d0557682
commit c59a6010e1

View file

@ -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);