Map<Fields, String> map = cachedInfo.getQualifiedNameMap();
byte[] srvBytes = null;
String server = "";
DNSEntry serviceEntry = this.getCache().getDNSEntry(info.getQualifiedName(), DNSRecordType.TYPE_SRV, DNSRecordClass.CLASS_ANY);
if (serviceEntry instanceof DNSRecord) {
ServiceInfo cachedServiceEntryInfo = ((DNSRecord) serviceEntry).getServiceInfo(persistent);
if (cachedServiceEntryInfo != null) {
cachedInfo = new ServiceInfoImpl(map, cachedServiceEntryInfo.getPort(), cachedServiceEntryInfo.getWeight(), cachedServiceEntryInfo.getPriority(), persistent, (byte[]) null);
srvBytes = cachedServiceEntryInfo.getTextBytes();
server = cachedServiceEntryInfo.getServer();
}
}
for (DNSEntry addressEntry : this.getCache().getDNSEntryList(server, DNSRecordType.TYPE_A, DNSRecordClass.CLASS_ANY)) {
if (addressEntry instanceof DNSRecord) {
ServiceInfo cachedAddressInfo = ((DNSRecord) addressEntry).getServiceInfo(persistent);
if (cachedAddressInfo != null) {
for (Inet4Address address : cachedAddressInfo.getInet4Addresses()) {
cachedInfo.addAddress(address);
}
cachedInfo._setText(cachedAddressInfo.getTextBytes());
}
}
}
for (DNSEntry addressEntry : this.getCache().getDNSEntryList(server, DNSRecordType.TYPE_AAAA, DNSRecordClass.CLASS_ANY)) {
if (addressEntry instanceof DNSRecord) {
ServiceInfo cachedAddressInfo = ((DNSRecord) addressEntry).getServiceInfo(persistent);
if (cachedAddressInfo != null) {
for (Inet6Address address : cachedAddressInfo.getInet6Addresses()) {
cachedInfo.addAddress(address);
}
cachedInfo._setText(cachedAddressInfo.getTextBytes());
}
}
}
DNSEntry textEntry = this.getCache().getDNSEntry(cachedInfo.getQualifiedName(), DNSRecordType.TYPE_TXT, DNSRecordClass.CLASS_ANY);
if (textEntry instanceof DNSRecord) {
ServiceInfo cachedTextInfo = ((DNSRecord) textEntry).getServiceInfo(persistent);
if (cachedTextInfo != null) {
cachedInfo._setText(cachedTextInfo.getTextBytes());
}
}
if (cachedInfo.getTextBytes().length == 0) {
cachedInfo._setText(srvBytes);
}