Skip to content

Commit 1e918ad

Browse files
change 'isShortSrvHost' to 'srvHostHasLessThanThreeParts' and remove redundant code comment as per code review comment
1 parent 49ee4c4 commit 1e918ad

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

driver-core/src/main/com/mongodb/internal/dns/DefaultDnsResolver.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ public List<String> resolveHostFromSrvRecords(final String srvHost, final String
7070
List<String> srvHostParts = asList(srvHost.split("\\."));
7171

7272
String srvHostDomain;
73-
boolean isShortSrvHost = srvHostParts.size() < 3;
74-
if (isShortSrvHost) {
75-
srvHostDomain = srvHost; // when dot separated parts less than 3, domain name is the host per se
73+
boolean srvHostHasLessThanThreeParts = srvHostParts.size() < 3;
74+
if (srvHostHasLessThanThreeParts) {
75+
srvHostDomain = srvHost;
7676
} else {
7777
srvHostDomain = srvHost.substring(srvHost.indexOf('.') + 1);
7878
}
@@ -89,7 +89,7 @@ public List<String> resolveHostFromSrvRecords(final String srvHost, final String
8989
for (String srvRecord : srvAttributeValues) {
9090
String[] split = srvRecord.split(" ");
9191
String resolvedHost = split[3].endsWith(".") ? split[3].substring(0, split[3].length() - 1) : split[3];
92-
if (isShortSrvHost && resolvedHost.equals(srvHost)) {
92+
if (srvHostHasLessThanThreeParts && resolvedHost.equals(srvHost)) {
9393
throw new MongoConfigurationException(
9494
format("The SRV host name '%s' has less than three parts and the resolved host '%s' is identical.",
9595
srvHost, resolvedHost)

0 commit comments

Comments
 (0)