Skip to content

Commit 6eabbe1

Browse files
authored
feat: remove and replace JndiDnsResolve with DnsJavaResolver (#2195)
This is a cleanup, to remove and replace JndiDnsResolver with DnsJavaResolver
1 parent 1acd8d1 commit 6eabbe1

File tree

3 files changed

+2
-85
lines changed

3 files changed

+2
-85
lines changed

core/src/main/java/com/google/cloud/sql/core/DnsJavaResolver.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.net.UnknownHostException;
2020
import java.util.Arrays;
2121
import java.util.Collection;
22-
import java.util.Collections;
2322
import java.util.stream.Collectors;
2423
import javax.naming.NameNotFoundException;
2524
import org.xbill.DNS.Lookup;
@@ -91,7 +90,7 @@ public Collection<String> resolveTxt(String domainName) throws NameNotFoundExcep
9190
// 5. Process the records, sort them, and return.
9291
Record[] records = lookup.getAnswers();
9392
if (records == null || records.length == 0) {
94-
return Collections.emptyList();
93+
throw new NameNotFoundException("DNS record type TXT not found for " + domainName);
9594
}
9695

9796
// A single TXT record can contain multiple strings, so we use flatMap.

core/src/main/java/com/google/cloud/sql/core/InternalConnectorRegistry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ private Connector createConnector(ConnectorConfig config) {
338338
MIN_REFRESH_DELAY_MS,
339339
connectTimeoutMs,
340340
serverProxyPort,
341-
new DnsInstanceConnectionNameResolver(new JndiDnsResolver()),
341+
new DnsInstanceConnectionNameResolver(new DnsJavaResolver()),
342342
this.mdxProtocolHandler);
343343
}
344344

core/src/main/java/com/google/cloud/sql/core/JndiDnsResolver.java

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)