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

Jean-Noel Rouvignac
05.01.2014 fc0581038c52a52687e6158097daad475485fff7
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 CONTROLS_LOG and SCHEMA_LOG + replaced every uses of it by using per class LocalizedLoggers.
28 files modified
421 ■■■■ changed files
opendj-core/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControl.java 12 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/com/forgerock/opendj/util/StaticUtils.java 10 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/EntryChangeNotificationResponseControl.java 9 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/MatchedValuesRequestControl.java 10 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiringResponseControl.java 13 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyResponseControl.java 9 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchRequestControl.java 14 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PostReadRequestControl.java 18 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PostReadResponseControl.java 10 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PreReadRequestControl.java 14 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PreReadResponseControl.java 10 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV1RequestControl.java 9 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV2RequestControl.java 9 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/SimplePagedResultsControl.java 41 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/SubentriesRequestControl.java 9 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxImpl.java 18 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxImpl.java 24 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRuleSyntaxImpl.java 21 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DoubleMetaphoneApproximateMatchingRuleImpl.java 15 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleImpl.java 9 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerFirstComponentEqualityMatchingRuleImpl.java 13 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleImpl.java 10 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxDescriptionSyntaxImpl.java 26 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxImpl.java 20 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxImpl.java 19 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NameFormSyntaxImpl.java 17 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassSyntaxImpl.java 20 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxImpl.java 12 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControl.java
@@ -28,14 +28,12 @@
import static com.forgerock.opendj.util.StaticUtils.byteToHex;
import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_ACCTUSABLERES_CONTROL_BAD_OID;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_ACCTUSABLERES_DECODE_ERROR;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_ACCTUSABLERES_NO_CONTROL_VALUE;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_ACCTUSABLERES_UNKNOWN_VALUE_ELEMENT_TYPE;
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;
@@ -46,7 +44,6 @@
import org.forgerock.opendj.ldap.controls.Control;
import org.forgerock.opendj.ldap.controls.ControlDecoder;
import com.forgerock.opendj.util.StaticUtils;
import org.forgerock.util.Reject;
/**
@@ -70,6 +67,9 @@
 * @see AccountUsabilityRequestControl
 */
public final class AccountUsabilityResponseControl implements Control {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * The OID for the account usability response control.
     */
@@ -149,7 +149,7 @@
                            throw DecodeException.error(message);
                        }
                    } catch (final IOException e) {
                        StaticUtils.CONTROLS_LOG.debug("", e);
                        logger.debug(LocalizableMessage.raw("%s", e));
                        final LocalizableMessage message =
                                ERR_ACCTUSABLERES_DECODE_ERROR.get(getExceptionMessage(e));
opendj-core/src/main/java/com/forgerock/opendj/util/StaticUtils.java
@@ -68,16 +68,6 @@
    public static final Logger DEFAULT_LOG = LoggerFactory.getLogger(DEFAULT_LOGGER_NAME);
    /**
     * The logger used by the SDK for controls related features.
     */
    public static final Logger CONTROLS_LOG = LoggerFactory.getLogger(DEFAULT_LOGGER_NAME + ".controls");
    /**
     * The logger used by the SDK for schema related features.
     */
    public static final Logger SCHEMA_LOG = LoggerFactory.getLogger(DEFAULT_LOGGER_NAME + ".schema");
    /**
     * Indicates whether the SDK is being used in debug mode. In debug mode
     * components may enable certain instrumentation in order to help debug
     * applications.
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/EntryChangeNotificationResponseControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2013 ForgeRock AS.
 *      Portions copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
@@ -33,6 +33,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.io.ASN1;
import org.forgerock.opendj.io.ASN1Reader;
import org.forgerock.opendj.io.ASN1Writer;
@@ -44,8 +45,6 @@
import org.forgerock.opendj.ldap.schema.Schema;
import org.forgerock.util.Reject;
import com.forgerock.opendj.util.StaticUtils;
/**
 * The entry change notification response control as defined in
 * draft-ietf-ldapext-psearch. This control provides additional information
@@ -93,6 +92,8 @@
 *      - Persistent Search: A Simple LDAP Change Notification Mechanism </a>
 */
public final class EntryChangeNotificationResponseControl implements Control {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * The OID for the entry change notification response control.
     */
@@ -167,7 +168,7 @@
                            changeNumber = reader.readInteger();
                        }
                    } catch (final IOException e) {
                        StaticUtils.CONTROLS_LOG.debug("", e);
                        logger.debug(LocalizableMessage.raw("%s", e));
                        final LocalizableMessage message =
                                ERR_ECN_CANNOT_DECODE_VALUE.get(getExceptionMessage(e));
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/MatchedValuesRequestControl.java
@@ -22,9 +22,8 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2012-2013 ForgeRock AS.
 *      Portions copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
import static com.forgerock.opendj.ldap.CoreMessages.*;
@@ -39,6 +38,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.io.ASN1;
import org.forgerock.opendj.io.ASN1Reader;
import org.forgerock.opendj.io.ASN1Writer;
@@ -51,8 +51,6 @@
import org.forgerock.opendj.ldap.Filter;
import org.forgerock.util.Reject;
import com.forgerock.opendj.util.StaticUtils;
/**
 * The matched values request control as defined in RFC 3876. The matched values
 * control may be included in a search request to indicate that only attribute
@@ -148,6 +146,8 @@
        }
    }
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * The OID for the matched values request control used to specify which
     * particular attribute values should be returned in a search result entry.
@@ -205,7 +205,7 @@
                        return new MatchedValuesRequestControl(control.isCritical(), Collections
                                .unmodifiableList(filters));
                    } catch (final IOException e) {
                        StaticUtils.CONTROLS_LOG.debug("", e);
                        logger.debug(LocalizableMessage.raw("%s", e));
                        final LocalizableMessage message =
                                ERR_MATCHEDVALUES_CANNOT_DECODE_VALUE_AS_SEQUENCE
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiringResponseControl.java
@@ -22,21 +22,18 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2013 ForgeRock AS
 *      Portions copyright 2013-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.controls;
import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_PWEXPIRING_CANNOT_DECODE_SECONDS_UNTIL_EXPIRATION;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_PWEXPIRING_CONTROL_BAD_OID;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_PWEXPIRING_NO_CONTROL_VALUE;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import com.forgerock.opendj.util.StaticUtils;
import org.forgerock.util.Reject;
/**
@@ -69,6 +66,8 @@
 *      - Password Policy for LDAP Directories </a>
 */
public final class PasswordExpiringResponseControl implements Control {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * The OID for the Netscape password expiring response control.
     */
@@ -104,7 +103,7 @@
                    try {
                        secondsUntilExpiration = Integer.parseInt(control.getValue().toString());
                    } catch (final Exception e) {
                        StaticUtils.CONTROLS_LOG.debug("", e);
                        logger.debug(LocalizableMessage.raw("%s", e));
                        final LocalizableMessage message =
                                ERR_PWEXPIRING_CANNOT_DECODE_SECONDS_UNTIL_EXPIRATION
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyResponseControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2013 ForgeRock AS.
 *      Portions copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
@@ -33,6 +33,7 @@
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;
@@ -42,8 +43,6 @@
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.util.Reject;
import com.forgerock.opendj.util.StaticUtils;
/**
 * The password policy response control as defined in
 * draft-behera-ldap-password-policy.
@@ -98,6 +97,8 @@
 *      </a>
 */
public final class PasswordPolicyResponseControl implements Control {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * The OID for the password policy control from
     * draft-behera-ldap-password-policy.
@@ -182,7 +183,7 @@
                        return new PasswordPolicyResponseControl(control.isCritical(), warningType,
                                warningValue, errorType);
                    } catch (final IOException e) {
                        StaticUtils.CONTROLS_LOG.debug("", e);
                        logger.debug(LocalizableMessage.raw("%s", e));
                        final LocalizableMessage message =
                                ERR_PWPOLICYRES_DECODE_ERROR.get(getExceptionMessage(e));
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchRequestControl.java
@@ -22,15 +22,12 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2013 ForgeRock AS.
 *      Portions copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_PSEARCH_BAD_CHANGE_TYPES;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_PSEARCH_CANNOT_DECODE_VALUE;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_PSEARCH_CONTROL_BAD_OID;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_PSEARCH_NO_CONTROL_VALUE;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import java.io.IOException;
import java.util.Arrays;
@@ -40,6 +37,7 @@
import java.util.Set;
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;
@@ -47,8 +45,6 @@
import org.forgerock.opendj.ldap.ByteStringBuilder;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import com.forgerock.opendj.util.StaticUtils;
import org.forgerock.util.Reject;
/**
@@ -100,6 +96,8 @@
 *      - Persistent Search: A Simple LDAP Change Notification Mechanism </a>
 */
public final class PersistentSearchRequestControl implements Control {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * The OID for the persistent search request control.
     */
@@ -146,7 +144,7 @@
                        reader.readEndSequence();
                    } catch (final IOException e) {
                        StaticUtils.CONTROLS_LOG.debug("Unable to read sequence", e);
                        logger.debug(LocalizableMessage.raw("Unable to read sequence", e));
                        final LocalizableMessage message =
                                ERR_PSEARCH_CANNOT_DECODE_VALUE.get(getExceptionMessage(e));
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PostReadRequestControl.java
@@ -22,18 +22,13 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2012-2013 ForgeRock AS.
 *      Portions copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import static java.util.Collections.unmodifiableList;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_POSTREADREQ_CANNOT_DECODE_VALUE;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_POSTREADREQ_NO_CONTROL_VALUE;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_POSTREAD_CONTROL_BAD_OID;
import static java.util.Collections.*;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import java.io.IOException;
import java.util.ArrayList;
@@ -42,6 +37,7 @@
import java.util.List;
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;
@@ -49,8 +45,6 @@
import org.forgerock.opendj.ldap.ByteStringBuilder;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import com.forgerock.opendj.util.StaticUtils;
import org.forgerock.util.Reject;
/**
@@ -84,6 +78,8 @@
 *      Directory Access Protocol (LDAP) Read Entry Controls </a>
 */
public final class PostReadRequestControl implements Control {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * The IANA-assigned OID for the LDAP post-read request control used for
     * retrieving an entry in the state it had immediately after an update was
@@ -149,7 +145,7 @@
                        }
                        reader.readEndSequence();
                    } catch (final Exception ae) {
                        StaticUtils.CONTROLS_LOG.debug("Unable to read sequence", ae);
                        logger.debug(LocalizableMessage.raw("Unable to read sequence", ae));
                        final LocalizableMessage message =
                                ERR_POSTREADREQ_CANNOT_DECODE_VALUE.get(ae.getMessage());
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PostReadResponseControl.java
@@ -22,9 +22,8 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2013 ForgeRock AS.
 *      Portions copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
import static com.forgerock.opendj.ldap.CoreMessages.*;
@@ -32,6 +31,7 @@
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.LDAP;
@@ -41,8 +41,6 @@
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.Entries;
import org.forgerock.opendj.ldap.Entry;
import com.forgerock.opendj.util.StaticUtils;
import org.forgerock.util.Reject;
/**
@@ -77,6 +75,8 @@
 *      Directory Access Protocol (LDAP) Read Entry Controls </a>
 */
public final class PostReadResponseControl implements Control {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * The IANA-assigned OID for the LDAP post-read response control used for
     * retrieving an entry in the state it had immediately after an update was
@@ -115,7 +115,7 @@
                    try {
                        entry = LDAP.readEntry(reader, options);
                    } catch (final IOException le) {
                        StaticUtils.CONTROLS_LOG.debug("Unable to read result entry ", le);
                        logger.debug(LocalizableMessage.raw("Unable to read result entry ", le));
                        final LocalizableMessage message =
                                ERR_POSTREADRESP_CANNOT_DECODE_VALUE.get(le.getMessage());
                        throw DecodeException.error(message, le);
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PreReadRequestControl.java
@@ -22,18 +22,15 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2012-2013 ForgeRock AS.
 *      Portions copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import static java.util.Collections.unmodifiableList;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_PREREADREQ_CANNOT_DECODE_VALUE;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_PREREADREQ_NO_CONTROL_VALUE;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_PREREAD_CONTROL_BAD_OID;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import java.io.IOException;
import java.util.ArrayList;
@@ -42,6 +39,7 @@
import java.util.List;
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;
@@ -49,8 +47,6 @@
import org.forgerock.opendj.ldap.ByteStringBuilder;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import com.forgerock.opendj.util.StaticUtils;
import org.forgerock.util.Reject;
/**
@@ -83,6 +79,8 @@
 *      Directory Access Protocol (LDAP) Read Entry Controls </a>
 */
public final class PreReadRequestControl implements Control {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * The IANA-assigned OID for the LDAP pre-read request control used for
     * retrieving an entry in the state it had immediately before an update was
@@ -148,7 +146,7 @@
                        }
                        reader.readEndSequence();
                    } catch (final Exception ex) {
                        StaticUtils.CONTROLS_LOG.debug("Unable to read sequence", ex);
                        logger.debug(LocalizableMessage.raw("Unable to read sequence", ex));
                        final LocalizableMessage message =
                                ERR_PREREADREQ_CANNOT_DECODE_VALUE.get(ex.getMessage());
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PreReadResponseControl.java
@@ -22,9 +22,8 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2013 ForgeRock AS.
 *      Portions copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
import static com.forgerock.opendj.ldap.CoreMessages.*;
@@ -32,6 +31,7 @@
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.LDAP;
@@ -41,8 +41,6 @@
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.Entries;
import org.forgerock.opendj.ldap.Entry;
import com.forgerock.opendj.util.StaticUtils;
import org.forgerock.util.Reject;
/**
@@ -76,6 +74,8 @@
 *      Directory Access Protocol (LDAP) Read Entry Controls </a>
 */
public final class PreReadResponseControl implements Control {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * The IANA-assigned OID for the LDAP pre-read response control used for
     * retrieving an entry in the state it had immediately before an update was
@@ -114,7 +114,7 @@
                    try {
                        entry = LDAP.readEntry(reader, options);
                    } catch (final IOException le) {
                        StaticUtils.CONTROLS_LOG.debug("Unable to read result entry", le);
                        logger.debug(LocalizableMessage.raw("Unable to read result entry", le));
                        final LocalizableMessage message =
                                ERR_PREREADRESP_CANNOT_DECODE_VALUE.get(le.getMessage());
                        throw DecodeException.error(message, le);
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV1RequestControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2013 ForgeRock AS.
 *      Portions copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
@@ -33,6 +33,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.io.ASN1;
import org.forgerock.opendj.io.ASN1Reader;
import org.forgerock.opendj.io.ASN1Writer;
@@ -42,8 +43,6 @@
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.schema.Schema;
import com.forgerock.opendj.util.StaticUtils;
import org.forgerock.util.Reject;
/**
@@ -64,6 +63,8 @@
 *      draft-weltman-ldapv3-proxy-04 - LDAP Proxied Authorization Control </a>
 */
public final class ProxiedAuthV1RequestControl implements Control {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * The OID for the proxied authorization v1 control.
     */
@@ -109,7 +110,7 @@
                        authorizationDNString = reader.readOctetStringAsString();
                        reader.readEndSequence();
                    } catch (final IOException e) {
                        StaticUtils.CONTROLS_LOG.debug("Unable to read sequence", e);
                        logger.debug(LocalizableMessage.raw("Unable to read sequence", e));
                        final LocalizableMessage message =
                                ERR_PROXYAUTH1_CANNOT_DECODE_VALUE.get(getExceptionMessage(e));
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV2RequestControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2013 ForgeRock AS.
 *      Portions copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
@@ -33,13 +33,12 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.io.ASN1;
import org.forgerock.opendj.io.ASN1Reader;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import com.forgerock.opendj.util.StaticUtils;
import org.forgerock.util.Reject;
/**
@@ -77,6 +76,8 @@
 *      SASL Authorization Identities (authzId) </a>
 */
public final class ProxiedAuthV2RequestControl implements Control {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * The OID for the proxied authorization v2 control.
     */
@@ -129,7 +130,7 @@
                            authorizationID = control.getValue().toString();
                        }
                    } catch (final IOException e) {
                        StaticUtils.CONTROLS_LOG.debug("Unable to read exceptionID", e);
                        logger.debug(LocalizableMessage.raw("Unable to read exceptionID", e));
                        final LocalizableMessage message =
                                ERR_PROXYAUTH2_CANNOT_DECODE_VALUE.get(getExceptionMessage(e));
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/SimplePagedResultsControl.java
@@ -22,16 +22,16 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2013 ForgeRock AS.
 *      Portions copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import static com.forgerock.opendj.util.StaticUtils.CONTROLS_LOG;
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;
@@ -132,6 +132,8 @@
 *      Extension for Simple Paged Results Manipulation </a>
 */
public final class SimplePagedResultsControl implements Control {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * The OID for the paged results request/response control defined in RFC
     * 2696.
@@ -154,58 +156,43 @@
                    }
                    if (!control.getOID().equals(OID)) {
                        final LocalizableMessage message =
                                ERR_LDAP_PAGED_RESULTS_CONTROL_BAD_OID.get(control.getOID(), OID);
                        throw DecodeException.error(message);
                        throw DecodeException.error(ERR_LDAP_PAGED_RESULTS_CONTROL_BAD_OID.get(control.getOID(), OID));
                    }
                    if (!control.hasValue()) {
                        // The control must always have a value.
                        final LocalizableMessage message = ERR_LDAP_PAGED_RESULTS_DECODE_NULL.get();
                        throw DecodeException.error(message);
                        throw DecodeException.error(ERR_LDAP_PAGED_RESULTS_DECODE_NULL.get());
                    }
                    final ASN1Reader reader = ASN1.getReader(control.getValue());
                    try {
                        reader.readStartSequence();
                    } catch (final Exception e) {
                        CONTROLS_LOG.debug("Unable to read start sequence", e);
                        final LocalizableMessage message =
                                ERR_LDAP_PAGED_RESULTS_DECODE_SEQUENCE.get(String.valueOf(e));
                        throw DecodeException.error(message, e);
                        logger.debug(LocalizableMessage.raw("Unable to read start sequence", e));
                        throw DecodeException.error(ERR_LDAP_PAGED_RESULTS_DECODE_SEQUENCE.get(e), e);
                    }
                    int size;
                    try {
                        size = (int) reader.readInteger();
                    } catch (final Exception e) {
                        CONTROLS_LOG.debug("Unable to read size", e);
                        final LocalizableMessage message =
                                ERR_LDAP_PAGED_RESULTS_DECODE_SIZE.get(String.valueOf(e));
                        throw DecodeException.error(message, e);
                        logger.debug(LocalizableMessage.raw("Unable to read size", e));
                        throw DecodeException.error(ERR_LDAP_PAGED_RESULTS_DECODE_SIZE.get(e), e);
                    }
                    ByteString cookie;
                    try {
                        cookie = reader.readOctetString();
                    } catch (final Exception e) {
                        CONTROLS_LOG.debug("Unable to read cookie", e);
                        final LocalizableMessage message =
                                ERR_LDAP_PAGED_RESULTS_DECODE_COOKIE.get(String.valueOf(e));
                        throw DecodeException.error(message, e);
                        logger.debug(LocalizableMessage.raw("Unable to read cookie", e));
                        throw DecodeException.error(ERR_LDAP_PAGED_RESULTS_DECODE_COOKIE.get(e), e);
                    }
                    try {
                        reader.readEndSequence();
                    } catch (final Exception e) {
                        CONTROLS_LOG.debug("Unable to read end sequence", e);
                        final LocalizableMessage message =
                                ERR_LDAP_PAGED_RESULTS_DECODE_SEQUENCE.get(String.valueOf(e));
                        throw DecodeException.error(message, e);
                        logger.debug(LocalizableMessage.raw("Unable to read end sequence", e));
                        throw DecodeException.error(ERR_LDAP_PAGED_RESULTS_DECODE_SEQUENCE.get(e), e);
                    }
                    return new SimplePagedResultsControl(control.isCritical(), size, cookie);
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/SubentriesRequestControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.controls;
@@ -34,6 +34,7 @@
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;
@@ -41,8 +42,6 @@
import org.forgerock.opendj.ldap.ByteStringBuilder;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import com.forgerock.opendj.util.StaticUtils;
import org.forgerock.util.Reject;
/**
@@ -93,6 +92,8 @@
 *      the Lightweight Directory Access Protocol </a>
 */
public final class SubentriesRequestControl implements Control {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * The OID for the sub-entries request control.
     */
@@ -138,7 +139,7 @@
                    try {
                        visibility = reader.readBoolean();
                    } catch (final IOException e) {
                        StaticUtils.CONTROLS_LOG.debug("Unable to read visbility", e);
                        logger.debug(LocalizableMessage.raw("Unable to read visbility", e));
                        final LocalizableMessage message =
                                ERR_SUBENTRIES_CANNOT_DECODE_VALUE.get(getExceptionMessage(e));
                        throw DecodeException.error(message);
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxImpl.java
@@ -22,18 +22,16 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_ATTRIBUTE_TYPE_NAME;
import static com.forgerock.opendj.util.StaticUtils.SCHEMA_LOG;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
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.DecodeException;
@@ -46,6 +44,8 @@
 */
final class AttributeTypeSyntaxImpl extends AbstractSyntaxImpl {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    @Override
    public String getEqualityMatchingRule() {
        return EMR_OID_FIRST_COMPONENT_OID;
@@ -75,7 +75,7 @@
                final LocalizableMessage message =
                        ERR_ATTR_SYNTAX_ATTRTYPE_EMPTY_VALUE1.get(definition);
                final DecodeException e = DecodeException.error(message);
                SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
@@ -87,7 +87,7 @@
                        ERR_ATTR_SYNTAX_ATTRTYPE_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader
                                .pos() - 1), String.valueOf(c));
                final DecodeException e = DecodeException.error(message);
                SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
@@ -198,7 +198,7 @@
                                WARN_ATTR_SYNTAX_ATTRTYPE_INVALID_ATTRIBUTE_USAGE1.get(definition,
                                        usageStr);
                        final DecodeException e = DecodeException.error(message);
                        SCHEMA_LOG.debug("", e);
                        logger.debug(LocalizableMessage.raw("%s", e));
                        throw e;
                    }
                } else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
@@ -213,7 +213,7 @@
                    final LocalizableMessage message =
                            ERR_ATTR_SYNTAX_ATTRTYPE_ILLEGAL_TOKEN1.get(definition, tokenName);
                    final DecodeException e = DecodeException.error(message);
                    SCHEMA_LOG.debug("", e);
                    logger.debug(LocalizableMessage.raw("%s", e));
                    throw e;
                }
            }
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxImpl.java
@@ -22,21 +22,16 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_DCR_EMPTY_VALUE1;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_DCR_EXPECTED_OPEN_PARENTHESIS;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_DCR_ILLEGAL_TOKEN1;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_DCR_INVALID1;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_DIT_CONTENT_RULE_NAME;
import static com.forgerock.opendj.util.StaticUtils.SCHEMA_LOG;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
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.DecodeException;
@@ -49,6 +44,8 @@
 */
final class DITContentRuleSyntaxImpl extends AbstractSyntaxImpl {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    @Override
    public String getEqualityMatchingRule() {
        return EMR_OID_FIRST_COMPONENT_OID;
@@ -82,7 +79,7 @@
                // whitespace. That is illegal.
                final LocalizableMessage message = ERR_ATTR_SYNTAX_DCR_EMPTY_VALUE1.get(definition);
                final DecodeException e = DecodeException.error(message);
                SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
@@ -91,10 +88,9 @@
            final char c = reader.read();
            if (c != '(') {
                final LocalizableMessage message =
                        ERR_ATTR_SYNTAX_DCR_EXPECTED_OPEN_PARENTHESIS.get(definition,
                                (reader.pos() - 1), String.valueOf(c));
                        ERR_ATTR_SYNTAX_DCR_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader.pos() - 1), c);
                final DecodeException e = DecodeException.error(message);
                SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
@@ -151,7 +147,7 @@
                    final LocalizableMessage message =
                            ERR_ATTR_SYNTAX_DCR_ILLEGAL_TOKEN1.get(definition, tokenName);
                    final DecodeException e = DecodeException.error(message);
                    SCHEMA_LOG.debug("", e);
                    logger.debug(LocalizableMessage.raw("%s", e));
                    throw e;
                }
            }
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRuleSyntaxImpl.java
@@ -22,21 +22,19 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_INTEGER_FIRST_COMPONENT_OID;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_DIT_STRUCTURE_RULE_NAME;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
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.DecodeException;
import com.forgerock.opendj.util.StaticUtils;
import com.forgerock.opendj.util.SubstringReader;
/**
@@ -46,6 +44,8 @@
 */
final class DITStructureRuleSyntaxImpl extends AbstractSyntaxImpl {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    @Override
    public String getEqualityMatchingRule() {
        return EMR_INTEGER_FIRST_COMPONENT_OID;
@@ -76,7 +76,7 @@
                // whitespace. That is illegal.
                final LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_EMPTY_VALUE1.get(definition);
                final DecodeException e = DecodeException.error(message);
                StaticUtils.SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
@@ -85,10 +85,9 @@
            final char c = reader.read();
            if (c != '(') {
                final LocalizableMessage message =
                        ERR_ATTR_SYNTAX_DSR_EXPECTED_OPEN_PARENTHESIS.get(definition,
                                (reader.pos() - 1), String.valueOf(c));
                        ERR_ATTR_SYNTAX_DSR_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader.pos() - 1), c);
                final DecodeException e = DecodeException.error(message);
                StaticUtils.SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
@@ -143,7 +142,7 @@
                    final LocalizableMessage message =
                            ERR_ATTR_SYNTAX_DSR_ILLEGAL_TOKEN1.get(definition, tokenName);
                    final DecodeException e = DecodeException.error(message);
                    StaticUtils.SCHEMA_LOG.debug("", e);
                    logger.debug(LocalizableMessage.raw("%s", e));
                    throw e;
                }
            }
@@ -151,7 +150,7 @@
            if (nameForm == null) {
                final LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_NO_NAME_FORM.get(definition);
                final DecodeException e = DecodeException.error(message);
                StaticUtils.SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
            return true;
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DoubleMetaphoneApproximateMatchingRuleImpl.java
@@ -22,15 +22,15 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2013 ForgeRock AS
 *      Portions copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteString;
import com.forgerock.opendj.util.StaticUtils;
/**
 * This class defines an approximate matching rule based on the Double Metaphone
 * algorithm. The Metaphone and Double Metaphone algorithms were originally
@@ -51,6 +51,8 @@
 */
final class DoubleMetaphoneApproximateMatchingRuleImpl extends AbstractMatchingRuleImpl {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * {@inheritDoc}
     */
@@ -891,11 +893,8 @@
            return true;
        } catch (final Exception e) {
            if (StaticUtils.SCHEMA_LOG.isDebugEnabled()) {
                StaticUtils.SCHEMA_LOG.debug("Unable to check that '" + value + "' has substring '" + substring
                        + "' at position " + start, e);
            }
            logger.debug(LocalizableMessage.raw(
                "Unable to check that '%s' has substring '%s' at position %d: %s", value, substring, start, e));
            return false;
        }
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleImpl.java
@@ -26,27 +26,28 @@
 */
package org.forgerock.opendj.ldap.schema;
import static com.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_ILLEGAL_INTEGER;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
import com.forgerock.opendj.util.StaticUtils;
/**
 * This class defines the integerMatch matching rule defined in X.520 and
 * referenced in RFC 2252.
 */
final class IntegerEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
            throws DecodeException {
        try {
            return ByteString.valueOf(Integer.parseInt(value.toString()));
        } catch (final Exception e) {
            StaticUtils.SCHEMA_LOG.debug("", e);
            logger.debug(LocalizableMessage.raw("%s", e));
            final LocalizableMessage message =
                    WARN_ATTR_SYNTAX_ILLEGAL_INTEGER.get(value.toString());
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerFirstComponentEqualityMatchingRuleImpl.java
@@ -22,22 +22,19 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2013 ForgeRock AS
 *      Portions copyright 2013-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_EMPTY_VALUE;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_EXPECTED_OPEN_PARENTHESIS;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_EMR_INTFIRSTCOMP_FIRST_COMPONENT_NOT_INT;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.Assertion;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ConditionResult;
import org.forgerock.opendj.ldap.DecodeException;
import com.forgerock.opendj.util.StaticUtils;
import com.forgerock.opendj.util.SubstringReader;
/**
@@ -50,6 +47,8 @@
 */
final class IntegerFirstComponentEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    @Override
    public Assertion getAssertion(final Schema schema, final ByteSequence value)
            throws DecodeException {
@@ -66,7 +65,7 @@
                }
            };
        } catch (final Exception e) {
            StaticUtils.SCHEMA_LOG.debug("", e);
            logger.debug(LocalizableMessage.raw("%s", e));
            final LocalizableMessage message =
                    ERR_EMR_INTFIRSTCOMP_FIRST_COMPONENT_NOT_INT.get(value.toString());
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleImpl.java
@@ -22,30 +22,32 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.schema;
import static com.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_ILLEGAL_INTEGER;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
import com.forgerock.opendj.util.StaticUtils;
/**
 * This class defines the integerOrderingMatch matching rule defined in X.520
 * and referenced in RFC 4519.
 */
final class IntegerOrderingMatchingRuleImpl extends AbstractOrderingMatchingRuleImpl {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
            throws DecodeException {
        try {
            return ByteString.valueOf(Integer.parseInt(value.toString()));
        } catch (final Exception e) {
            StaticUtils.SCHEMA_LOG.debug("", e);
            logger.debug(LocalizableMessage.raw("%s", e));
            final LocalizableMessage message =
                    WARN_ATTR_SYNTAX_ILLEGAL_INTEGER.get(value.toString());
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxDescriptionSyntaxImpl.java
@@ -22,15 +22,12 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_LDAP_SYNTAX_NAME;
import static com.forgerock.opendj.util.StaticUtils.SCHEMA_LOG;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
import java.util.Collections;
import java.util.HashMap;
@@ -41,6 +38,7 @@
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.DecodeException;
@@ -53,6 +51,8 @@
 */
final class LDAPSyntaxDescriptionSyntaxImpl extends AbstractSyntaxImpl {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    @Override
    public String getEqualityMatchingRule() {
        return EMR_OID_FIRST_COMPONENT_OID;
@@ -84,7 +84,7 @@
                final LocalizableMessage message =
                        ERR_ATTR_SYNTAX_ATTRSYNTAX_EMPTY_VALUE1.get(definition);
                final DecodeException e = DecodeException.error(message);
                SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
@@ -93,10 +93,9 @@
            final char c = reader.read();
            if (c != '(') {
                final LocalizableMessage message =
                        ERR_ATTR_SYNTAX_ATTRSYNTAX_EXPECTED_OPEN_PARENTHESIS.get(definition,
                                (reader.pos() - 1), String.valueOf(c));
                        ERR_ATTR_SYNTAX_ATTRSYNTAX_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader.pos() - 1), c);
                final DecodeException e = DecodeException.error(message);
                SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
@@ -141,7 +140,7 @@
                    final LocalizableMessage message =
                            ERR_ATTR_SYNTAX_ATTRSYNTAX_ILLEGAL_TOKEN1.get(definition, tokenName);
                    final DecodeException e = DecodeException.error(message);
                    SCHEMA_LOG.debug("", e);
                    logger.debug(LocalizableMessage.raw("%s", e));
                    throw e;
                }
            }
@@ -158,7 +157,7 @@
                                    WARN_ATTR_SYNTAX_LDAPSYNTAX_REGEX_INVALID_PATTERN.get(oid,
                                            pattern);
                            final DecodeException de = DecodeException.error(message, e);
                            SCHEMA_LOG.debug("", de);
                            logger.debug(LocalizableMessage.raw("%s", e));
                            throw de;
                        }
                        break;
@@ -170,10 +169,9 @@
                        for (int j = i + 1; j < values.size(); j++) {
                            if (entry.equals(values.get(j))) {
                                final LocalizableMessage message =
                                        WARN_ATTR_SYNTAX_LDAPSYNTAX_ENUM_DUPLICATE_VALUE.get(oid,
                                                entry, j);
                                        WARN_ATTR_SYNTAX_LDAPSYNTAX_ENUM_DUPLICATE_VALUE.get(oid, entry, j);
                                final DecodeException e = DecodeException.error(message);
                                SCHEMA_LOG.debug("", e);
                                logger.debug(LocalizableMessage.raw("%s", e));
                                throw e;
                            }
                        }
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxImpl.java
@@ -22,18 +22,16 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_MATCHING_RULE_NAME;
import static com.forgerock.opendj.util.StaticUtils.SCHEMA_LOG;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
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.DecodeException;
@@ -46,6 +44,8 @@
 */
final class MatchingRuleSyntaxImpl extends AbstractSyntaxImpl {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    @Override
    public String getEqualityMatchingRule() {
        return EMR_OID_FIRST_COMPONENT_OID;
@@ -90,7 +90,7 @@
                // whitespace. That is illegal.
                final LocalizableMessage message = ERR_ATTR_SYNTAX_MR_EMPTY_VALUE1.get(definition);
                final DecodeException e = DecodeException.error(message);
                SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
@@ -100,9 +100,9 @@
            if (c != '(') {
                final LocalizableMessage message =
                        ERR_ATTR_SYNTAX_MR_EXPECTED_OPEN_PARENTHESIS.get(definition,
                                (reader.pos() - 1), String.valueOf(c));
                                (reader.pos() - 1), c);
                final DecodeException e = DecodeException.error(message);
                SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
@@ -155,7 +155,7 @@
                    final LocalizableMessage message =
                            ERR_ATTR_SYNTAX_MR_ILLEGAL_TOKEN1.get(definition, tokenName);
                    final DecodeException e = DecodeException.error(message);
                    SCHEMA_LOG.debug("", e);
                    logger.debug(LocalizableMessage.raw("%s", e));
                    throw e;
                }
            }
@@ -164,7 +164,7 @@
            if (syntax == null) {
                final LocalizableMessage message = ERR_ATTR_SYNTAX_MR_NO_SYNTAX.get(definition);
                final DecodeException e = DecodeException.error(message);
                SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
            return true;
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxImpl.java
@@ -22,20 +22,19 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_MATCHING_RULE_USE_NAME;
import static com.forgerock.opendj.util.StaticUtils.SCHEMA_LOG;
import java.util.Set;
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.DecodeException;
@@ -48,6 +47,8 @@
 */
final class MatchingRuleUseSyntaxImpl extends AbstractSyntaxImpl {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    @Override
    public String getEqualityMatchingRule() {
        return EMR_OID_FIRST_COMPONENT_OID;
@@ -93,7 +94,7 @@
                final LocalizableMessage message =
                        ERR_ATTR_SYNTAX_MRUSE_EMPTY_VALUE1.get(definition);
                final DecodeException e = DecodeException.error(message);
                SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
@@ -102,10 +103,10 @@
            final char c = reader.read();
            if (c != '(') {
                final LocalizableMessage message =
                        ERR_ATTR_SYNTAX_MRUSE_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader
                                .pos() - 1), String.valueOf(c));
                        ERR_ATTR_SYNTAX_MRUSE_EXPECTED_OPEN_PARENTHESIS.get(definition,
                                (reader.pos() - 1), c);
                final DecodeException e = DecodeException.error(message);
                SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
@@ -158,7 +159,7 @@
                    final LocalizableMessage message =
                            ERR_ATTR_SYNTAX_MRUSE_ILLEGAL_TOKEN1.get(definition, tokenName);
                    final DecodeException e = DecodeException.error(message);
                    SCHEMA_LOG.debug("", e);
                    logger.debug(LocalizableMessage.raw("%s", e));
                    throw e;
                }
            }
@@ -167,7 +168,7 @@
            if (attributes == null || attributes.size() == 0) {
                final LocalizableMessage message = ERR_ATTR_SYNTAX_MRUSE_NO_ATTR.get(definition);
                final DecodeException e = DecodeException.error(message);
                SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
            return true;
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NameFormSyntaxImpl.java
@@ -22,20 +22,19 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_NAME_FORM_NAME;
import static com.forgerock.opendj.util.StaticUtils.SCHEMA_LOG;
import java.util.Set;
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.DecodeException;
@@ -48,6 +47,8 @@
 */
final class NameFormSyntaxImpl extends AbstractSyntaxImpl {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    @Override
    public String getEqualityMatchingRule() {
        return EMR_OID_FIRST_COMPONENT_OID;
@@ -79,7 +80,7 @@
                final LocalizableMessage message =
                        ERR_ATTR_SYNTAX_NAME_FORM_EMPTY_VALUE1.get(definition);
                final DecodeException e = DecodeException.error(message);
                SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
@@ -91,7 +92,7 @@
                        ERR_ATTR_SYNTAX_NAME_FORM_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader
                                .pos() - 1), c);
                final DecodeException e = DecodeException.error(message);
                SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
@@ -151,7 +152,7 @@
                    final LocalizableMessage message =
                            ERR_ATTR_SYNTAX_NAME_FORM_ILLEGAL_TOKEN1.get(definition, tokenName);
                    final DecodeException e = DecodeException.error(message);
                    SCHEMA_LOG.debug("", e);
                    logger.debug(LocalizableMessage.raw("%s", e));
                    throw e;
                }
            }
@@ -162,7 +163,7 @@
                final LocalizableMessage message =
                        ERR_ATTR_SYNTAX_NAME_FORM_NO_STRUCTURAL_CLASS1.get(definition);
                final DecodeException e = DecodeException.error(message);
                SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
@@ -170,7 +171,7 @@
                final LocalizableMessage message =
                        ERR_ATTR_SYNTAX_NAME_FORM_NO_REQUIRED_ATTR.get(definition);
                final DecodeException e = DecodeException.error(message);
                SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
            return true;
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassSyntaxImpl.java
@@ -22,21 +22,17 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_OBJECTCLASS_EMPTY_VALUE1;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_OBJECTCLASS_EXPECTED_OPEN_PARENTHESIS1;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_OBJECTCLASS_ILLEGAL_TOKEN1;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_OBJECTCLASS_INVALID1;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_OBJECTCLASS_NAME;
import static com.forgerock.opendj.util.StaticUtils.SCHEMA_LOG;
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.DecodeException;
@@ -49,6 +45,8 @@
 */
final class ObjectClassSyntaxImpl extends AbstractSyntaxImpl {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    @Override
    public String getEqualityMatchingRule() {
        return EMR_OID_FIRST_COMPONENT_OID;
@@ -80,7 +78,7 @@
                final LocalizableMessage message =
                        ERR_ATTR_SYNTAX_OBJECTCLASS_EMPTY_VALUE1.get(definition);
                final DecodeException e = DecodeException.error(message);
                SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
@@ -90,9 +88,9 @@
            if (c != '(') {
                final LocalizableMessage message =
                        ERR_ATTR_SYNTAX_OBJECTCLASS_EXPECTED_OPEN_PARENTHESIS1.get(definition,
                                (reader.pos() - 1), String.valueOf(c));
                                (reader.pos() - 1), c);
                final DecodeException e = DecodeException.error(message);
                SCHEMA_LOG.debug("", e);
                logger.debug(LocalizableMessage.raw("%s", e));
                throw e;
            }
@@ -158,7 +156,7 @@
                    final LocalizableMessage message =
                            ERR_ATTR_SYNTAX_OBJECTCLASS_ILLEGAL_TOKEN1.get(definition, tokenName);
                    final DecodeException e = DecodeException.error(message);
                    SCHEMA_LOG.debug("", e);
                    logger.debug(LocalizableMessage.raw("%s", e));
                    throw e;
                }
            }
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxImpl.java
@@ -22,9 +22,8 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2012-2013 ForgeRock AS
 *      Portions copyright 2012-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
import static com.forgerock.opendj.ldap.CoreMessages.*;
@@ -37,11 +36,10 @@
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.DecodeException;
import com.forgerock.opendj.util.StaticUtils;
/**
 * This class implements the UTC time attribute syntax. This is very similar to
 * the generalized time syntax (and actually has been deprecated in favor of
@@ -52,6 +50,8 @@
 */
final class UTCTimeSyntaxImpl extends AbstractSyntaxImpl {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /**
     * The lock that will be used to provide threadsafe access to the date
     * formatter.
@@ -146,9 +146,9 @@
            }
        } catch (final Exception e) {
            final LocalizableMessage message =
                    ERR_ATTR_SYNTAX_UTC_TIME_CANNOT_PARSE.get(valueString, String.valueOf(e));
                    ERR_ATTR_SYNTAX_UTC_TIME_CANNOT_PARSE.get(valueString, e);
            final DecodeException de = DecodeException.error(message, e);
            StaticUtils.SCHEMA_LOG.debug("", de);
            logger.debug(LocalizableMessage.raw("%s", de));
            throw de;
        }
    }