use of de.measite.minidns.hla.ResolutionUnsuccessfulException in project Smack by igniterealtime.
the class MiniDnsResolver method lookupSRVRecords0.
@Override
protected List<SRVRecord> lookupSRVRecords0(final String name, List<HostAddress> failedAddresses, DnssecMode dnssecMode) {
final ResolverApi resolver = getResolver(dnssecMode);
ResolverResult<SRV> result;
try {
result = resolver.resolve(name, SRV.class);
} catch (IOException e) {
failedAddresses.add(new HostAddress(name, e));
return null;
}
// TODO: Use ResolverResult.getResolutionUnsuccessfulException() found in newer MiniDNS versions.
if (!result.wasSuccessful()) {
ResolutionUnsuccessfulException resolutionUnsuccessfulException = getExceptionFrom(result);
failedAddresses.add(new HostAddress(name, resolutionUnsuccessfulException));
return null;
}
if (shouldAbortIfNotAuthentic(name, dnssecMode, result, failedAddresses)) {
return null;
}
List<SRVRecord> res = new LinkedList<SRVRecord>();
for (SRV srv : result.getAnswers()) {
String hostname = srv.name.ace;
List<InetAddress> hostAddresses = lookupHostAddress0(hostname, failedAddresses, dnssecMode);
if (hostAddresses == null) {
continue;
}
SRVRecord srvRecord = new SRVRecord(hostname, srv.port, srv.priority, srv.weight, hostAddresses);
res.add(srvRecord);
}
return res;
}
use of de.measite.minidns.hla.ResolutionUnsuccessfulException in project Smack by igniterealtime.
the class MiniDnsResolver method getExceptionFrom.
private static ResolutionUnsuccessfulException getExceptionFrom(ResolverResult<?> result) {
Question question = result.getQuestion();
RESPONSE_CODE responseCode = result.getResponseCode();
ResolutionUnsuccessfulException resolutionUnsuccessfulException = new ResolutionUnsuccessfulException(question, responseCode);
return resolutionUnsuccessfulException;
}
Aggregations