log.logInfo("POST: " + providers[i].getName());
log.logDebug("POST: " + providers[i].getName());
    public final synchronized void setConfig(final Element config)    throws DirectoryManagerConfigurationException {        // Sanity checks.        if (config == null)            throw new IllegalArgumentException("Configuration cannot be NULL");        if (!config.getName().equalsIgnoreCase("Backend"))            throw new DirectoryManagerConfigurationException("Cannot find backend configuration element");        // Get JNDI element, with sanity check.        final Element jndiElement = config.getChild("JNDI");        if (jndiElement == null)            throw new DirectoryManagerConfigurationException("Cannot find JNDI configuration element");        // Get optional timeout value.        String timeout = jndiElement.getAttributeValue("timeout");        if (timeout != null) {            try {                backendTimeouts = Integer.parseInt(timeout);            } catch (NumberFormatException e) {                throw new DirectoryManagerConfigurationException("\"" + timeout + "\" is not a legal timeout value", e);            }        }        if (backendTimeouts < 0)            backendTimeouts = 0;        // Get username attribute and guessed attribute.        usernameAttribute = jndiElement.getAttributeValue("usernameAttribute");        if (usernameAttribute == null)            throw new DirectoryManagerConfigurationException("Attribute \"usernameAttribute\" not found in JNDI element");        guessedAttribute = jndiElement.getAttributeValue("guessedAttribute", "uid");        // TODO: Add support for javax.net.ssl.keystore.        // Get the optional Security element.        final Element securityElement = jndiElement.getChild("Security");        if (securityElement != null) {            // Get the optional Truststore element.            final Element trustStoreElement = securityElement.getChild("Truststore");            if (trustStoreElement != null) {                // Get truststore filename and check that it exists.                String value = trustStoreElement.getAttributeValue("filename");                if (value == null)                    throw new DirectoryManagerConfigurationException("Attribute \"filename\" not found in Truststore element");                if (!(new File(value).exists()))                    throw new DirectoryManagerConfigurationException("Truststore file " + value + " does not exist");                                // DEBUG                Provider[] providers = Security.getProviders();                for (int i=0; i<providers.length; i++) {                    log.logInfo("PRE: " + providers[i].getName());                }                                // Explicitly set com.sun.net.ssl.internal.ssl.Provider...                com.sun.net.ssl.internal.ssl.Provider.install();                Security.insertProviderAt(new com.sun.net.ssl.internal.ssl.Provider(), 1);                                System.setProperty("java.protocol.handler.pkgs", "javax.net.ssl");                                // DEBUG                providers = Security.getProviders();                for (int i=0; i<providers.length; i++) {                    log.logInfo("POST: " + providers[i].getName());                }                                                // Get and set truststore filename.                log.logInfo("Truststore was " + System.getProperty("javax.net.ssl.trustStore"));  // DEBUG                               System.setProperty("javax.net.ssl.trustStore", value);                log.logInfo("Truststore is now " + System.getProperty("javax.net.ssl.trustStore"));  // DEBUG                log.logInfo("Truststore should be " + value);  // DEBUG                // Get and set truststore password.                value = trustStoreElement.getAttributeValue("password");                if (value == null)                    throw new DirectoryManagerConfigurationException("Attribute \"password\" not found in Truststore element");                System.setProperty("javax.net.ssl.trustStorePassword", value);                log.logInfo("System: " + System.getProperties().toString());  // DEBUG                // Now we're ready to use SSL.                Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());                useSSL = true;            }        }    }