mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
05.39.2014 05657815cae22885f67d7efc20ca39a11bb3ba4f
OPENDJ-1307 Migrate server ASN1 classes to SDK


ASN1 classes logging is throwing an UnsupportedOperationException while being used in the server. This exception is thrown by OpenDJLoggerAdapter from the opendj-slf4j-adapter in use in the server.
Changed OpenDJ SDK to use LocalizedLogger instead of raw slf4j-api (at least for IO category).
More work remains to switch all OpenDJ SDK to use LocalizedLogger instead of raw slf4j-api.


StaticUtils.java, *.java:
Removed DEFAULT_LOG and DEFAULT_LOGGER_NAME + replaced every uses of it by using per class LocalizedLoggers.
8 files modified
231 ■■■■ changed files
opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetSymmetricKeyExtendedRequest.java 13 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/com/forgerock/opendj/util/StaticUtils.java 13 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractLoadBalancingAlgorithm.java 21 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/CachedConnectionPool.java 48 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactory.java 24 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/Matcher.java 95 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/TimeoutChecker.java 13 ●●●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/TestCaseUtils.java 4 ●●● patch | view | raw | blame | history
opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetSymmetricKeyExtendedRequest.java
@@ -22,17 +22,16 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2013 ForgeRock AS
 *      Portions copyright 2013-2014 ForgeRock AS
 */
package com.forgerock.opendj.ldap.extensions;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_GET_SYMMETRIC_KEY_ASN1_DECODE_EXCEPTION;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_GET_SYMMETRIC_KEY_NO_VALUE;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import java.io.IOException;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.io.ASN1;
import org.forgerock.opendj.io.ASN1Reader;
import org.forgerock.opendj.io.ASN1Writer;
@@ -50,8 +49,6 @@
import org.forgerock.opendj.ldap.responses.ExtendedResultDecoder;
import org.forgerock.opendj.ldap.responses.Responses;
import com.forgerock.opendj.util.StaticUtils;
/**
 * Get symmetric key extended request.
 */
@@ -94,7 +91,7 @@
                return newRequest;
            } catch (final IOException ioe) {
                StaticUtils.DEFAULT_LOG.debug("", ioe);
                logger.debug(LocalizableMessage.raw("%s", ioe));
                final LocalizableMessage message =
                        ERR_GET_SYMMETRIC_KEY_ASN1_DECODE_EXCEPTION.get(ioe.getMessage());
@@ -117,6 +114,8 @@
        }
    }
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * The request OID for the get symmetric key extended operation.
     */
opendj-core/src/main/java/com/forgerock/opendj/util/StaticUtils.java
@@ -24,7 +24,6 @@
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 */
package com.forgerock.opendj.util;
import java.io.UnsupportedEncodingException;
@@ -47,25 +46,19 @@
import org.forgerock.i18n.LocalizableException;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ProviderNotFoundException;
import org.forgerock.opendj.ldap.spi.Provider;
import org.forgerock.util.Reject;
import org.forgerock.util.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
 * Common utility methods.
 */
public final class StaticUtils {
    private static final String DEFAULT_LOGGER_NAME = "org.forgerock.opendj.ldap";
    /**
     * The default logger used by the SDK if there is no appropriate specific logger.
     */
    public static final Logger DEFAULT_LOG = LoggerFactory.getLogger(DEFAULT_LOGGER_NAME);
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * Indicates whether the SDK is being used in debug mode. In debug mode
@@ -1741,7 +1734,7 @@
                System.err.println(builder);
            } else {
                // TODO: I18N
                DEFAULT_LOG.error("{}", builder);
                logger.error(LocalizableMessage.raw("%s", builder));
            }
        }
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractLoadBalancingAlgorithm.java
@@ -22,12 +22,10 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS.
 *      Portions copyright 2011-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
import static com.forgerock.opendj.util.StaticUtils.DEFAULT_LOG;
import static com.forgerock.opendj.util.StaticUtils.DEFAULT_SCHEDULER;
import static org.forgerock.opendj.ldap.ErrorResultException.*;
@@ -39,6 +37,8 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.util.Reject;
import com.forgerock.opendj.util.AsynchronousFutureResult;
@@ -153,7 +153,7 @@
        private synchronized void checkIfAvailable() {
            if (!isOperational.get()
                    && (pendingConnectFuture == null || pendingConnectFuture.isDone())) {
                DEFAULT_LOG.debug("Attempting reconnect to offline factory '{}'", this);
                logger.debug(LocalizableMessage.raw("Attempting reconnect to offline factory '%s'", this));
                pendingConnectFuture = factory.getConnectionAsync(this);
            }
        }
@@ -175,7 +175,7 @@
                synchronized (stateLock) {
                    offlineFactoriesCount++;
                    if (offlineFactoriesCount == 1) {
                        DEFAULT_LOG.debug("Starting monitoring thread");
                        logger.debug(LocalizableMessage.raw("Starting monitoring thread"));
                        monitoringFuture =
                                scheduler.get().scheduleWithFixedDelay(new MonitorRunnable(), 0,
                                        monitoringInterval, monitoringIntervalTimeUnit);
@@ -198,7 +198,7 @@
                synchronized (stateLock) {
                    offlineFactoriesCount--;
                    if (offlineFactoriesCount == 0) {
                        DEFAULT_LOG.debug("Stopping monitoring thread");
                        logger.debug(LocalizableMessage.raw("Stopping monitoring thread"));
                        monitoringFuture.cancel(false);
                        monitoringFuture = null;
@@ -209,7 +209,7 @@
        private void handleListenerException(RuntimeException e) {
            // TODO: I18N
            DEFAULT_LOG.error("A run-time error occurred while processing a load-balancer event", e);
            logger.error(LocalizableMessage.raw("A run-time error occurred while processing a load-balancer event", e));
        }
    }
@@ -226,6 +226,8 @@
        }
    }
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * A default event listener which just logs the event.
     */
@@ -235,13 +237,14 @@
        public void handleConnectionFactoryOnline(ConnectionFactory factory) {
            // Transition from offline to online.
            // TODO: I18N
            DEFAULT_LOG.info("Connection factory '{}' is now operational", factory);
            logger.info(LocalizableMessage.raw("Connection factory '%s' is now operational", factory));
        }
        @Override
        public void handleConnectionFactoryOffline(ConnectionFactory factory, ErrorResultException error) {
            // TODO: I18N
            DEFAULT_LOG.warn("Connection factory '{}' is no longer operational: {}", factory, error.getMessage());
            logger.warn(LocalizableMessage.raw("Connection factory '%s' is no longer operational: %s",
                    factory, error.getMessage()));
        }
    };
opendj-core/src/main/java/org/forgerock/opendj/ldap/CachedConnectionPool.java
@@ -22,13 +22,11 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
import static com.forgerock.opendj.util.StaticUtils.DEBUG_ENABLED;
import static com.forgerock.opendj.util.StaticUtils.DEFAULT_LOG;
import static com.forgerock.opendj.util.StaticUtils.DEFAULT_SCHEDULER;
import static com.forgerock.opendj.util.StaticUtils.getStackTraceIfDebugEnabled;
import static com.forgerock.opendj.util.StaticUtils.logIfDebugEnabled;
@@ -45,6 +43,8 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.requests.AbandonRequest;
import org.forgerock.opendj.ldap.requests.AddRequest;
import org.forgerock.opendj.ldap.requests.BindRequest;
@@ -89,8 +89,8 @@
            // Connection attempt failed, so decrease the pool size.
            availableConnections.release();
            DEFAULT_LOG.debug("Connection attempt failed: availableConnections={}, maxPoolSize={}",
                    currentPoolSize(), maxPoolSize, error);
            logger.debug(LocalizableMessage.raw("Connection attempt failed: availableConnections=%d, maxPoolSize=%d",
                    currentPoolSize(), maxPoolSize, error));
            QueueElement holder;
            synchronized (queue) {
@@ -108,8 +108,9 @@
        @Override
        public void handleResult(final Connection connection) {
            DEFAULT_LOG.debug("Connection attempt succeeded:  availableConnections={}, maxPoolSize={}",
                    currentPoolSize(), maxPoolSize);
            logger.debug(LocalizableMessage.raw(
                    "Connection attempt succeeded:  availableConnections=%d, maxPoolSize=%d",
                    currentPoolSize(), maxPoolSize));
            publishConnection(connection);
        }
    }
@@ -255,8 +256,9 @@
                connection.close();
                factory.getConnectionAsync(connectionResultHandler);
                DEFAULT_LOG.debug("Connection no longer valid: availableConnections={}, maxPoolSize={}",
                        currentPoolSize(), maxPoolSize);
                logger.debug(LocalizableMessage.raw(
                        "Connection no longer valid: availableConnections=%d, maxPoolSize=%d",
                        currentPoolSize(), maxPoolSize));
            }
            // Invoke listeners.
@@ -558,8 +560,9 @@
            // Close the idle connections.
            if (!idleConnections.isEmpty()) {
                DEFAULT_LOG.debug("Closing {} idle pooled connections: availableConnections={}, maxPoolSize={}",
                        idleConnections.size(), currentPoolSize(), maxPoolSize);
                logger.debug(LocalizableMessage.raw(
                        "Closing %d idle pooled connections: availableConnections=%d, maxPoolSize=%d",
                        idleConnections.size(), currentPoolSize(), maxPoolSize));
                for (final Connection connection : idleConnections) {
                    connection.close();
                }
@@ -646,6 +649,8 @@
        }
    }
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * This is package private in order to allow unit tests to inject fake time
     * stamps.
@@ -715,8 +720,9 @@
            }
        }
        DEFAULT_LOG.debug("Connection pool is closing: availableConnections={}, maxPoolSize={}",
                currentPoolSize(), maxPoolSize);
        logger.debug(LocalizableMessage.raw(
                "Connection pool is closing: availableConnections=%d, maxPoolSize=%d",
                currentPoolSize(), maxPoolSize));
        if (idleTimeoutFuture != null) {
            idleTimeoutFuture.cancel(false);
@@ -775,8 +781,9 @@
                    connection.close();
                    availableConnections.release();
                    DEFAULT_LOG.debug("Connection no longer valid: availableConnections={}, poolSize={}",
                            currentPoolSize(), maxPoolSize);
                    logger.debug(LocalizableMessage.raw(
                            "Connection no longer valid: availableConnections=%d, maxPoolSize=%d",
                            currentPoolSize(), maxPoolSize));
                }
            } else {
                // Grow the pool if needed.
@@ -847,9 +854,9 @@
            availableConnections.release();
            connection.close();
            DEFAULT_LOG.debug(
                    "Closing connection because connection pool is closing: availableConnections={}, maxPoolSize={}",
                    currentPoolSize(), maxPoolSize);
            logger.debug(LocalizableMessage.raw(
                    "Closing connection because connection pool is closing: availableConnections=%d, maxPoolSize=%d",
                    currentPoolSize(), maxPoolSize));
            if (holder != null) {
                final ErrorResultException e =
@@ -857,8 +864,9 @@
                                ERR_CONNECTION_POOL_CLOSING.get(toString()).toString());
                holder.getWaitingFuture().handleErrorResult(e);
                DEFAULT_LOG.debug("Connection attempt failed: availableConnections={}, poolSize={}",
                        currentPoolSize(), maxPoolSize, e);
                logger.debug(LocalizableMessage.raw(
                        "Connection attempt failed: availableConnections=%d, maxPoolSize=%d",
                        currentPoolSize(), maxPoolSize, e));
            }
        } else {
            holder.getWaitingFuture().handleResult(
opendj-core/src/main/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactory.java
@@ -22,16 +22,12 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS.
 *      Portions copyright 2011-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
import static com.forgerock.opendj.util.StaticUtils.DEFAULT_LOG;
import static com.forgerock.opendj.util.StaticUtils.DEFAULT_SCHEDULER;
import static com.forgerock.opendj.ldap.CoreMessages.HBCF_CONNECTION_CLOSED_BY_CLIENT;
import static com.forgerock.opendj.ldap.CoreMessages.HBCF_HEARTBEAT_FAILED;
import static com.forgerock.opendj.ldap.CoreMessages.HBCF_HEARTBEAT_TIMEOUT;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
import java.util.LinkedList;
@@ -47,6 +43,8 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.AbstractQueuedSynchronizer;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.requests.AbandonRequest;
import org.forgerock.opendj.ldap.requests.AddRequest;
import org.forgerock.opendj.ldap.requests.BindRequest;
@@ -497,8 +495,8 @@
                     * benign password policy related errors. See OPENDJ-1168
                     * and OPENDJ-1167.
                     */
                    DEFAULT_LOG.debug("Heartbeat failed for connection factory '{}'", factory,
                            error);
                    logger.debug(LocalizableMessage.raw("Heartbeat failed for connection factory '%s'", factory,
                            error));
                    timestamp(error);
                }
                releaseHeartBeatLock();
@@ -805,7 +803,7 @@
                 */
                final long currentTimeMillis = timeSource.currentTimeMillis();
                if (lastResponseTimestamp < (currentTimeMillis - timeoutMS)) {
                    DEFAULT_LOG.warn("No heartbeat detected for connection '{}'", connection);
                    logger.warn(LocalizableMessage.raw("No heartbeat detected for connection '%s'", connection));
                    handleConnectionError(false, newHeartBeatTimeoutError());
                }
            }
@@ -1072,6 +1070,8 @@
    }
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * Default heart beat which will target the root DSE but not return any
     * results.
@@ -1192,9 +1192,9 @@
        if (isClosed.compareAndSet(false, true)) {
            synchronized (validConnections) {
                if (!validConnections.isEmpty()) {
                    DEFAULT_LOG.debug(
                            "HeartbeatConnectionFactory '{}' is closing while {} active connections remain",
                            this, validConnections.size());
                    logger.debug(LocalizableMessage.raw(
                            "HeartbeatConnectionFactory '%s' is closing while %d active connections remain",
                            this, validConnections.size()));
                }
            }
            releaseScheduler();
opendj-core/src/main/java/org/forgerock/opendj/ldap/Matcher.java
@@ -22,16 +22,16 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2012-2013 ForgeRock AS.
 *      Portions copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
import static com.forgerock.opendj.util.StaticUtils.DEFAULT_LOG;
import java.util.ArrayList;
import java.util.List;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.forgerock.opendj.ldap.schema.MatchingRuleUse;
import org.forgerock.opendj.ldap.schema.Schema;
@@ -221,7 +221,7 @@
    private static final class Visitor implements FilterVisitor<MatcherImpl, Schema> {
        public MatcherImpl visitAndFilter(final Schema schema, final List<Filter> subFilters) {
            if (subFilters.isEmpty()) {
                DEFAULT_LOG.trace("Empty add filter component. Will always return TRUE");
                logger.trace(LocalizableMessage.raw("Empty add filter component. Will always return TRUE"));
                return TRUE;
            }
@@ -242,14 +242,15 @@
                ad = AttributeDescription.valueOf(attributeDescription, schema);
            } catch (final LocalizedIllegalArgumentException e) {
                // TODO: I18N
                DEFAULT_LOG.warn("Attribute description {} is not recognized", attributeDescription, e);
                logger.warn(LocalizableMessage.raw(
                        "Attribute description %s is not recognized", attributeDescription, e));
                return UNDEFINED;
            }
            if ((rule = ad.getAttributeType().getApproximateMatchingRule()) == null) {
                // TODO: I18N
                DEFAULT_LOG.warn("The attribute type {} does not define an approximate matching rule",
                        attributeDescription);
                logger.warn(LocalizableMessage.raw("The attribute type %s does not define an approximate matching rule",
                        attributeDescription));
                return UNDEFINED;
            }
@@ -257,7 +258,7 @@
                assertion = rule.getAssertion(assertionValue);
            } catch (final DecodeException de) {
                // TODO: I18N
                DEFAULT_LOG.warn("The assertion value {} is invalid", assertionValue, de);
                logger.warn(LocalizableMessage.raw("The assertion value %s is invalid", assertionValue, de));
                return UNDEFINED;
            }
            return new AssertionMatcherImpl(ad, rule, null, assertion, false);
@@ -273,15 +274,15 @@
                ad = AttributeDescription.valueOf(attributeDescription, schema);
            } catch (final LocalizedIllegalArgumentException e) {
                // TODO: I18N
                DEFAULT_LOG.warn("Attribute description {} is not recognized: {}",
                        attributeDescription, e.getMessage());
                logger.warn(LocalizableMessage.raw("Attribute description %s is not recognized",
                        attributeDescription, e));
                return UNDEFINED;
            }
            if ((rule = ad.getAttributeType().getEqualityMatchingRule()) == null) {
                // TODO: I18N
                DEFAULT_LOG.warn("The attribute type {} does not define an equality matching rule",
                        attributeDescription);
                logger.warn(LocalizableMessage.raw("The attribute type %s does not define an equality matching rule",
                        attributeDescription));
                return UNDEFINED;
            }
@@ -289,7 +290,7 @@
                assertion = rule.getAssertion(assertionValue);
            } catch (final DecodeException de) {
                // TODO: I18N
                DEFAULT_LOG.warn("The assertion value {} is invalid", assertionValue, de);
                logger.warn(LocalizableMessage.raw("The assertion value %s is invalid", assertionValue, de));
                return UNDEFINED;
            }
            return new AssertionMatcherImpl(ad, rule, null, assertion, false);
@@ -308,7 +309,7 @@
                    rule = schema.getMatchingRule(matchingRule);
                } catch (final UnknownSchemaElementException e) {
                    // TODO: I18N
                    DEFAULT_LOG.warn("Matching rule {} is not recognized", matchingRule);
                    logger.warn(LocalizableMessage.raw("Matching rule %s is not recognized", matchingRule));
                    return UNDEFINED;
                }
            }
@@ -318,15 +319,17 @@
                    ad = AttributeDescription.valueOf(attributeDescription, schema);
                } catch (final LocalizedIllegalArgumentException e) {
                    // TODO: I18N
                    DEFAULT_LOG.warn("Attribute description {} is not recognized", attributeDescription, e);
                    logger.warn(LocalizableMessage.raw("Attribute description %s is not recognized",
                            attributeDescription, e));
                    return UNDEFINED;
                }
                if (rule == null) {
                    if ((rule = ad.getAttributeType().getEqualityMatchingRule()) == null) {
                        // TODO: I18N
                        DEFAULT_LOG.warn("The attribute type {} does not define an equality matching rule",
                                attributeDescription);
                        logger.warn(LocalizableMessage.raw(
                                "The attribute type %s does not define an equality matching rule",
                                attributeDescription));
                        return UNDEFINED;
                    }
                } else {
@@ -334,13 +337,15 @@
                        ruleUse = schema.getMatchingRuleUse(rule);
                        if (!ruleUse.hasAttribute(ad.getAttributeType())) {
                            // TODO: I18N
                            DEFAULT_LOG.warn("The matching rule {} is not valid for attribute type {}",
                                    matchingRule, attributeDescription);
                            logger.warn(LocalizableMessage.raw(
                                    "The matching rule %s is not valid for attribute type %s",
                                    matchingRule, attributeDescription));
                            return UNDEFINED;
                        }
                    } catch (final UnknownSchemaElementException e) {
                        // TODO: I18N
                        DEFAULT_LOG.warn("No matching rule use is defined for matching rule {}", matchingRule);
                        logger.warn(LocalizableMessage.raw("No matching rule use is defined for matching rule %s",
                                matchingRule));
                        return UNDEFINED;
                    }
                }
@@ -349,7 +354,8 @@
                    ruleUse = schema.getMatchingRuleUse(rule);
                } catch (final UnknownSchemaElementException e) {
                    // TODO: I18N
                    DEFAULT_LOG.warn("No matching rule use is defined for matching rule {}", matchingRule);
                    logger.warn(LocalizableMessage.raw("No matching rule use is defined for matching rule %s",
                            matchingRule));
                    return UNDEFINED;
                }
            }
@@ -358,7 +364,7 @@
                assertion = rule.getAssertion(assertionValue);
            } catch (final DecodeException de) {
                // TODO: I18N
                DEFAULT_LOG.warn("The assertion value {} is invalid", assertionValue, de);
                logger.warn(LocalizableMessage.raw("The assertion value %s is invalid", assertionValue, de));
                return UNDEFINED;
            }
            return new AssertionMatcherImpl(ad, rule, ruleUse, assertion, dnAttributes);
@@ -374,15 +380,16 @@
                ad = AttributeDescription.valueOf(attributeDescription, schema);
            } catch (final LocalizedIllegalArgumentException e) {
                // TODO: I18N
                DEFAULT_LOG.warn("Attribute description {} is not recognized", attributeDescription, e);
                logger.warn(LocalizableMessage.raw("Attribute description %s is not recognized",
                        attributeDescription, e));
                return UNDEFINED;
            }
            if ((rule = ad.getAttributeType().getOrderingMatchingRule()) == null) {
                // TODO: I18N
                DEFAULT_LOG.warn("The attribute type {} does not define an ordering matching rule",
                        attributeDescription);
                logger.warn(LocalizableMessage.raw("The attribute type %s does not define an ordering matching rule",
                        attributeDescription));
                return UNDEFINED;
            }
@@ -390,7 +397,7 @@
                assertion = rule.getGreaterOrEqualAssertion(assertionValue);
            } catch (final DecodeException de) {
                // TODO: I18N
                DEFAULT_LOG.warn("The assertion value {} is invalid", assertionValue, de);
                logger.warn(LocalizableMessage.raw("The assertion value %s is invalid", assertionValue, de));
                return UNDEFINED;
            }
            return new AssertionMatcherImpl(ad, rule, null, assertion, false);
@@ -406,14 +413,15 @@
                ad = AttributeDescription.valueOf(attributeDescription, schema);
            } catch (final LocalizedIllegalArgumentException e) {
                // TODO: I18N
                DEFAULT_LOG.warn("Attribute description {} is not recognized", attributeDescription, e);
                logger.warn(LocalizableMessage.raw("Attribute description %s is not recognized",
                        attributeDescription, e));
                return UNDEFINED;
            }
            if ((rule = ad.getAttributeType().getOrderingMatchingRule()) == null) {
                // TODO: I18N
                DEFAULT_LOG.warn("The attribute type {} does not define an ordering matching rule",
                        attributeDescription);
                logger.warn(LocalizableMessage.raw("The attribute type %s does not define an ordering matching rule",
                        attributeDescription));
                return UNDEFINED;
            }
@@ -421,7 +429,7 @@
                assertion = rule.getLessOrEqualAssertion(assertionValue);
            } catch (final DecodeException de) {
                // TODO: I18N
                DEFAULT_LOG.warn("The assertion value {} is invalid", assertionValue , de);
                logger.warn(LocalizableMessage.raw("The assertion value %s is invalid", assertionValue , de));
                return UNDEFINED;
            }
            return new AssertionMatcherImpl(ad, rule, null, assertion, false);
@@ -434,7 +442,7 @@
        public MatcherImpl visitOrFilter(final Schema schema, final List<Filter> subFilters) {
            if (subFilters.isEmpty()) {
                DEFAULT_LOG.trace("Empty or filter component. Will always return FALSE");
                logger.trace(LocalizableMessage.raw("Empty or filter component. Will always return FALSE"));
                return FALSE;
            }
@@ -451,7 +459,8 @@
                ad = AttributeDescription.valueOf(attributeDescription, schema);
            } catch (final LocalizedIllegalArgumentException e) {
                // TODO: I18N
                DEFAULT_LOG.warn("Attribute description {} is not recognized", attributeDescription, e);
                logger.warn(LocalizableMessage.raw("Attribute description %s is not recognized",
                        attributeDescription, e));
                return UNDEFINED;
            }
@@ -469,14 +478,15 @@
                ad = AttributeDescription.valueOf(attributeDescription, schema);
            } catch (final LocalizedIllegalArgumentException e) {
                // TODO: I18N
                DEFAULT_LOG.warn("Attribute description {} is not recognized", attributeDescription, e);
                logger.warn(LocalizableMessage.raw("Attribute description %s is not recognized",
                        attributeDescription, e));
                return UNDEFINED;
            }
            if ((rule = ad.getAttributeType().getSubstringMatchingRule()) == null) {
                // TODO: I18N
                DEFAULT_LOG.warn("The attribute type {} does not define an substring matching rule",
                        attributeDescription);
                logger.warn(LocalizableMessage.raw("The attribute type %s does not define an substring matching rule",
                        attributeDescription));
                return UNDEFINED;
            }
@@ -484,7 +494,7 @@
                assertion = rule.getSubstringAssertion(initialSubstring, anySubstrings, finalSubstring);
            } catch (final DecodeException de) {
                // TODO: I18N
                DEFAULT_LOG.warn("The substring assertion values contain an invalid value", de);
                logger.warn(LocalizableMessage.raw("The substring assertion values contain an invalid value", de));
                return UNDEFINED;
            }
            return new AssertionMatcherImpl(ad, rule, null, assertion, false);
@@ -493,12 +503,14 @@
        public MatcherImpl visitUnrecognizedFilter(final Schema schema, final byte filterTag,
                final ByteString filterBytes) {
            // TODO: I18N
            DEFAULT_LOG.warn("The type of filtering requested with tag {} is not implemented",
                    StaticUtils.byteToHex(filterTag));
            logger.warn(LocalizableMessage.raw("The type of filtering requested with tag %s is not implemented",
                    StaticUtils.byteToHex(filterTag)));
            return UNDEFINED;
        }
    }
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    private static final MatcherImpl FALSE = new FalseMatcherImpl();
    private static final MatcherImpl TRUE = new TrueMatcherImpl();
@@ -533,8 +545,9 @@
            return assertion.matches(normalizedValue);
        } catch (final DecodeException de) {
            // TODO: I18N
            DEFAULT_LOG.warn("The attribute value {} is invalid for matching rule {}. Possible schema error?",
                    v, rule.getNameOrOID(), de);
            logger.warn(LocalizableMessage.raw(
                    "The attribute value %s is invalid for matching rule %s. Possible schema error?",
                    v, rule.getNameOrOID(), de));
            return ConditionResult.UNDEFINED;
        }
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/TimeoutChecker.java
@@ -22,15 +22,18 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2013 ForgeRock AS.
 *      Portions copyright 2013-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
import static com.forgerock.opendj.util.StaticUtils.DEFAULT_LOG;
import static java.util.Collections.newSetFromMap;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import com.forgerock.opendj.util.ReferenceCountedObject;
/**
@@ -57,6 +60,8 @@
                }
            };
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * Condition variable used for coordinating the timeout thread.
     */
@@ -84,7 +89,7 @@
        final Thread checkerThread = new Thread("OpenDJ LDAP SDK Timeout Checker") {
            @Override
            public void run() {
                DEFAULT_LOG.debug("Timeout Checker Starting");
                logger.debug(LocalizableMessage.raw("Timeout Checker Starting"));
                while (!shutdownRequested) {
                    /*
                     * New listeners may be added during iteration and may not
@@ -97,7 +102,7 @@
                    long delay = Long.MAX_VALUE;
                    pendingListenerMinDelay = Long.MAX_VALUE;
                    for (final TimeoutEventListener listener : listeners) {
                        DEFAULT_LOG.trace("Checking connection {} delay = {}", listener, delay);
                        logger.trace(LocalizableMessage.raw("Checking connection %s delay = %d", listener, delay));
                        // May update the connections set.
                        final long newDelay = listener.handleTimeout(currentTime);
opendj-core/src/test/java/org/forgerock/opendj/ldap/TestCaseUtils.java
@@ -24,7 +24,6 @@
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
import static org.fest.assertions.Fail.fail;
@@ -48,7 +47,6 @@
import org.mockito.stubbing.OngoingStubbing;
import com.forgerock.opendj.util.CompletedFutureResult;
import com.forgerock.opendj.util.StaticUtils;
import com.forgerock.opendj.util.TimeSource;
/**
@@ -266,7 +264,7 @@
     * @param level logging level to use
     */
    public static void setDefaultLogLevel(Level level) {
        Logger.getLogger(StaticUtils.DEFAULT_LOG.getName()).setLevel(level);
        Logger.getLogger("org.forgerock.opendj.ldap").setLevel(level);
    }
}