@Test public void shouldUseJndi_trueIfLocalhostOverriden() { boolean enableJndi = true; boolean enableJndiLocalhost = true; String host = "localhost"; assertTrue(DnsNameResolver.shouldUseJndi(enableJndi, enableJndiLocalhost, host)); }
@VisibleForTesting static boolean shouldUseJndi(boolean jndiEnabled, boolean jndiLocalhostEnabled, String target) { if (!jndiEnabled) { return false; } if ("localhost".equalsIgnoreCase(target)) { return jndiLocalhostEnabled; } if (target.contains(":")) { return false; } boolean alldigits = true; for (int i = 0; i < target.length(); i++) { char c = target.charAt(i); if (c != '.') { alldigits &= (c >= '0' && c <= '9'); } } return !alldigits; }
DnsNameResolver extends NameResolver { @VisibleForTesting static boolean shouldUseJndi(boolean jndiEnabled, boolean jndiLocalhostEnabled, String target) { if (!jndiEnabled) { return false; } if ("localhost".equalsIgnoreCase(target)) { return jndiLocalhostEnabled; } if (target.contains(":")) { return false; } boolean alldigits = true; for (int i = 0; i < target.length(); i++) { char c = target.charAt(i); if (c != '.') { alldigits &= (c >= '0' && c <= '9'); } } return !alldigits; } }
DnsNameResolver extends NameResolver { @VisibleForTesting static boolean shouldUseJndi(boolean jndiEnabled, boolean jndiLocalhostEnabled, String target) { if (!jndiEnabled) { return false; } if ("localhost".equalsIgnoreCase(target)) { return jndiLocalhostEnabled; } if (target.contains(":")) { return false; } boolean alldigits = true; for (int i = 0; i < target.length(); i++) { char c = target.charAt(i); if (c != '.') { alldigits &= (c >= '0' && c <= '9'); } } return !alldigits; } DnsNameResolver(@Nullable String nsAuthority, String name, Attributes params,
      Resource<Executor> executorResource, ProxyDetector proxyDetector,
      Stopwatch stopwatch, boolean isAndroid); }
DnsNameResolver extends NameResolver { @VisibleForTesting static boolean shouldUseJndi(boolean jndiEnabled, boolean jndiLocalhostEnabled, String target) { if (!jndiEnabled) { return false; } if ("localhost".equalsIgnoreCase(target)) { return jndiLocalhostEnabled; } if (target.contains(":")) { return false; } boolean alldigits = true; for (int i = 0; i < target.length(); i++) { char c = target.charAt(i); if (c != '.') { alldigits &= (c >= '0' && c <= '9'); } } return !alldigits; } DnsNameResolver(@Nullable String nsAuthority, String name, Attributes params,
      Resource<Executor> executorResource, ProxyDetector proxyDetector,
      Stopwatch stopwatch, boolean isAndroid); @Override final String getServiceAuthority(); @Override final synchronized void start(Listener listener); @Override final synchronized void refresh(); @Override final synchronized void shutdown(); }
DnsNameResolver extends NameResolver { @VisibleForTesting static boolean shouldUseJndi(boolean jndiEnabled, boolean jndiLocalhostEnabled, String target) { if (!jndiEnabled) { return false; } if ("localhost".equalsIgnoreCase(target)) { return jndiLocalhostEnabled; } if (target.contains(":")) { return false; } boolean alldigits = true; for (int i = 0; i < target.length(); i++) { char c = target.charAt(i); if (c != '.') { alldigits &= (c >= '0' && c <= '9'); } } return !alldigits; } DnsNameResolver(@Nullable String nsAuthority, String name, Attributes params,
      Resource<Executor> executorResource, ProxyDetector proxyDetector,
      Stopwatch stopwatch, boolean isAndroid); @Override final String getServiceAuthority(); @Override final synchronized void start(Listener listener); @Override final synchronized void refresh(); @Override final synchronized void shutdown();  }