1.1 --- a/src/share/classes/com/sun/jndi/ldap/ServiceLocator.java Tue Aug 04 17:19:21 2020 -0300 1.2 +++ b/src/share/classes/com/sun/jndi/ldap/ServiceLocator.java Mon Nov 12 08:33:59 2018 -0800 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -25,11 +25,7 @@ 1.11 1.12 package com.sun.jndi.ldap; 1.13 1.14 -import java.util.Arrays; 1.15 -import java.util.Hashtable; 1.16 -import java.util.Random; 1.17 -import java.util.StringTokenizer; 1.18 -import java.util.List; 1.19 +import java.util.*; 1.20 1.21 import javax.naming.*; 1.22 import javax.naming.directory.*; 1.23 @@ -113,6 +109,23 @@ 1.24 * @return An ordered list of hostports for the LDAP service or null if 1.25 * the service has not been located. 1.26 */ 1.27 + static String[] getLdapService(String domainName, Map<?,?> environment) { 1.28 + if (environment instanceof Hashtable) { 1.29 + return getLdapService(domainName, (Hashtable)environment); 1.30 + } 1.31 + return getLdapService(domainName, new Hashtable<>(environment)); 1.32 + } 1.33 + 1.34 + /** 1.35 + * Locates the LDAP service for a given domain. 1.36 + * Queries DNS for a list of LDAP Service Location Records (SRV) for a 1.37 + * given domain name. 1.38 + * 1.39 + * @param domainName A string domain name. 1.40 + * @param environment The possibly null environment of the context. 1.41 + * @return An ordered list of hostports for the LDAP service or null if 1.42 + * the service has not been located. 1.43 + */ 1.44 static String[] getLdapService(String domainName, Hashtable<?,?> environment) { 1.45 1.46 if (domainName == null || domainName.length() == 0) {