Source:
<code>private void onExpectedResponse( DnsQuestion question, AddressedEnvelope<DnsResponse, InetSocketAddress> envelope, final DnsQueryLifecycleObserver queryLifecycleObserver, Promise<List<T>> promise) { final DnsResponse response = envelope.content(); final Map<String, String> cnames = buildAliasMap(response, cnameCache(), parent.executor()); final int answerCount = response.count(DnsSection.ANSWER); boolean found = false; for (int i = 0; i < answerCount; i ++) { final DnsRecord r = response.recordAt(DnsSection.ANSWER, i); final DnsRecordType type = r.type(); boolean matches = false; for (DnsRecordType expectedType : expectedTypes) { if (type == expectedType) { matches = true; break; } } if (!matches) { continue; } final String questionName = question.name().toLowerCase(Locale.US); final String recordName = r.name().toLowerCase(Locale.US); if (!recordName.equals(questionName)) { Map<String, String> cnamesCopy = new HashMap<String, String>(cnames); String resolved = questionName; do { resolved = cnamesCopy.remove(resolved); if (recordName.equals(resolved)) { break; } } while (resolved != null); if (resolved == null) { continue; } } final T converted = convertRecord(r, hostname, additionals, parent.executor()); if (converted == null) { continue; } if (finalResult == null) { finalResult = new ArrayList<T>(8); finalResult.add(converted); <START> } else { <END> if (!finalResult.contains(converted)) { finalResult.add(converted); } } cache(hostname, additionals, r, converted); found = true; } if (cnames.isEmpty()) { if (found) { queryLifecycleObserver.querySucceed(); return; } queryLifecycleObserver.queryFailed(NO_MATCHING_RECORD_QUERY_FAILED_EXCEPTION); } else { queryLifecycleObserver.querySucceed(); onResponseCNAME(question, cnames, newDnsQueryLifecycleObserver(question), promise); } }</code><technical_language>nit: this else if</technical_language>

Target:
private void onExpectedResponse( DnsQuestion question, AddressedEnvelope<DnsResponse, InetSocketAddress> envelope, final DnsQueryLifecycleObserver queryLifecycleObserver, Promise<List<T>> promise) { final DnsResponse response = envelope.content(); final Map<String, String> cnames = buildAliasMap(response, cnameCache(), parent.executor()); final int answerCount = response.count(DnsSection.ANSWER); boolean found = false; for (int i = 0; i < answerCount; i ++) { final DnsRecord r = response.recordAt(DnsSection.ANSWER, i); final DnsRecordType type = r.type(); boolean matches = false; for (DnsRecordType expectedType : expectedTypes) { if (type == expectedType) { matches = true; break; } } if (!matches) { continue; } final String questionName = question.name().toLowerCase(Locale.US); final String recordName = r.name().toLowerCase(Locale.US); if (!recordName.equals(questionName)) { Map<String, String> cnamesCopy = new HashMap<String, String>(cnames); String resolved = questionName; do { resolved = cnamesCopy.remove(resolved); if (recordName.equals(resolved)) { break; } } while (resolved != null); if (resolved == null) { continue; } } final T converted = convertRecord(r, hostname, additionals, parent.executor()); if (converted == null) { continue; } if (finalResult == null) { finalResult = new ArrayList<T>(8); finalResult.add(converted); } else if (!finalResult.contains(converted)) { finalResult.add(converted); } cache(hostname, additionals, r, converted); found = true; } if (cnames.isEmpty()) { if (found) { queryLifecycleObserver.querySucceed(); return; } queryLifecycleObserver.queryFailed(NO_MATCHING_RECORD_QUERY_FAILED_EXCEPTION); } else { queryLifecycleObserver.querySucceed(); onResponseCNAME(question, cnames, newDnsQueryLifecycleObserver(question), promise); } }