Commit 719cfe6f authored by Greg Thomas's avatar Greg Thomas Committed by Guus der Kinderen

Determine the class name from the class, rather than hard-coding it

parent fe357fc1
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
package org.jivesoftware.openfire.ldap; package org.jivesoftware.openfire.ldap;
import com.sun.jndi.ldap.LdapCtxFactory;
import org.jivesoftware.openfire.group.GroupNotFoundException; import org.jivesoftware.openfire.group.GroupNotFoundException;
import org.jivesoftware.openfire.user.UserNotFoundException; import org.jivesoftware.openfire.user.UserNotFoundException;
import org.jivesoftware.util.JiveGlobals; import org.jivesoftware.util.JiveGlobals;
...@@ -82,6 +84,7 @@ import java.util.regex.Pattern; ...@@ -82,6 +84,7 @@ import java.util.regex.Pattern;
public class LdapManager { public class LdapManager {
private static final Logger Log = LoggerFactory.getLogger(LdapManager.class); private static final Logger Log = LoggerFactory.getLogger(LdapManager.class);
private static final String DEFAULT_LDAP_CONTEXT_FACTORY = LdapCtxFactory.class.getName();
private static LdapManager instance; private static LdapManager instance;
static { static {
...@@ -409,12 +412,12 @@ public class LdapManager { ...@@ -409,12 +412,12 @@ public class LdapManager {
catch (ClassNotFoundException cnfe) { catch (ClassNotFoundException cnfe) {
Log.error("Initial context factory class failed to load: " + initialContextFactory + Log.error("Initial context factory class failed to load: " + initialContextFactory +
". Using default initial context factory class instead."); ". Using default initial context factory class instead.");
initialContextFactory = "com.sun.jndi.ldap.LdapCtxFactory"; initialContextFactory = DEFAULT_LDAP_CONTEXT_FACTORY;
} }
} }
// Use default value if none was set. // Use default value if none was set.
else { else {
initialContextFactory = "com.sun.jndi.ldap.LdapCtxFactory"; initialContextFactory = DEFAULT_LDAP_CONTEXT_FACTORY;
} }
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment