Use NamingManager instead of LdapCtxFactory
Fixes deprecation warnings on LdapCtxFactory
This commit is contained in:
parent
c49cb230eb
commit
c9ca73b94c
|
@ -19,7 +19,6 @@ package org.apache.archiva.redback.common.ldap.connection;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import com.sun.jndi.ldap.LdapCtxFactory;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -32,6 +31,7 @@ import java.util.Collections;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import javax.naming.spi.NamingManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The configuration for a connection will not change.
|
* The configuration for a connection will not change.
|
||||||
|
@ -43,15 +43,6 @@ public class DefaultLdapConnection
|
||||||
implements LdapConnection
|
implements LdapConnection
|
||||||
{
|
{
|
||||||
|
|
||||||
private static LdapCtxFactory ctxFactory;// = new LdapCtxFactory();
|
|
||||||
|
|
||||||
|
|
||||||
static
|
|
||||||
{
|
|
||||||
initCtxFactory();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private Logger log = LoggerFactory.getLogger( getClass() );
|
private Logger log = LoggerFactory.getLogger( getClass() );
|
||||||
|
|
||||||
private LdapConnectionConfiguration config;
|
private LdapConnectionConfiguration config;
|
||||||
|
@ -60,11 +51,6 @@ public class DefaultLdapConnection
|
||||||
|
|
||||||
private List<Rdn> baseDnRdns;
|
private List<Rdn> baseDnRdns;
|
||||||
|
|
||||||
private static void initCtxFactory()
|
|
||||||
{
|
|
||||||
ctxFactory = new LdapCtxFactory();
|
|
||||||
}
|
|
||||||
|
|
||||||
public DefaultLdapConnection( LdapConnectionConfiguration config, Rdn subRdn )
|
public DefaultLdapConnection( LdapConnectionConfiguration config, Rdn subRdn )
|
||||||
throws LdapException
|
throws LdapException
|
||||||
{
|
{
|
||||||
|
@ -92,7 +78,7 @@ public class DefaultLdapConnection
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
context = (DirContext) ctxFactory.getInitialContext( e );
|
context = (DirContext) NamingManager.getInitialContext( e );
|
||||||
}
|
}
|
||||||
catch ( NamingException ex )
|
catch ( NamingException ex )
|
||||||
{
|
{
|
||||||
|
@ -121,7 +107,7 @@ public class DefaultLdapConnection
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
context = (DirContext) ctxFactory.getInitialContext( e );
|
context = (DirContext) NamingManager.getInitialContext( e );
|
||||||
}
|
}
|
||||||
catch ( NamingException ex )
|
catch ( NamingException ex )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue