protected DirContext createContext(Hashtable<String, Object> environment) {
		DirContext ctx = null;

		try {
			ctx = getDirContextInstance(environment);

			if (LOG.isInfoEnabled()) {
				Hashtable<?, ?> ctxEnv = ctx.getEnvironment();
				String ldapUrl = (String) ctxEnv.get(Context.PROVIDER_URL);
				LOG.debug("Got Ldap context on server '" + ldapUrl + "'");
			}

			return ctx;
		}
		catch (NamingException e) {
			closeContext(ctx);
			throw LdapUtils.convertLdapException(e);
		}
	}
protected DirContext createContext ( Hashtable < String , Object > environment ) { DirContext ctx = null ; try { ctx = getDirContextInstance ( environment ) ; if ( LOG . isInfoEnabled ( ) ) { Hashtable < ? , ? > ctxEnv = ctx . getEnvironment ( ) ; String ldapUrl = ( String ) ctxEnv . get ( Context . PROVIDER_URL ) ; LOG . debug ( "Got Ldap context on server '" + ldapUrl + "'" ) ; } return ctx ; } catch ( NamingException e ) { closeContext ( ctx ) ; throw LdapUtils . convertLdapException ( e ) ; } }
Create a DirContext using the supplied environment.

@param environment the LDAP environment to use when creating the
<code>DirContext</code>.
@return a new DirContext implementation initialized with the supplied
environment.