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

Nicolas Capponi
02.39.2013 97c79b045640b93f075b2dd4a8db87d765da3a5a
opendj-sdk/opendj3/opendj-ldap-sdk/pom.xml
@@ -55,6 +55,17 @@
      <version>${forgerockBuildToolsVersion}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.5</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-jdk14</artifactId>
      <version>1.7.5</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <properties>
    <opendj.osgi.import>
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ASN1BufferReader.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2013 ForgeRock AS.
 */
package com.forgerock.opendj.ldap;
@@ -32,10 +32,10 @@
import static com.forgerock.opendj.ldap.LDAPConstants.ELEMENT_READ_STATE_NEED_TYPE;
import static com.forgerock.opendj.ldap.LDAPConstants.ELEMENT_READ_STATE_NEED_VALUE_BYTES;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import static com.forgerock.opendj.util.StaticUtils.IO_LOG;
import static com.forgerock.opendj.util.StaticUtils.byteToHex;
import java.io.IOException;
import java.util.logging.Level;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.asn1.ASN1Reader;
import org.forgerock.opendj.asn1.AbstractASN1Reader;
@@ -47,8 +47,6 @@
import org.glassfish.grizzly.memory.CompositeBuffer;
import org.glassfish.grizzly.memory.MemoryManager;
import com.forgerock.opendj.util.StaticUtils;
/**
 * Grizzly ASN1 reader implementation.
 */
@@ -76,9 +74,8 @@
        public SequenceLimiter endSequence() throws IOException {
            parent.checkLimit(remaining());
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE) && remaining() > 0) {
                StaticUtils.DEBUG_LOG.fine(String.format(
                        "Ignoring %d unused trailing bytes in ASN.1 SEQUENCE", remaining()));
            if (remaining() > 0) {
                IO_LOG.debug("Ignoring {} unused trailing bytes in ASN.1 SEQUENCE", remaining());
            }
            for (int i = 0; i < remaining(); i++) {
@@ -268,11 +265,8 @@
        readLimiter.checkLimit(peekLength);
        final byte readByte = buffer.get();
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format(
                    "READ ASN.1 BOOLEAN(type=0x%x, length=%d, value=%s)", peekType, peekLength,
                    String.valueOf(readByte != 0x00)));
        }
        IO_LOG.trace("READ ASN.1 BOOLEAN(type=0x{}, length={}, value={})",
                byteToHex(peekType), peekLength, String.valueOf(readByte != 0x00));
        state = ELEMENT_READ_STATE_NEED_TYPE;
        return readByte != 0x00;
@@ -284,9 +278,7 @@
    public void readEndSequence() throws IOException {
        readLimiter = readLimiter.endSequence();
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format("READ ASN.1 END SEQUENCE"));
        }
        IO_LOG.debug("READ ASN.1 END SEQUENCE");
        // Reset the state
        state = ELEMENT_READ_STATE_NEED_TYPE;
@@ -353,11 +345,8 @@
                intValue = (intValue << 8) | (readByte & 0xFF);
            }
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "READ ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", peekType, peekLength,
                        intValue));
            }
            IO_LOG.trace("READ ASN.1 INTEGER(type=0x{}, length={}, value={})",
                    byteToHex(peekType), peekLength, intValue);
            state = ELEMENT_READ_STATE_NEED_TYPE;
            return intValue;
@@ -377,10 +366,8 @@
            throw DecodeException.fatalError(message);
        }
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format("READ ASN.1 NULL(type=0x%x, length=%d)",
                    peekType, peekLength));
        }
        IO_LOG.trace("READ ASN.1 NULL(type=0x{}, length={})",
                    byteToHex(peekType), peekLength);
        state = ELEMENT_READ_STATE_NEED_TYPE;
    }
@@ -402,10 +389,7 @@
        final byte[] value = new byte[peekLength];
        buffer.get(value);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format(
                    "READ ASN.1 OCTETSTRING(type=0x%x, length=%d)", peekType, peekLength));
        }
        IO_LOG.trace("READ ASN.1 OCTETSTRING(type=0x{}, length={})", byteToHex(peekType), peekLength);
        state = ELEMENT_READ_STATE_NEED_TYPE;
        return ByteString.wrap(value);
@@ -430,10 +414,7 @@
            builder.append(buffer.get());
        }
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format(
                    "READ ASN.1 OCTETSTRING(type=0x%x, length=%d)", peekType, peekLength));
        }
        IO_LOG.trace("READ ASN.1 OCTETSTRING(type=0x{}, length={})", byteToHex(peekType), peekLength);
        state = ELEMENT_READ_STATE_NEED_TYPE;
        return builder;
@@ -467,20 +448,14 @@
        try {
            str = new String(readBuffer, 0, peekLength, "UTF-8");
        } catch (final Exception e) {
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.WARNING)) {
                StaticUtils.DEBUG_LOG
                        .warning("Unable to decode ASN.1 OCTETSTRING bytes as UTF-8 string: "
                                + e.toString());
            }
            // TODO: I18N
            IO_LOG.warn("Unable to decode ASN.1 OCTETSTRING bytes as UTF-8 string", e);
            str = new String(stringBuffer, 0, peekLength);
        }
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format(
                    "READ ASN.1 OCTETSTRING(type=0x%x, length=%d, value=%s)", peekType, peekLength,
                    str));
        }
        IO_LOG.trace("READ ASN.1 OCTETSTRING(type=0x{}, length={}, value={})",
                byteToHex(peekType), peekLength, str);
        return str;
    }
@@ -494,10 +469,8 @@
        readLimiter = readLimiter.startSequence(peekLength);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format(
                    "READ ASN.1 START SEQUENCE(type=0x%x, length=%d)", peekType, peekLength));
        }
        IO_LOG.trace("READ ASN.1 START SEQUENCE(type=0x{}, length={})",
                byteToHex(peekType), peekLength);
        // Reset the state
        state = ELEMENT_READ_STATE_NEED_TYPE;
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ASN1BufferWriter.java
@@ -22,16 +22,16 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2013 ForgeRock AS.
 */
package com.forgerock.opendj.ldap;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_ASN1_SEQUENCE_WRITE_NOT_STARTED;
import static com.forgerock.opendj.util.StaticUtils.IO_LOG;
import static com.forgerock.opendj.util.StaticUtils.byteToHex;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.logging.Level;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.asn1.ASN1;
import org.forgerock.opendj.asn1.ASN1Writer;
@@ -60,10 +60,7 @@
            writeLength(parent, buffer.length());
            parent.writeByteArray(buffer.getBackingArray(), 0, buffer.length());
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format("WRITE ASN.1 END SEQUENCE(length=%d)",
                        buffer.length()));
            }
            IO_LOG.trace("WRITE ASN.1 END SEQUENCE(length={})", buffer.length());
            return parent;
        }
@@ -230,11 +227,9 @@
        writeLength(sequenceBuffer, 1);
        sequenceBuffer.writeByte(booleanValue ? ASN1.BOOLEAN_VALUE_TRUE : ASN1.BOOLEAN_VALUE_FALSE);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format(
                    "WRITE ASN.1 BOOLEAN(type=0x%x, length=%d, value=%s)", type, 1, String
                            .valueOf(booleanValue)));
        }
        IO_LOG.trace("WRITE ASN.1 BOOLEAN(type=0x{}, length={}, value={})",
                byteToHex(type), 1, String.valueOf(booleanValue));
        return this;
    }
@@ -270,39 +265,27 @@
                || ((intValue & 0x0000007F) == intValue)) {
            writeLength(sequenceBuffer, 1);
            sequenceBuffer.writeByte((byte) (intValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 1, intValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 1, intValue);
        } else if (((intValue < 0) && ((intValue & 0xFFFF8000) == 0xFFFF8000))
                || ((intValue & 0x00007FFF) == intValue)) {
            writeLength(sequenceBuffer, 2);
            sequenceBuffer.writeByte((byte) ((intValue >> 8) & 0xFF));
            sequenceBuffer.writeByte((byte) (intValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 2, intValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 2, intValue);
        } else if (((intValue < 0) && ((intValue & 0xFF800000) == 0xFF800000))
                || ((intValue & 0x007FFFFF) == intValue)) {
            writeLength(sequenceBuffer, 3);
            sequenceBuffer.writeByte((byte) ((intValue >> 16) & 0xFF));
            sequenceBuffer.writeByte((byte) ((intValue >> 8) & 0xFF));
            sequenceBuffer.writeByte((byte) (intValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 3, intValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 3, intValue);
        } else {
            writeLength(sequenceBuffer, 4);
            sequenceBuffer.writeByte((byte) ((intValue >> 24) & 0xFF));
            sequenceBuffer.writeByte((byte) ((intValue >> 16) & 0xFF));
            sequenceBuffer.writeByte((byte) ((intValue >> 8) & 0xFF));
            sequenceBuffer.writeByte((byte) (intValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 4, intValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 4, intValue);
        }
        return this;
    }
@@ -316,29 +299,20 @@
                || ((longValue & 0x000000000000007FL) == longValue)) {
            writeLength(sequenceBuffer, 1);
            sequenceBuffer.writeByte((byte) (longValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 1, longValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 1, longValue);
        } else if (((longValue < 0) && ((longValue & 0xFFFFFFFFFFFF8000L) == 0xFFFFFFFFFFFF8000L))
                || ((longValue & 0x0000000000007FFFL) == longValue)) {
            writeLength(sequenceBuffer, 2);
            sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
            sequenceBuffer.writeByte((byte) (longValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 2, longValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 2, longValue);
        } else if (((longValue < 0) && ((longValue & 0xFFFFFFFFFF800000L) == 0xFFFFFFFFFF800000L))
                || ((longValue & 0x00000000007FFFFFL) == longValue)) {
            writeLength(sequenceBuffer, 3);
            sequenceBuffer.writeByte((byte) ((longValue >> 16) & 0xFF));
            sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
            sequenceBuffer.writeByte((byte) (longValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 3, longValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 3, longValue);
        } else if (((longValue < 0) && ((longValue & 0xFFFFFFFF80000000L) == 0xFFFFFFFF80000000L))
                || ((longValue & 0x000000007FFFFFFFL) == longValue)) {
            writeLength(sequenceBuffer, 4);
@@ -346,10 +320,7 @@
            sequenceBuffer.writeByte((byte) ((longValue >> 16) & 0xFF));
            sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
            sequenceBuffer.writeByte((byte) (longValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 4, longValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 4, longValue);
        } else if (((longValue < 0) && ((longValue & 0xFFFFFF8000000000L) == 0xFFFFFF8000000000L))
                || ((longValue & 0x0000007FFFFFFFFFL) == longValue)) {
            writeLength(sequenceBuffer, 5);
@@ -358,10 +329,7 @@
            sequenceBuffer.writeByte((byte) ((longValue >> 16) & 0xFF));
            sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
            sequenceBuffer.writeByte((byte) (longValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 5, longValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 5, longValue);
        } else if (((longValue < 0) && ((longValue & 0xFFFF800000000000L) == 0xFFFF800000000000L))
                || ((longValue & 0x00007FFFFFFFFFFFL) == longValue)) {
            writeLength(sequenceBuffer, 6);
@@ -371,10 +339,7 @@
            sequenceBuffer.writeByte((byte) ((longValue >> 16) & 0xFF));
            sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
            sequenceBuffer.writeByte((byte) (longValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 6, longValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 6, longValue);
        } else if (((longValue < 0) && ((longValue & 0xFF80000000000000L) == 0xFF80000000000000L))
                || ((longValue & 0x007FFFFFFFFFFFFFL) == longValue)) {
            writeLength(sequenceBuffer, 7);
@@ -385,10 +350,7 @@
            sequenceBuffer.writeByte((byte) ((longValue >> 16) & 0xFF));
            sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
            sequenceBuffer.writeByte((byte) (longValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 7, longValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 7, longValue);
        } else {
            writeLength(sequenceBuffer, 8);
            sequenceBuffer.writeByte((byte) ((longValue >> 56) & 0xFF));
@@ -399,10 +361,7 @@
            sequenceBuffer.writeByte((byte) ((longValue >> 16) & 0xFF));
            sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
            sequenceBuffer.writeByte((byte) (longValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 8, longValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 8, longValue);
        }
        return this;
    }
@@ -414,10 +373,8 @@
        sequenceBuffer.writeByte(type);
        writeLength(sequenceBuffer, 0);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format("WRITE ASN.1 NULL(type=0x%x, length=%d)",
                    type, 0));
        }
        IO_LOG.trace("WRITE ASN.1 NULL(type=0x{}, length={})", byteToHex(type), 0);
        return this;
    }
@@ -430,10 +387,7 @@
        writeLength(sequenceBuffer, length);
        sequenceBuffer.writeByteArray(value, offset, length);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format(
                    "WRITE ASN.1 OCTETSTRING(type=0x%x, length=%d)", type, length));
        }
        IO_LOG.trace("WRITE ASN.1 OCTETSTRING(type=0x{}, length={})", byteToHex(type), length);
        return this;
    }
@@ -449,10 +403,7 @@
            sequenceBuffer.writeByte(value.byteAt(i));
        }
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format(
                    "WRITE ASN.1 OCTETSTRING(type=0x%x, length=%d)", type, value.length()));
        }
        IO_LOG.trace("WRITE ASN.1 OCTETSTRING(type=0x{}, length={})", byteToHex(type), value.length());
        return this;
    }
@@ -471,11 +422,8 @@
        writeLength(sequenceBuffer, bytes.length);
        sequenceBuffer.writeByteArray(bytes, 0, bytes.length);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format(
                    "WRITE ASN.1 OCTETSTRING(type=0x%x, length=%d, " + "value=%s)", type,
                    bytes.length, value));
        }
        IO_LOG.trace("WRITE ASN.1 OCTETSTRING(type=0x{}, length={}, value={})", byteToHex(type),
                    bytes.length, value);
        return this;
    }
@@ -486,10 +434,7 @@
        // Get a child sequence buffer
        sequenceBuffer = sequenceBuffer.startSequence(type);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format("WRITE ASN.1 START SEQUENCE(type=0x%x)",
                    type));
        }
        IO_LOG.trace("WRITE ASN.1 START SEQUENCE(type=0x{})", byteToHex(type));
        return this;
    }
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/DefaultTCPNIOTransport.java
@@ -27,11 +27,9 @@
package com.forgerock.opendj.ldap;
import static com.forgerock.opendj.util.StaticUtils.DEBUG_LOG;
import static com.forgerock.opendj.util.StaticUtils.DEFAULT_LOG;
import java.io.IOException;
import java.util.logging.Level;
import org.glassfish.grizzly.nio.transport.TCPNIOTransport;
import org.glassfish.grizzly.nio.transport.TCPNIOTransportBuilder;
import org.glassfish.grizzly.strategies.SameThreadIOStrategy;
@@ -57,8 +55,8 @@
        try {
            instance.shutdownNow();
        } catch (final IOException e) {
            DEBUG_LOG.log(Level.WARNING,
                    "An error occurred while shutting down the Grizzly transport", e.getMessage());
            // TODO: I18N
            DEFAULT_LOG.warn("An error occurred while shutting down the Grizzly transport", e);
        }
    }
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConnection.java
@@ -27,7 +27,7 @@
package com.forgerock.opendj.ldap;
import static com.forgerock.opendj.util.StaticUtils.DEBUG_LOG;
import static com.forgerock.opendj.util.StaticUtils.DEFAULT_LOG;
import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
import java.io.IOException;
@@ -556,7 +556,7 @@
                if (future != null && future.checkForTimeout()) {
                    final long diff = (future.getTimestamp() + timeout) - currentTime;
                    if (diff <= 0 && pendingRequests.remove(requestID) != null) {
                        DEBUG_LOG.fine("Cancelling expired future result: " + future);
                        DEFAULT_LOG.debug("Cancelling expired future result: {}", future);
                        final Result result = Responses.newResult(ResultCode.CLIENT_SIDE_TIMEOUT);
                        future.adaptErrorResult(result);
                        abandonAsync(Requests.newAbandonRequest(future.getRequestID()));
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPListenerImpl.java
@@ -28,14 +28,12 @@
package com.forgerock.opendj.ldap;
import static com.forgerock.opendj.ldap.DefaultTCPNIOTransport.DEFAULT_TRANSPORT;
import static com.forgerock.opendj.util.StaticUtils.DEBUG_LOG;
import static com.forgerock.opendj.util.StaticUtils.DEFAULT_LOG;
import java.io.Closeable;
import java.io.IOException;
import java.net.SocketAddress;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.LDAPClientContext;
import org.forgerock.opendj.ldap.LDAPListenerOptions;
@@ -99,7 +97,8 @@
                // Cannot handle here.
                Thread.currentThread().interrupt();
            } catch (final Exception e) {
                DEBUG_LOG.log(Level.WARNING, "Exception occurred while closing listener", e);
                // TODO: I18N
                DEFAULT_LOG.warn("Exception occurred while closing listener", e);
            }
            transport.release();
        }
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPReader.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011-2012 ForgeRock AS
 *      Portions copyright 2011-2013 ForgeRock AS
 */
package com.forgerock.opendj.ldap;
@@ -31,10 +31,10 @@
import static com.forgerock.opendj.ldap.CoreMessages.ERR_LDAP_MODIFICATION_DECODE_INVALID_MOD_TYPE;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_LDAP_SEARCH_REQUEST_DECODE_INVALID_DEREF;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_LDAP_SEARCH_REQUEST_DECODE_INVALID_SCOPE;
import static com.forgerock.opendj.util.StaticUtils.IO_LOG;
import static com.forgerock.opendj.util.StaticUtils.byteToHex;
import java.io.IOException;
import java.util.logging.Level;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.opendj.asn1.ASN1;
import org.forgerock.opendj.asn1.ASN1Reader;
@@ -77,8 +77,6 @@
import org.forgerock.opendj.ldap.responses.SearchResultReference;
import org.forgerock.opendj.ldap.schema.Schema;
import com.forgerock.opendj.util.StaticUtils;
/**
 * Static methods for decoding LDAP messages.
 */
@@ -192,10 +190,7 @@
        decodeControls(reader, message);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "DECODE LDAP ABANDON REQUEST(messageID=%d, request=%s)", messageID, message));
        }
        IO_LOG.trace("DECODE LDAP ABANDON REQUEST(messageID={}, request={})", messageID, message);
        handler.abandonRequest(p, messageID, message);
    }
@@ -259,10 +254,7 @@
        final AddRequest message = Requests.newAddRequest(entry);
        decodeControls(reader, message);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "DECODE LDAP ADD REQUEST(messageID=%d, request=%s)", messageID, message));
        }
        IO_LOG.trace("DECODE LDAP ADD REQUEST(messageID={}, request={})", messageID, message);
        handler.addRequest(p, messageID, message);
    }
@@ -302,10 +294,7 @@
        decodeControls(reader, message);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "DECODE LDAP ADD RESULT(messageID=%d, result=%s)", messageID, message));
        }
        IO_LOG.trace("DECODE LDAP ADD RESULT(messageID={}, result={})", messageID, message);
        handler.addResult(p, messageID, message);
    }
@@ -349,11 +338,8 @@
            decodeControls(reader, request);
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
                StaticUtils.DEBUG_LOG.finer(String.format(
                        "DECODE LDAP BIND REQUEST(messageID=%d, auth=0x%x, request=%s)", messageID,
                        request.getAuthenticationType(), request));
            }
            IO_LOG.trace("DECODE LDAP BIND REQUEST(messageID={}, auth=0x{}, request={})", messageID,
                    byteToHex(request.getAuthenticationType()), request);
            handler.bindRequest(p, messageID, protocolVersion, request);
        } finally {
@@ -400,10 +386,7 @@
        decodeControls(reader, message);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "DECODE LDAP BIND RESULT(messageID=%d, result=%s)", messageID, message));
        }
        IO_LOG.trace("DECODE LDAP BIND RESULT(messageID={}, result={})", messageID, message);
        handler.bindResult(p, messageID, message);
    }
@@ -449,10 +432,7 @@
        decodeControls(reader, message);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "DECODE LDAP COMPARE REQUEST(messageID=%d, request=%s)", messageID, message));
        }
        IO_LOG.trace("DECODE LDAP COMPARE REQUEST(messageID={}, request={})", messageID, message);
        handler.compareRequest(p, messageID, message);
    }
@@ -492,10 +472,7 @@
        decodeControls(reader, message);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "DECODE LDAP COMPARE RESULT(messageID=%d, result=%s)", messageID, message));
        }
        IO_LOG.trace("DECODE LDAP COMPARE RESULT(messageID={}, result={})", messageID, message);
        handler.compareResult(p, messageID, message);
    }
@@ -640,10 +617,7 @@
        decodeControls(reader, message);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "DECODE LDAP DELETE REQUEST(messageID=%d, request=%s)", messageID, message));
        }
        IO_LOG.trace("DECODE LDAP DELETE REQUEST(messageID={}, request={})", messageID, message);
        handler.deleteRequest(p, messageID, message);
    }
@@ -683,10 +657,7 @@
        decodeControls(reader, message);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "DECODE LDAP DELETE RESULT(messageID=%d, result=%s)", messageID, message));
        }
        IO_LOG.trace("DECODE LDAP DELETE RESULT(messageID={}, result={})", messageID, message);
        handler.deleteResult(p, messageID, message);
    }
@@ -735,10 +706,7 @@
        decodeControls(reader, message);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "DECODE LDAP EXTENDED REQUEST(messageID=%d, request=%s)", messageID, message));
        }
        IO_LOG.trace("DECODE LDAP EXTENDED REQUEST(messageID={}, request={})", messageID, message);
        handler.extendedRequest(p, messageID, message);
    }
@@ -785,10 +753,7 @@
        decodeControls(reader, message);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "DECODE LDAP EXTENDED RESULT(messageID=%d, result=%s)", messageID, message));
        }
        IO_LOG.trace("DECODE LDAP EXTENDED RESULT(messageID={}, result={})", messageID, message);
        handler.extendedResult(p, messageID, message);
    }
@@ -828,11 +793,8 @@
        decodeControls(reader, message);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "DECODE LDAP INTERMEDIATE RESPONSE(messageID=%d, response=%s)", messageID,
                    message));
        }
        IO_LOG.trace("DECODE LDAP INTERMEDIATE RESPONSE(messageID={}, response={})",
                messageID, message);
        handler.intermediateResponse(p, messageID, message);
    }
@@ -882,10 +844,7 @@
        decodeControls(reader, message);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "DECODE LDAP MODIFY DN REQUEST(messageID=%d, request=%s)", messageID, message));
        }
        IO_LOG.trace("DECODE LDAP MODIFY DN REQUEST(messageID={}, request={})", messageID, message);
        handler.modifyDNRequest(p, messageID, message);
    }
@@ -925,10 +884,7 @@
        decodeControls(reader, message);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "DECODE LDAP MODIFY DN RESULT(messageID=%d, result=%s)", messageID, message));
        }
        IO_LOG.trace("DECODE MODIFY DN RESULT(messageID={}, result={})", messageID, message);
        handler.modifyDNResult(p, messageID, message);
    }
@@ -1004,10 +960,7 @@
        decodeControls(reader, message);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "DECODE LDAP MODIFY REQUEST(messageID=%d, request=%s)", messageID, message));
        }
        IO_LOG.trace("DECODE LDAP MODIFY REQUEST(messageID={}, request={})", messageID, message);
        handler.modifyRequest(p, messageID, message);
    }
@@ -1047,10 +1000,7 @@
        decodeControls(reader, message);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "DECODE LDAP MODIFY RESULT(messageID=%d, result=%s)", messageID, message));
        }
        IO_LOG.trace("DECODE LDAP MODIFY RESULT(messageID={}, result={})", messageID, message);
        handler.modifyResult(p, messageID, message);
    }
@@ -1287,10 +1237,7 @@
        decodeControls(reader, message);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "DECODE LDAP SEARCH REQUEST(messageID=%d, request=%s)", messageID, message));
        }
        IO_LOG.trace("DECODE LDAP SEARCH REQUEST(messageID={}, request={})", messageID, message);
        handler.searchRequest(p, messageID, message);
    }
@@ -1331,10 +1278,7 @@
        decodeControls(reader, message);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "DECODE LDAP SEARCH RESULT(messageID=%d, result=%s)", messageID, message));
        }
        IO_LOG.trace("DECODE LDAP SEARCH RESULT(messageID={}, result={})", messageID, message);
        handler.searchResult(p, messageID, message);
    }
@@ -1398,10 +1342,7 @@
        final SearchResultEntry message = Responses.newSearchResultEntry(entry);
        decodeControls(reader, message);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "DECODE LDAP SEARCH RESULT ENTRY(messageID=%d, entry=%s)", messageID, message));
        }
        IO_LOG.trace("DECODE LDAP SEARCH RESULT ENTRY(messageID={}, entry={})", messageID, message);
        handler.searchResultEntry(p, messageID, message);
    }
@@ -1438,11 +1379,8 @@
        decodeControls(reader, message);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "DECODE LDAP SEARCH RESULT REFERENCE(messageID=%d, reference=%s)", messageID,
                    message));
        }
        IO_LOG.trace("DECODE LDAP SEARCH RESULT REFERENCE(messageID={}, result={})",
                messageID, message);
        handler.searchResultReference(p, messageID, message);
    }
@@ -1471,10 +1409,7 @@
        decodeControls(reader, message);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "DECODE LDAP UNBIND REQUEST(messageID=%d, request=%s)", messageID, message));
        }
        IO_LOG.trace("DECODE LDAP UNBIND REQUEST(messageID={}, request={})", messageID, message);
        handler.unbindRequest(p, messageID, message);
    }
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPWriter.java
@@ -22,17 +22,17 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011 ForgeRock AS
 *      Portions copyright 2011-2013 ForgeRock AS
 */
package com.forgerock.opendj.ldap;
import static com.forgerock.opendj.ldap.LDAPConstants.*;
import static com.forgerock.opendj.util.StaticUtils.IO_LOG;
import static com.forgerock.opendj.util.StaticUtils.byteToHex;
import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
import org.forgerock.opendj.asn1.ASN1Writer;
import org.forgerock.opendj.ldap.Attribute;
import org.forgerock.opendj.ldap.ByteString;
@@ -170,10 +170,7 @@
    public void abandonRequest(final ASN1Writer writer, final int messageID,
            final AbandonRequest request) throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP ABANDON REQUEST(messageID=%d, request=%s)", messageID, request));
        }
        IO_LOG.trace("ENCODE LDAP ABANDON REQUEST(messageID={}, request={})", messageID, request);
        encodeMessageHeader(writer, messageID);
        writer.writeInteger(OP_TYPE_ABANDON_REQUEST, request.getRequestID());
        encodeMessageFooter(writer, request);
@@ -181,10 +178,7 @@
    public void addRequest(final ASN1Writer writer, final int messageID, final AddRequest request)
            throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP ADD REQUEST(messageID=%d, request=%s)", messageID, request));
        }
        IO_LOG.trace("ENCODE LDAP ADD REQUEST(messageID={}, request={})", messageID, request);
        encodeMessageHeader(writer, messageID);
        writer.writeStartSequence(OP_TYPE_ADD_REQUEST);
        writer.writeOctetString(request.getName().toString());
@@ -202,10 +196,7 @@
    public void addResult(final ASN1Writer writer, final int messageID, final Result result)
            throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP ADD RESULT(messageID=%d, result=%s)", messageID, result));
        }
        IO_LOG.trace("ENCODE LDAP ADD RESULT(messageID={}, result={})", messageID, result);
        encodeMessageHeader(writer, messageID);
        encodeResultHeader(writer, OP_TYPE_ADD_RESPONSE, result);
        encodeResultFooter(writer);
@@ -214,11 +205,8 @@
    public void bindRequest(final ASN1Writer writer, final int messageID, final int version,
            final GenericBindRequest request) throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP BIND REQUEST(messageID=%d, auth=0x%x, request=%s)", messageID,
                    request.getAuthenticationType(), request));
        }
        IO_LOG.trace("ENCODE LDAP BIND REQUEST(messageID={}, auth=0x{}, request={})",
                messageID, byteToHex(request.getAuthenticationType()), request);
        encodeMessageHeader(writer, messageID);
        writer.writeStartSequence(OP_TYPE_BIND_REQUEST);
@@ -232,10 +220,7 @@
    public void bindResult(final ASN1Writer writer, final int messageID, final BindResult result)
            throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP BIND RESULT(messageID=%d, result=%s)", messageID, result));
        }
        IO_LOG.trace("ENCODE LDAP BIND RESULT(messageID={}, result={})", messageID, result);
        encodeMessageHeader(writer, messageID);
        encodeResultHeader(writer, OP_TYPE_BIND_RESPONSE, result);
@@ -250,10 +235,7 @@
    public void compareRequest(final ASN1Writer writer, final int messageID,
            final CompareRequest request) throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP COMPARE REQUEST(messageID=%d, request=%s)", messageID, request));
        }
        IO_LOG.trace("ENCODE LDAP COMPARE REQUEST(messageID={}, request={})", messageID, request);
        encodeMessageHeader(writer, messageID);
        writer.writeStartSequence(OP_TYPE_COMPARE_REQUEST);
        writer.writeOctetString(request.getName().toString());
@@ -269,10 +251,7 @@
    public void compareResult(final ASN1Writer writer, final int messageID,
            final CompareResult result) throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP COMPARE RESULT(messageID=%d, result=%s)", messageID, result));
        }
        IO_LOG.trace("ENCODE LDAP COMPARE RESULT(messageID={}, result={})", messageID, result);
        encodeMessageHeader(writer, messageID);
        encodeResultHeader(writer, OP_TYPE_COMPARE_RESPONSE, result);
        encodeResultFooter(writer);
@@ -281,10 +260,7 @@
    public void deleteRequest(final ASN1Writer writer, final int messageID,
            final DeleteRequest request) throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP DELETE REQUEST(messageID=%d, request=%s)", messageID, request));
        }
        IO_LOG.trace("ENCODE LDAP DELETE REQUEST(messageID={}, request={})", messageID, request);
        encodeMessageHeader(writer, messageID);
        writer.writeOctetString(OP_TYPE_DELETE_REQUEST, request.getName().toString());
        encodeMessageFooter(writer, request);
@@ -292,10 +268,7 @@
    public void deleteResult(final ASN1Writer writer, final int messageID, final Result result)
            throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP DELETE RESULT(messageID=%d, result=%s)", messageID, result));
        }
        IO_LOG.trace("ENCODE LDAP DELETE RESULT(messageID={}, result={})", messageID, result);
        encodeMessageHeader(writer, messageID);
        encodeResultHeader(writer, OP_TYPE_DELETE_RESPONSE, result);
        encodeResultFooter(writer);
@@ -304,10 +277,7 @@
    public <R extends ExtendedResult> void extendedRequest(final ASN1Writer writer,
            final int messageID, final ExtendedRequest<R> request) throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP EXTENDED REQUEST(messageID=%d, request=%s)", messageID, request));
        }
        IO_LOG.trace("ENCODE LDAP EXTENDED REQUEST(messageID={}, request={})", messageID, request);
        encodeMessageHeader(writer, messageID);
        writer.writeStartSequence(OP_TYPE_EXTENDED_REQUEST);
        writer.writeOctetString(TYPE_EXTENDED_REQUEST_OID, request.getOID());
@@ -323,10 +293,7 @@
    public void extendedResult(final ASN1Writer writer, final int messageID,
            final ExtendedResult result) throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP EXTENDED RESULT(messageID=%d, result=%s)", messageID, result));
        }
        IO_LOG.trace("ENCODE LDAP EXTENDED RESULT(messageID={}, result={})", messageID, result);
        encodeMessageHeader(writer, messageID);
        encodeResultHeader(writer, OP_TYPE_EXTENDED_RESPONSE, result);
@@ -347,11 +314,7 @@
    public void intermediateResponse(final ASN1Writer writer, final int messageID,
            final IntermediateResponse response) throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP INTERMEDIATE RESPONSE(messageID=%d, response=%s)", messageID,
                    response));
        }
        IO_LOG.trace("ENCODE LDAP INTERMEDIATE RESPONSE(messageID={}, response={})", messageID, response);
        encodeMessageHeader(writer, messageID);
        writer.writeStartSequence(OP_TYPE_INTERMEDIATE_RESPONSE);
@@ -372,10 +335,7 @@
    public void modifyDNRequest(final ASN1Writer writer, final int messageID,
            final ModifyDNRequest request) throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP MODIFY DN REQUEST(messageID=%d, request=%s)", messageID, request));
        }
        IO_LOG.trace("ENCODE LDAP MODIFY DN REQUEST(messageID={}, request={})", messageID, request);
        encodeMessageHeader(writer, messageID);
        writer.writeStartSequence(OP_TYPE_MODIFY_DN_REQUEST);
        writer.writeOctetString(request.getName().toString());
@@ -393,10 +353,7 @@
    public void modifyDNResult(final ASN1Writer writer, final int messageID, final Result result)
            throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP MODIFY DN RESULT(messageID=%d, result=%s)", messageID, result));
        }
        IO_LOG.trace("ENCODE LDAP MODIFY DN RESULT(messageID={}, result={})", messageID, result);
        encodeMessageHeader(writer, messageID);
        encodeResultHeader(writer, OP_TYPE_MODIFY_DN_RESPONSE, result);
        encodeResultFooter(writer);
@@ -405,10 +362,7 @@
    public void modifyRequest(final ASN1Writer writer, final int messageID,
            final ModifyRequest request) throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP MODIFY REQUEST(messageID=%d, request=%s)", messageID, request));
        }
        IO_LOG.trace("ENCODE LDAP MODIFY REQUEST(messageID={}, request={})", messageID, request);
        encodeMessageHeader(writer, messageID);
        writer.writeStartSequence(OP_TYPE_MODIFY_REQUEST);
        writer.writeOctetString(request.getName().toString());
@@ -425,10 +379,7 @@
    public void modifyResult(final ASN1Writer writer, final int messageID, final Result result)
            throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP MODIFY RESULT(messageID=%d, result=%s)", messageID, result));
        }
        IO_LOG.trace("ENCODE LDAP MODIFY RESULT(messageID={}, result={})", messageID, result);
        encodeMessageHeader(writer, messageID);
        encodeResultHeader(writer, OP_TYPE_MODIFY_RESPONSE, result);
        encodeResultFooter(writer);
@@ -437,10 +388,7 @@
    public void searchRequest(final ASN1Writer writer, final int messageID,
            final SearchRequest request) throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP SEARCH REQUEST(messageID=%d, request=%s)", messageID, request));
        }
        IO_LOG.trace("ENCODE LDAP SEARCH REQUEST(messageID={}, request={})", messageID, request);
        encodeMessageHeader(writer, messageID);
        writer.writeStartSequence(OP_TYPE_SEARCH_REQUEST);
        writer.writeOctetString(request.getName().toString());
@@ -463,10 +411,7 @@
    public void searchResult(final ASN1Writer writer, final int messageID, final Result result)
            throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP SEARCH RESULT(messageID=%d, result=%s)", messageID, result));
        }
        IO_LOG.trace("ENCODE LDAP SEARCH RESULT(messageID={}, result={})", messageID, result);
        encodeMessageHeader(writer, messageID);
        encodeResultHeader(writer, OP_TYPE_SEARCH_RESULT_DONE, result);
        encodeResultFooter(writer);
@@ -475,10 +420,7 @@
    public void searchResultEntry(final ASN1Writer writer, final int messageID,
            final SearchResultEntry entry) throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP SEARCH RESULT ENTRY(messageID=%d, entry=%s)", messageID, entry));
        }
        IO_LOG.trace("ENCODE LDAP SEARCH RESULT ENTRY(messageID={}, entry={})", messageID, entry);
        encodeMessageHeader(writer, messageID);
        encodeEntry(writer, entry);
        encodeMessageFooter(writer, entry);
@@ -486,11 +428,7 @@
    public void searchResultReference(final ASN1Writer writer, final int messageID,
            final SearchResultReference reference) throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP SEARCH RESULT REFERENCE(messageID=%d, reference=%s)", messageID,
                    reference));
        }
        IO_LOG.trace("ENCODE LDAP SEARCH RESULT REFERENCE(messageID={}, reference={})", messageID, reference);
        encodeMessageHeader(writer, messageID);
        writer.writeStartSequence(OP_TYPE_SEARCH_RESULT_REFERENCE);
        for (final String url : reference.getURIs()) {
@@ -502,10 +440,7 @@
    public void unbindRequest(final ASN1Writer writer, final int messageID,
            final UnbindRequest request) throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP UNBIND REQUEST(messageID=%d, request=%s)", messageID, request));
        }
        IO_LOG.trace("ENCODE LDAP UNBIND REQUEST(messageID={}, request={})", messageID, request);
        encodeMessageHeader(writer, messageID);
        writer.writeNull(OP_TYPE_UNBIND_REQUEST);
        encodeMessageFooter(writer, request);
@@ -513,12 +448,8 @@
    public void unrecognizedMessage(final ASN1Writer writer, final int messageID,
            final byte messageTag, final ByteString messageBytes) throws IOException {
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
            StaticUtils.DEBUG_LOG.finer(String.format(
                    "ENCODE LDAP UNKNOWN MESSAGE(messageID=%d, messageTag=%s, "
                            + "messageBytes=%s)", messageID, StaticUtils.byteToHex(messageTag),
                    messageBytes.toString()));
        }
        IO_LOG.trace("ENCODE LDAP UNKNOWN MESSAGE(messageID={}, messageTag={}, messageBytes={})",
                messageID, StaticUtils.byteToHex(messageTag), messageBytes.toString());
        encodeMessageHeader(writer, messageID);
        writer.writeOctetString(messageTag, messageBytes);
        writer.writeEndSequence();
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/TimeoutChecker.java
@@ -27,13 +27,11 @@
package com.forgerock.opendj.ldap;
import static com.forgerock.opendj.util.StaticUtils.DEBUG_LOG;
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 java.util.logging.Level;
import com.forgerock.opendj.util.ReferenceCountedObject;
/**
@@ -77,16 +75,13 @@
        final Thread checkerThread = new Thread("OpenDJ LDAP SDK Connection Timeout Checker") {
            @Override
            public void run() {
                DEBUG_LOG.fine("Timeout Checker Starting");
                DEFAULT_LOG.debug("Timeout Checker Starting");
                while (!shutdownRequested) {
                    final long currentTime = System.currentTimeMillis();
                    long delay = 0;
                    for (final LDAPConnection connection : connections) {
                        if (DEBUG_LOG.isLoggable(Level.FINER)) {
                            DEBUG_LOG.finer("Checking connection " + connection + " delay = "
                                    + delay);
                        }
                        DEFAULT_LOG.trace("Checking connection {} delay = {}", connection, delay);
                        // May update the connections set.
                        final long newDelay = connection.cancelExpiredRequests(currentTime);
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControl.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 */
package com.forgerock.opendj.ldap.controls;
@@ -148,8 +149,7 @@
                            throw DecodeException.error(message);
                        }
                    } catch (final IOException e) {
                        StaticUtils.DEBUG_LOG.throwing(
                                "AccountUsabilityResponseControl.decodeControl", "decode", e);
                        StaticUtils.CONTROLS_LOG.debug("", e);
                        final LocalizableMessage message =
                                ERR_ACCTUSABLERES_DECODE_ERROR.get(getExceptionMessage(e));
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/GetSymmetricKeyExtendedRequest.java
@@ -92,13 +92,12 @@
                }
                return newRequest;
            } catch (final IOException ae) {
                StaticUtils.DEBUG_LOG.throwing("GetSymmetricKeyRequest.Operation", "decodeRequest",
                        ae);
            } catch (final IOException ioe) {
                StaticUtils.DEFAULT_LOG.debug("", ioe);
                final LocalizableMessage message =
                        ERR_GET_SYMMETRIC_KEY_ASN1_DECODE_EXCEPTION.get(ae.getMessage());
                throw DecodeException.error(message, ae);
                        ERR_GET_SYMMETRIC_KEY_ASN1_DECODE_EXCEPTION.get(ioe.getMessage());
                throw DecodeException.error(message, ioe);
            }
        }
    }
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/StaticUtils.java
@@ -32,6 +32,7 @@
import java.io.Closeable;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
@@ -50,8 +51,6 @@
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.DataFormatException;
import java.util.zip.Deflater;
import java.util.zip.Inflater;
@@ -61,15 +60,35 @@
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteStringBuilder;
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 debug logger which should be used by the SDK.
     * The default logger used by the SDK if there is no appropriate specific logger.
     */
    public static final Logger DEBUG_LOG = Logger.getLogger("org.forgerock.opendj.ldap");
    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");
    /**
     * The logger used by the SDK for IO related features (buffers, readers, writers).
     */
    public static final Logger IO_LOG = LoggerFactory.getLogger(DEFAULT_LOGGER_NAME + ".io");
    /**
     * Indicates whether the SDK is being used in debug mode. In debug mode
@@ -1278,11 +1297,7 @@
                compress(inputBytes, 0, inputBytes.length, outputBytes, 0, outputBytes.length);
        if (compressedSize != -1) {
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE)) {
                StaticUtils.DEBUG_LOG.fine(String.format("Compression %d/%d%n", compressedSize,
                        inputBytes.length));
            }
            DEFAULT_LOG.debug("Compression {}/{}", compressedSize, inputBytes.length);
            output.append(outputBytes, 0, compressedSize);
            return true;
        }
@@ -1331,9 +1346,7 @@
        // Format the year yyyy.
        int n = calendar.get(Calendar.YEAR);
        if (n < 0) {
            final IllegalArgumentException e =
                    new IllegalArgumentException("Year cannot be < 0:" + n);
            StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "format", e);
            final IllegalArgumentException e = new IllegalArgumentException("Year cannot be < 0:" + n);
            throw e;
        } else if (n < 10) {
            sb.append("000");
@@ -1440,10 +1453,9 @@
            }
            return returnArray;
        } catch (final Exception e) {
            DEBUG_LOG.warning("Unable to encode UTF-8 string " + s);
            return s.getBytes();
        } catch (final UnsupportedEncodingException e) {
            // TODO: I18N
            throw new RuntimeException("Unable to encode UTF-8 string " + s, e);
        }
    }
@@ -2215,8 +2227,9 @@
            }
            if (DEBUG_TO_STDERR) {
                System.err.println(builder.toString());
            } else if (DEBUG_LOG.isLoggable(Level.SEVERE)) {
                DEBUG_LOG.severe(builder.toString());
            } else if (DEFAULT_LOG.isErrorEnabled()) {
                // TODO: I18N
                DEFAULT_LOG.error(builder.toString());
            }
        }
    }
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1ByteSequenceReader.java
@@ -22,25 +22,22 @@
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2013 ForgeRock AS.
 */
package org.forgerock.opendj.asn1;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import static com.forgerock.opendj.util.StaticUtils.IO_LOG;
import java.io.IOException;
import java.util.LinkedList;
import java.util.logging.Level;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.ByteSequenceReader;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ByteStringBuilder;
import org.forgerock.opendj.ldap.DecodeException;
import com.forgerock.opendj.util.StaticUtils;
/**
 * An ASN.1 reader that reads from a {@link ByteSequenceReader}.
 */
@@ -166,9 +163,9 @@
            throw new IllegalStateException(message.toString());
        }
        if ((reader.remaining() > 0) && StaticUtils.DEBUG_LOG.isLoggable(Level.FINE)) {
            StaticUtils.DEBUG_LOG.fine("Ignoring " + reader.remaining()
                    + " unused trailing bytes in " + "ASN.1 SEQUENCE");
        if (reader.remaining() > 0) {
            IO_LOG.debug("Ignoring {} unused trailing bytes in ASN.1 SEQUENCE",
                    reader.remaining());
        }
        reader = readerStack.removeFirst();
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1InputStreamReader.java
@@ -22,17 +22,19 @@
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2013 ForgeRock AS.
 */
package org.forgerock.opendj.asn1;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import static com.forgerock.opendj.util.StaticUtils.IO_LOG;
import static com.forgerock.opendj.util.StaticUtils.byteToHex;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.LinkedList;
import java.util.logging.Level;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.ByteString;
@@ -40,7 +42,6 @@
import org.forgerock.opendj.ldap.DecodeException;
import com.forgerock.opendj.util.SizeLimitInputStream;
import com.forgerock.opendj.util.StaticUtils;
/**
 * An ASN1Reader that reads from an input stream.
@@ -170,12 +171,10 @@
            throw DecodeException.fatalError(message);
        }
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format(
                    "READ ASN.1 BOOLEAN(type=0x%x, length=%d, value=%s)", peekType, peekLength,
                    String.valueOf(readByte != 0x00)));
        if (IO_LOG.isTraceEnabled()) {
            IO_LOG.trace("READ ASN.1 BOOLEAN(type=0x{}, length={}, value={})",
                    byteToHex(peekType), peekLength, String.valueOf(readByte != 0x00));
        }
        state = ASN1.ELEMENT_READ_STATE_NEED_TYPE;
        return readByte != 0x00;
    }
@@ -192,18 +191,15 @@
        // Ignore all unused trailing components.
        final SizeLimitInputStream subSq = (SizeLimitInputStream) in;
        if (subSq.getSizeLimit() - subSq.getBytesRead() > 0) {
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE)) {
                StaticUtils.DEBUG_LOG.fine(String.format(
                        "Ignoring %d unused trailing bytes in ASN.1 SEQUENCE", subSq.getSizeLimit()
                                - subSq.getBytesRead()));
            if (IO_LOG.isTraceEnabled()) {
                IO_LOG.trace("Ignoring {} unused trailing bytes in ASN.1 SEQUENCE",
                        subSq.getSizeLimit() - subSq.getBytesRead());
            }
            subSq.skip(subSq.getSizeLimit() - subSq.getBytesRead());
        }
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format("READ ASN.1 END SEQUENCE"));
        }
        IO_LOG.trace("READ ASN.1 END SEQUENCE");
        in = streamStack.removeFirst();
@@ -281,11 +277,8 @@
                intValue = (intValue << 8) | (readByte & 0xFF);
            }
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "READ ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", peekType, peekLength,
                        intValue));
            }
            IO_LOG.trace("READ ASN.1 INTEGER(type=0x{}, length={}, value={})",
                    byteToHex(peekType), peekLength, intValue);
            state = ASN1.ELEMENT_READ_STATE_NEED_TYPE;
            return intValue;
@@ -305,10 +298,8 @@
            throw DecodeException.fatalError(message);
        }
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format("READ ASN.1 NULL(type=0x%x, length=%d)",
                    peekType, peekLength));
        }
        IO_LOG.trace("READ ASN.1 NULL(type=0x{}, length={})",
                byteToHex(peekType), peekLength);
        state = ASN1.ELEMENT_READ_STATE_NEED_TYPE;
    }
@@ -340,10 +331,7 @@
            bytesNeeded -= bytesRead;
        }
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format(
                    "READ ASN.1 OCTETSTRING(type=0x%x, length=%d)", peekType, peekLength));
        }
        IO_LOG.trace("READ ASN.1 OCTETSTRING(type=0x{}, length={})", byteToHex(peekType), peekLength);
        state = ASN1.ELEMENT_READ_STATE_NEED_TYPE;
        return ByteString.wrap(value);
@@ -374,11 +362,7 @@
            bytesNeeded -= bytesRead;
        }
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format(
                    "READ ASN.1 OCTETSTRING(type=0x%x, length=%d)", peekType, peekLength));
        }
        IO_LOG.trace("READ ASN.1 OCTETSTRING(type=0x{}, length={})", byteToHex(peekType), peekLength);
        state = ASN1.ELEMENT_READ_STATE_NEED_TYPE;
        return builder;
    }
@@ -417,20 +401,13 @@
        String str;
        try {
            str = new String(buffer, 0, peekLength, "UTF-8");
        } catch (final Exception e) {
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.WARNING)) {
                StaticUtils.DEBUG_LOG.warning("Unable to decode ASN.1 OCTETSTRING "
                        + "bytes as UTF-8 string: " + e.toString());
            }
            str = new String(buffer, 0, peekLength);
        } catch (final UnsupportedEncodingException e) {
            // TODO: I18N
            throw new RuntimeException("Unable to decode ASN.1 OCTETSTRING bytes as UTF-8 string ", e);
        }
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format(
                    "READ ASN.1 OCTETSTRING(type=0x%x, length=%d, value=%s)", peekType, peekLength,
                    str));
        }
        IO_LOG.trace("READ ASN.1 OCTETSTRING(type=0x{}, length={}, value={})",
                byteToHex(peekType), peekLength, str);
        return str;
    }
@@ -444,10 +421,7 @@
        final SizeLimitInputStream subStream = new SizeLimitInputStream(in, peekLength);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format(
                    "READ ASN.1 START SEQUENCE(type=0x%x, length=%d)", peekType, peekLength));
        }
        IO_LOG.trace("READ ASN.1 START SEQUENCE(type=0x{}, length={})", byteToHex(peekType), peekLength);
        streamStack.addFirst(in);
        in = subStream;
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1OutputStreamWriter.java
@@ -22,17 +22,17 @@
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2013 ForgeRock AS.
 */
package org.forgerock.opendj.asn1;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_ASN1_SEQUENCE_WRITE_NOT_STARTED;
import static com.forgerock.opendj.util.StaticUtils.IO_LOG;
import static com.forgerock.opendj.util.StaticUtils.byteToHex;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.logging.Level;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteStringBuilder;
@@ -90,11 +90,8 @@
        writeLength(1);
        out.write(booleanValue ? ASN1.BOOLEAN_VALUE_TRUE : ASN1.BOOLEAN_VALUE_FALSE);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format(
                    "WRITE ASN.1 BOOLEAN(type=0x%x, length=%d, value=%s)", type, 1, String
                            .valueOf(booleanValue)));
        }
        IO_LOG.trace("WRITE ASN.1 BOOLEAN(type=0x{}, length={}, value={})",
                    byteToHex(type), 1, String.valueOf(booleanValue));
        return this;
    }
@@ -121,10 +118,7 @@
        writeLength(childStream.length());
        childStream.writeTo(parentStream);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format("WRITE ASN.1 END SEQUENCE(length=%d)",
                    childStream.length()));
        }
        IO_LOG.trace("WRITE ASN.1 END SEQUENCE(length={})", childStream.length());
        childStream.reset();
        return this;
@@ -153,39 +147,27 @@
                || ((intValue & 0x0000007F) == intValue)) {
            writeLength(1);
            out.write((byte) (intValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 1, intValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 1, intValue);
        } else if (((intValue < 0) && ((intValue & 0xFFFF8000) == 0xFFFF8000))
                || ((intValue & 0x00007FFF) == intValue)) {
            writeLength(2);
            out.write((byte) ((intValue >> 8) & 0xFF));
            out.write((byte) (intValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 2, intValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 2, intValue);
        } else if (((intValue < 0) && ((intValue & 0xFF800000) == 0xFF800000))
                || ((intValue & 0x007FFFFF) == intValue)) {
            writeLength(3);
            out.write((byte) ((intValue >> 16) & 0xFF));
            out.write((byte) ((intValue >> 8) & 0xFF));
            out.write((byte) (intValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 3, intValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 3, intValue);
        } else {
            writeLength(4);
            out.write((byte) ((intValue >> 24) & 0xFF));
            out.write((byte) ((intValue >> 16) & 0xFF));
            out.write((byte) ((intValue >> 8) & 0xFF));
            out.write((byte) (intValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 4, intValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 4, intValue);
        }
        return this;
    }
@@ -199,29 +181,20 @@
                || ((longValue & 0x000000000000007FL) == longValue)) {
            writeLength(1);
            out.write((byte) (longValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 1, longValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 1, longValue);
        } else if (((longValue < 0) && ((longValue & 0xFFFFFFFFFFFF8000L) == 0xFFFFFFFFFFFF8000L))
                || ((longValue & 0x0000000000007FFFL) == longValue)) {
            writeLength(2);
            out.write((byte) ((longValue >> 8) & 0xFF));
            out.write((byte) (longValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 2, longValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 2, longValue);
        } else if (((longValue < 0) && ((longValue & 0xFFFFFFFFFF800000L) == 0xFFFFFFFFFF800000L))
                || ((longValue & 0x00000000007FFFFFL) == longValue)) {
            writeLength(3);
            out.write((byte) ((longValue >> 16) & 0xFF));
            out.write((byte) ((longValue >> 8) & 0xFF));
            out.write((byte) (longValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 3, longValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 3, longValue);
        } else if (((longValue < 0) && ((longValue & 0xFFFFFFFF80000000L) == 0xFFFFFFFF80000000L))
                || ((longValue & 0x000000007FFFFFFFL) == longValue)) {
            writeLength(4);
@@ -229,10 +202,7 @@
            out.write((byte) ((longValue >> 16) & 0xFF));
            out.write((byte) ((longValue >> 8) & 0xFF));
            out.write((byte) (longValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 4, longValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 4, longValue);
        } else if (((longValue < 0) && ((longValue & 0xFFFFFF8000000000L) == 0xFFFFFF8000000000L))
                || ((longValue & 0x0000007FFFFFFFFFL) == longValue)) {
            writeLength(5);
@@ -241,10 +211,7 @@
            out.write((byte) ((longValue >> 16) & 0xFF));
            out.write((byte) ((longValue >> 8) & 0xFF));
            out.write((byte) (longValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 5, longValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 5, longValue);
        } else if (((longValue < 0) && ((longValue & 0xFFFF800000000000L) == 0xFFFF800000000000L))
                || ((longValue & 0x00007FFFFFFFFFFFL) == longValue)) {
            writeLength(6);
@@ -254,10 +221,7 @@
            out.write((byte) ((longValue >> 16) & 0xFF));
            out.write((byte) ((longValue >> 8) & 0xFF));
            out.write((byte) (longValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 6, longValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 6, longValue);
        } else if (((longValue < 0) && ((longValue & 0xFF80000000000000L) == 0xFF80000000000000L))
                || ((longValue & 0x007FFFFFFFFFFFFFL) == longValue)) {
            writeLength(7);
@@ -268,10 +232,7 @@
            out.write((byte) ((longValue >> 16) & 0xFF));
            out.write((byte) ((longValue >> 8) & 0xFF));
            out.write((byte) (longValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 7, longValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 7, longValue);
        } else {
            writeLength(8);
            out.write((byte) ((longValue >> 56) & 0xFF));
@@ -282,10 +243,7 @@
            out.write((byte) ((longValue >> 16) & 0xFF));
            out.write((byte) ((longValue >> 8) & 0xFF));
            out.write((byte) (longValue & 0xFF));
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
                StaticUtils.DEBUG_LOG.finest(String.format(
                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 8, longValue));
            }
            IO_LOG.trace("WRITE ASN.1 INTEGER(type=0x{}, length={}, value={})", byteToHex(type), 8, longValue);
        }
        return this;
    }
@@ -297,10 +255,7 @@
        out.write(type);
        writeLength(0);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format("WRITE ASN.1 NULL(type=0x%x, length=%d)",
                    type, 0));
        }
        IO_LOG.trace("WRITE ASN.1 NULL(type=0x{}, length={})", byteToHex(type), 0);
        return this;
    }
@@ -313,10 +268,7 @@
        writeLength(length);
        out.write(value, offset, length);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format(
                    "WRITE ASN.1 OCTETSTRING(type=0x%x, length=%d)", type, length));
        }
        IO_LOG.trace("WRITE ASN.1 OCTETSTRING(type=0x{}, length={})", byteToHex(type), length);
        return this;
    }
@@ -329,10 +281,8 @@
        writeLength(value.length());
        value.copyTo(out);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format(
                    "WRITE ASN.1 OCTETSTRING(type=0x%x, length=%d)", type, value.length()));
        }
        IO_LOG.trace("WRITE ASN.1 OCTETSTRING(type=0x{}, length={})", byteToHex(type), value.length());
        return this;
    }
@@ -351,11 +301,8 @@
        writeLength(bytes.length);
        out.write(bytes);
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format(
                    "WRITE ASN.1 OCTETSTRING(type=0x%x, length=%d, " + "value=%s)", type,
                    bytes.length, value));
        }
        IO_LOG.trace("WRITE ASN.1 OCTETSTRING(type=0x{}, length={}, value={})",
                byteToHex(type), bytes.length, value);
        return this;
    }
@@ -379,10 +326,7 @@
            out = streamStack.get(stackDepth);
        }
        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
            StaticUtils.DEBUG_LOG.finest(String.format("WRITE ASN.1 START SEQUENCE(type=0x%x)",
                    type));
        }
        IO_LOG.trace("WRITE ASN.1 START SEQUENCE(type=0x{})", byteToHex(type));
        return this;
    }
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractLoadBalancingAlgorithm.java
@@ -27,7 +27,7 @@
package org.forgerock.opendj.ldap;
import static com.forgerock.opendj.util.StaticUtils.DEBUG_LOG;
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.*;
@@ -38,8 +38,6 @@
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import com.forgerock.opendj.util.AsynchronousFutureResult;
import com.forgerock.opendj.util.ReferenceCountedObject;
import com.forgerock.opendj.util.Validator;
@@ -153,10 +151,7 @@
        private synchronized void checkIfAvailable() {
            if (!isOperational.get()
                    && (pendingConnectFuture == null || pendingConnectFuture.isDone())) {
                if (DEBUG_LOG.isLoggable(Level.FINE)) {
                    DEBUG_LOG.fine(String.format("Attempting reconnect to offline factory '%s'",
                            this));
                }
                DEFAULT_LOG.debug("Attempting reconnect to offline factory '{}'", this);
                pendingConnectFuture = factory.getConnectionAsync(this);
            }
        }
@@ -178,11 +173,7 @@
                synchronized (stateLock) {
                    offlineFactoriesCount++;
                    if (offlineFactoriesCount == 1) {
                        // Enable monitoring.
                        if (DEBUG_LOG.isLoggable(Level.FINE)) {
                            DEBUG_LOG.fine(String.format("Starting monitoring thread"));
                        }
                        DEFAULT_LOG.debug("Starting monitoring thread");
                        monitoringFuture =
                                scheduler.get().scheduleWithFixedDelay(new MonitorRunnable(), 0,
                                        monitoringInterval, monitoringIntervalTimeUnit);
@@ -205,9 +196,7 @@
                synchronized (stateLock) {
                    offlineFactoriesCount--;
                    if (offlineFactoriesCount == 0) {
                        if (DEBUG_LOG.isLoggable(Level.FINE)) {
                            DEBUG_LOG.fine(String.format("Stopping monitoring thread"));
                        }
                        DEFAULT_LOG.debug("Stopping monitoring thread");
                        monitoringFuture.cancel(false);
                        monitoringFuture = null;
@@ -217,10 +206,8 @@
        }
        private void handleListenerException(RuntimeException e) {
            if (DEBUG_LOG.isLoggable(Level.SEVERE)) {
                DEBUG_LOG.log(Level.SEVERE,
                        "A run-time error occurred while processing a load-balancer event", e);
            }
            // TODO: I18N
            DEFAULT_LOG.error("A run-time error occurred while processing a load-balancer event", e);
        }
    }
@@ -240,28 +227,21 @@
    /**
     * A default event listener which just logs the event.
     */
    private static final LoadBalancerEventListener DEFAULT_LISTENER =
            new LoadBalancerEventListener() {
    private static final LoadBalancerEventListener DEFAULT_LISTENER = new LoadBalancerEventListener() {
                @Override
                public void handleConnectionFactoryOnline(ConnectionFactory factory) {
                    // Transition from offline to online.
                    if (DEBUG_LOG.isLoggable(Level.INFO)) {
                        DEBUG_LOG.info(String.format("Connection factory'%s' is now operational",
                                factory));
                    }
                }
        @Override
        public void handleConnectionFactoryOnline(ConnectionFactory factory) {
            // Transition from offline to online.
            // TODO: I18N
            DEFAULT_LOG.info("Connection factory '{}' is now operational", factory);
        }
                @Override
                public void handleConnectionFactoryOffline(ConnectionFactory factory,
                        ErrorResultException error) {
                    if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                        DEBUG_LOG.warning(String.format(
                                "Connection factory '%s' is no longer operational: %s", factory,
                                error.getMessage()));
                    }
                }
            };
        @Override
        public void handleConnectionFactoryOffline(ConnectionFactory factory, ErrorResultException error) {
            // TODO: I18N
            DEFAULT_LOG.warn("Connection factory '{}' is no longer operational: {}", factory, error.getMessage());
        }
    };
    private final List<MonitoredConnectionFactory> monitoredFactories;
    private final ReferenceCountedObject<ScheduledExecutorService>.Reference scheduler;
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteString.java
@@ -22,17 +22,17 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2012 ForgeRock AS
 *      Portions copyright 2011-2013 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.logging.Level;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
@@ -365,13 +365,9 @@
        String stringValue;
        try {
            stringValue = new String(b, offset, length, "UTF-8");
        } catch (final Exception e) {
            if (StaticUtils.DEBUG_LOG.isLoggable(Level.WARNING)) {
                StaticUtils.DEBUG_LOG.warning("Unable to decode ByteString "
                        + "bytes as UTF-8 string: " + e.toString());
            }
            stringValue = new String(b, offset, length);
        } catch (final UnsupportedEncodingException e) {
            // TODO: I18N
            throw new RuntimeException("Unable to decode bytes as UTF-8 string", e);
        }
        return stringValue;
@@ -467,8 +463,7 @@
        if (offset < 0) {
            throw new IndexOutOfBoundsException();
        }
        System.arraycopy(buffer, this.offset, bytes, offset, Math
                .min(length, bytes.length - offset));
        System.arraycopy(buffer, this.offset, bytes, offset, Math.min(length, bytes.length - offset));
        return bytes;
    }
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteStringBuilder.java
@@ -22,19 +22,17 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011-2012 ForgeRock AS
 *      Portions copyright 2011-2013 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.util.logging.Level;
import com.forgerock.opendj.util.StaticUtils;
/**
 * A mutable sequence of bytes backed by a byte array.
@@ -596,13 +594,9 @@
                // There is a multi-byte char. Defer to JDK
                try {
                    return append(s.getBytes("UTF-8"));
                } catch (final Exception e) {
                    if (StaticUtils.DEBUG_LOG.isLoggable(Level.WARNING)) {
                        StaticUtils.DEBUG_LOG.warning("Unable to encode String "
                                + "to UTF-8 bytes: " + e.toString());
                    }
                    return append(s.getBytes());
                } catch (final UnsupportedEncodingException e) {
                    // TODO: I18N
                    throw new RuntimeException("Unable to encode String '" + s + "' to UTF-8 bytes", e);
                }
            }
        }
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/CachedConnectionPool.java
@@ -28,7 +28,7 @@
package org.forgerock.opendj.ldap;
import static com.forgerock.opendj.util.StaticUtils.DEBUG_ENABLED;
import static com.forgerock.opendj.util.StaticUtils.DEBUG_LOG;
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;
@@ -44,8 +44,6 @@
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import org.forgerock.opendj.ldap.requests.AbandonRequest;
import org.forgerock.opendj.ldap.requests.AddRequest;
import org.forgerock.opendj.ldap.requests.BindRequest;
@@ -90,11 +88,8 @@
            // Connection attempt failed, so decrease the pool size.
            availableConnections.release();
            if (DEBUG_LOG.isLoggable(Level.FINE)) {
                DEBUG_LOG.fine(String.format(
                        "Connection attempt failed: %s, availableConnections=%d, maxPoolSize=%d",
                        error.getMessage(), currentPoolSize(), maxPoolSize));
            }
            DEFAULT_LOG.debug("Connection attempt failed: availableConnections={}, maxPoolSize={}",
                    currentPoolSize(), maxPoolSize, error);
            QueueElement holder;
            synchronized (queue) {
@@ -112,11 +107,8 @@
        @Override
        public void handleResult(final Connection connection) {
            if (DEBUG_LOG.isLoggable(Level.FINE)) {
                DEBUG_LOG.fine(String.format(
                        "Connection attempt succeeded:  availableConnections=%d, maxPoolSize=%d",
                        currentPoolSize(), maxPoolSize));
            }
            DEFAULT_LOG.debug("Connection attempt succeeded:  availableConnections={}, maxPoolSize={}",
                    currentPoolSize(), maxPoolSize);
            publishConnection(connection);
        }
    }
@@ -262,11 +254,8 @@
                connection.close();
                factory.getConnectionAsync(connectionResultHandler);
                if (DEBUG_LOG.isLoggable(Level.FINE)) {
                    DEBUG_LOG.fine(String.format(
                            "Connection no longer valid: availableConnections=%d, maxPoolSize=%d",
                            currentPoolSize(), maxPoolSize));
                }
                DEFAULT_LOG.debug("Connection no longer valid: availableConnections={}, maxPoolSize={}",
                        currentPoolSize(), maxPoolSize);
            }
            // Invoke listeners.
@@ -568,11 +557,8 @@
            // Close the idle connections.
            if (!idleConnections.isEmpty()) {
                if (DEBUG_LOG.isLoggable(Level.FINE)) {
                    DEBUG_LOG.fine(String.format("Closing %d idle pooled connections: "
                            + "availableConnections=%d, maxPoolSize=%d", idleConnections.size(),
                            currentPoolSize(), maxPoolSize));
                }
                DEFAULT_LOG.debug("Closing {} idle pooled connections: availableConnections={}, maxPoolSize={}",
                        idleConnections.size(), currentPoolSize(), maxPoolSize);
                for (final Connection connection : idleConnections) {
                    connection.close();
                }
@@ -728,11 +714,8 @@
            }
        }
        if (DEBUG_LOG.isLoggable(Level.FINE)) {
            DEBUG_LOG.fine(String.format(
                    "Connection pool is closing: availableConnections=%d, maxPoolSize=%d",
                    currentPoolSize(), maxPoolSize));
        }
        DEFAULT_LOG.debug("Connection pool is closing: availableConnections={}, maxPoolSize={}",
                currentPoolSize(), maxPoolSize);
        if (idleTimeoutFuture != null) {
            idleTimeoutFuture.cancel(false);
@@ -791,11 +774,8 @@
                    connection.close();
                    availableConnections.release();
                    if (DEBUG_LOG.isLoggable(Level.FINE)) {
                        DEBUG_LOG.fine(String.format(
                                "Connection no longer valid: availableConnections=%d, poolSize=%d",
                                currentPoolSize(), maxPoolSize));
                    }
                    DEFAULT_LOG.debug("Connection no longer valid: availableConnections={}, poolSize={}",
                            currentPoolSize(), maxPoolSize);
                }
            } else {
                // Grow the pool if needed.
@@ -866,12 +846,9 @@
            availableConnections.release();
            connection.close();
            if (DEBUG_LOG.isLoggable(Level.FINE)) {
                DEBUG_LOG.fine(String.format(
                        "Closing connection because connection pool is closing: "
                                + "availableConnections=%d, maxPoolSize=%d", currentPoolSize(),
                        maxPoolSize));
            }
            DEFAULT_LOG.debug(
                    "Closing connection because connection pool is closing: availableConnections={}, maxPoolSize={}",
                    currentPoolSize(), maxPoolSize);
            if (holder != null) {
                final ErrorResultException e =
@@ -879,11 +856,8 @@
                                ERR_CONNECTION_POOL_CLOSING.get(toString()).toString());
                holder.getWaitingFuture().handleErrorResult(e);
                if (DEBUG_LOG.isLoggable(Level.FINE)) {
                    DEBUG_LOG.fine(String.format(
                            "Connection attempt failed: %s, availableConnections=%d, poolSize=%d",
                            e.getMessage(), currentPoolSize(), maxPoolSize));
                }
                DEFAULT_LOG.debug("Connection attempt failed: availableConnections={}, poolSize={}",
                        currentPoolSize(), maxPoolSize, e);
            }
        } else {
            holder.getWaitingFuture().handleResult(
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactory.java
@@ -27,7 +27,7 @@
package org.forgerock.opendj.ldap;
import static com.forgerock.opendj.util.StaticUtils.DEBUG_LOG;
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;
@@ -46,8 +46,6 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.AbstractQueuedSynchronizer;
import java.util.logging.Level;
import org.forgerock.opendj.ldap.requests.AbandonRequest;
import org.forgerock.opendj.ldap.requests.AddRequest;
import org.forgerock.opendj.ldap.requests.BindRequest;
@@ -493,11 +491,7 @@
                 * that the heart beat was aborted by a client-side close.
                 */
                if (!(error instanceof CancelledResultException)) {
                    if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                        DEBUG_LOG.warning(String.format(
                                "Heartbeat failed for connection factory '%s': %s", factory, error
                                        .getMessage()));
                    }
                    DEFAULT_LOG.warn("Heartbeat failed for connection factory '{}'", factory, error);
                    timestamp(error);
                }
                releaseHeartBeatLock();
@@ -804,10 +798,7 @@
                 */
                final long currentTimeMillis = timeSource.currentTimeMillis();
                if (lastResponseTimestamp < (currentTimeMillis - timeoutMS)) {
                    if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                        DEBUG_LOG.warning(String.format(
                                "No heartbeat detected for connection '%s'", connection));
                    }
                    DEFAULT_LOG.warn("No heartbeat detected for connection '{}'", connection);
                    handleConnectionError(false, newHeartBeatTimeoutError());
                }
            }
@@ -1194,11 +1185,10 @@
        if (isClosed.compareAndSet(false, true)) {
            synchronized (validConnections) {
                if (!validConnections.isEmpty()) {
                    if (DEBUG_LOG.isLoggable(Level.FINE)) {
                        DEBUG_LOG.fine(String.format(
                                "HeartbeatConnectionFactory '%s' is closing while %d "
                                        + "active connections remain", toString(), validConnections
                                        .size()));
                    if (DEFAULT_LOG.isDebugEnabled()) {
                        DEFAULT_LOG.debug(
                                "HeartbeatConnectionFactory '{}' is closing while {} active connections remain",
                                toString(), validConnections.size());
                    }
                }
            }
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Matcher.java
@@ -27,12 +27,10 @@
package org.forgerock.opendj.ldap;
import static com.forgerock.opendj.util.StaticUtils.DEBUG_LOG;
import static com.forgerock.opendj.util.StaticUtils.DEFAULT_LOG;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.forgerock.opendj.ldap.schema.MatchingRuleUse;
@@ -223,9 +221,7 @@
    private static final class Visitor implements FilterVisitor<MatcherImpl, Schema> {
        public MatcherImpl visitAndFilter(final Schema schema, final List<Filter> subFilters) {
            if (subFilters.isEmpty()) {
                if (DEBUG_LOG.isLoggable(Level.FINER)) {
                    DEBUG_LOG.finer("Empty add filter component. " + "Will always return TRUE");
                }
                DEFAULT_LOG.trace("Empty add filter component. Will always return TRUE");
                return TRUE;
            }
@@ -245,28 +241,23 @@
            try {
                ad = AttributeDescription.valueOf(attributeDescription, schema);
            } catch (final LocalizedIllegalArgumentException e) {
                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                    DEBUG_LOG.warning("Attribute description " + attributeDescription
                            + " is not recognized: " + e.getMessage());
                }
                // TODO: I18N
                DEFAULT_LOG.warn("Attribute description {} is not recognized", attributeDescription, e);
                return UNDEFINED;
            }
            if ((rule = ad.getAttributeType().getApproximateMatchingRule()) == null) {
                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                    DEBUG_LOG.warning("The attribute type " + attributeDescription
                            + " does not define an approximate matching rule");
                }
                // TODO: I18N
                DEFAULT_LOG.warn("The attribute type {} does not define an approximate matching rule",
                        attributeDescription);
                return UNDEFINED;
            }
            try {
                assertion = rule.getAssertion(assertionValue);
            } catch (final DecodeException de) {
                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                    DEBUG_LOG.warning("The assertion value " + assertionValue + " is invalid: "
                            + de.getMessage());
                }
                // TODO: I18N
                DEFAULT_LOG.warn("The assertion value {} is invalid", assertionValue, de);
                return UNDEFINED;
            }
            return new AssertionMatcherImpl(ad, rule, null, assertion, false);
@@ -281,28 +272,24 @@
            try {
                ad = AttributeDescription.valueOf(attributeDescription, schema);
            } catch (final LocalizedIllegalArgumentException e) {
                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                    DEBUG_LOG.warning("Attribute description " + attributeDescription
                            + " is not recognized: " + e.getMessage());
                }
                // TODO: I18N
                DEFAULT_LOG.warn("Attribute description {} is not recognized: {}",
                        attributeDescription, e.getMessage());
                return UNDEFINED;
            }
            if ((rule = ad.getAttributeType().getEqualityMatchingRule()) == null) {
                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                    DEBUG_LOG.warning("The attribute type " + attributeDescription
                            + " does not define an equality matching rule");
                }
                // TODO: I18N
                DEFAULT_LOG.warn("The attribute type {} does not define an equality matching rule",
                        attributeDescription);
                return UNDEFINED;
            }
            try {
                assertion = rule.getAssertion(assertionValue);
            } catch (final DecodeException de) {
                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                    DEBUG_LOG.warning("The assertion value " + assertionValue + " is invalid: "
                            + de.getMessage());
                }
                // TODO: I18N
                DEFAULT_LOG.warn("The assertion value {} is invalid", assertionValue, de);
                return UNDEFINED;
            }
            return new AssertionMatcherImpl(ad, rule, null, assertion, false);
@@ -320,10 +307,8 @@
                try {
                    rule = schema.getMatchingRule(matchingRule);
                } catch (final UnknownSchemaElementException e) {
                    if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                        DEBUG_LOG.warning("Matching rule " + matchingRule + " is not recognized: "
                                + e.getMessage());
                    }
                    // TODO: I18N
                    DEFAULT_LOG.warn("Matching rule {} is not recognized", matchingRule);
                    return UNDEFINED;
                }
            }
@@ -332,48 +317,39 @@
                try {
                    ad = AttributeDescription.valueOf(attributeDescription, schema);
                } catch (final LocalizedIllegalArgumentException e) {
                    if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                        DEBUG_LOG.warning("Attribute description " + attributeDescription
                                + " is not recognized: " + e.getMessage());
                    }
                    // TODO: I18N
                    DEFAULT_LOG.warn("Attribute description {} is not recognized", attributeDescription, e);
                    return UNDEFINED;
                }
                if (rule == null) {
                    if ((rule = ad.getAttributeType().getEqualityMatchingRule()) == null) {
                        if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                            DEBUG_LOG.warning("The attribute type " + attributeDescription
                                    + " does not define an equality matching rule");
                        }
                        // TODO: I18N
                        DEFAULT_LOG.warn("The attribute type {} does not define an equality matching rule",
                                attributeDescription);
                        return UNDEFINED;
                    }
                } else {
                    try {
                        ruleUse = schema.getMatchingRuleUse(rule);
                        if (!ruleUse.hasAttribute(ad.getAttributeType())) {
                            if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                                DEBUG_LOG.warning("The matching rule " + matchingRule
                                        + " is not valid for attribute type "
                                        + attributeDescription);
                            }
                            // TODO: I18N
                            DEFAULT_LOG.warn("The matching rule {} is not valid for attribute type {}",
                                    matchingRule, attributeDescription);
                            return UNDEFINED;
                        }
                    } catch (final UnknownSchemaElementException e) {
                        if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                            DEBUG_LOG.warning("No matching rule use is defined for "
                                    + "matching rule " + matchingRule);
                            return UNDEFINED;
                        }
                        // TODO: I18N
                        DEFAULT_LOG.warn("No matching rule use is defined for matching rule {}", matchingRule);
                        return UNDEFINED;
                    }
                }
            } else {
                try {
                    ruleUse = schema.getMatchingRuleUse(rule);
                } catch (final UnknownSchemaElementException e) {
                    if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                        DEBUG_LOG.warning("No matching rule use is defined for " + "matching rule "
                                + matchingRule);
                    }
                    // TODO: I18N
                    DEFAULT_LOG.warn("No matching rule use is defined for matching rule {}", matchingRule);
                    return UNDEFINED;
                }
            }
@@ -381,10 +357,8 @@
            try {
                assertion = rule.getAssertion(assertionValue);
            } catch (final DecodeException de) {
                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                    DEBUG_LOG.warning("The assertion value " + assertionValue + " is invalid: "
                            + de.getMessage());
                }
                // TODO: I18N
                DEFAULT_LOG.warn("The assertion value {} is invalid", assertionValue, de);
                return UNDEFINED;
            }
            return new AssertionMatcherImpl(ad, rule, ruleUse, assertion, dnAttributes);
@@ -399,28 +373,24 @@
            try {
                ad = AttributeDescription.valueOf(attributeDescription, schema);
            } catch (final LocalizedIllegalArgumentException e) {
                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                    DEBUG_LOG.warning("Attribute description " + attributeDescription
                            + " is not recognized: " + e.getMessage());
                }
                // TODO: I18N
                DEFAULT_LOG.warn("Attribute description {} is not recognized", attributeDescription, e);
                return UNDEFINED;
            }
            if ((rule = ad.getAttributeType().getOrderingMatchingRule()) == null) {
                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                    DEBUG_LOG.warning("The attribute type " + attributeDescription
                            + " does not define an ordering matching rule");
                }
                // TODO: I18N
                DEFAULT_LOG.warn("The attribute type {} does not define an ordering matching rule",
                        attributeDescription);
                return UNDEFINED;
            }
            try {
                assertion = rule.getGreaterOrEqualAssertion(assertionValue);
            } catch (final DecodeException de) {
                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                    DEBUG_LOG.warning("The assertion value " + assertionValue + " is invalid: "
                            + de.getMessage());
                }
                // TODO: I18N
                DEFAULT_LOG.warn("The assertion value {} is invalid", assertionValue, de);
                return UNDEFINED;
            }
            return new AssertionMatcherImpl(ad, rule, null, assertion, false);
@@ -435,28 +405,23 @@
            try {
                ad = AttributeDescription.valueOf(attributeDescription, schema);
            } catch (final LocalizedIllegalArgumentException e) {
                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                    DEBUG_LOG.warning("Attribute description " + attributeDescription
                            + " is not recognized: " + e.getMessage());
                }
                // TODO: I18N
                DEFAULT_LOG.warn("Attribute description {} is not recognized", attributeDescription, e);
                return UNDEFINED;
            }
            if ((rule = ad.getAttributeType().getOrderingMatchingRule()) == null) {
                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                    DEBUG_LOG.warning("The attribute type " + attributeDescription
                            + " does not define an ordering matching rule");
                }
                // TODO: I18N
                DEFAULT_LOG.warn("The attribute type {} does not define an ordering matching rule",
                        attributeDescription);
                return UNDEFINED;
            }
            try {
                assertion = rule.getLessOrEqualAssertion(assertionValue);
            } catch (final DecodeException de) {
                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                    DEBUG_LOG.warning("The assertion value " + assertionValue + " is invalid: "
                            + de.getMessage());
                }
                // TODO: I18N
                DEFAULT_LOG.warn("The assertion value {} is invalid", assertionValue , de);
                return UNDEFINED;
            }
            return new AssertionMatcherImpl(ad, rule, null, assertion, false);
@@ -469,9 +434,7 @@
        public MatcherImpl visitOrFilter(final Schema schema, final List<Filter> subFilters) {
            if (subFilters.isEmpty()) {
                if (DEBUG_LOG.isLoggable(Level.FINER)) {
                    DEBUG_LOG.finer("Empty or filter component. " + "Will always return FALSE");
                }
                DEFAULT_LOG.trace("Empty or filter component. Will always return FALSE");
                return FALSE;
            }
@@ -487,10 +450,8 @@
            try {
                ad = AttributeDescription.valueOf(attributeDescription, schema);
            } catch (final LocalizedIllegalArgumentException e) {
                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                    DEBUG_LOG.warning("Attribute description " + attributeDescription
                            + " is not recognized: " + e.getMessage());
                }
                // TODO: I18N
                DEFAULT_LOG.warn("Attribute description {} is not recognized", attributeDescription, e);
                return UNDEFINED;
            }
@@ -507,28 +468,23 @@
            try {
                ad = AttributeDescription.valueOf(attributeDescription, schema);
            } catch (final LocalizedIllegalArgumentException e) {
                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                    DEBUG_LOG.warning("Attribute description " + attributeDescription
                            + " is not recognized: " + e.getMessage());
                }
                // TODO: I18N
                DEFAULT_LOG.warn("Attribute description {} is not recognized", attributeDescription, e);
                return UNDEFINED;
            }
            if ((rule = ad.getAttributeType().getSubstringMatchingRule()) == null) {
                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                    DEBUG_LOG.warning("The attribute type " + attributeDescription
                            + " does not define an substring matching rule");
                }
                // TODO: I18N
                DEFAULT_LOG.warn("The attribute type {} does not define an substring matching rule",
                        attributeDescription);
                return UNDEFINED;
            }
            try {
                assertion = rule.getAssertion(initialSubstring, anySubstrings, finalSubstring);
            } catch (final DecodeException de) {
                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                    DEBUG_LOG.warning("The substring assertion values contain an invalid value: "
                            + de.getMessage());
                }
                // TODO: I18N
                DEFAULT_LOG.warn("The substring assertion values contain an invalid value", de);
                return UNDEFINED;
            }
            return new AssertionMatcherImpl(ad, rule, null, assertion, false);
@@ -536,10 +492,9 @@
        public MatcherImpl visitUnrecognizedFilter(final Schema schema, final byte filterTag,
                final ByteString filterBytes) {
            if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                DEBUG_LOG.warning("The type of filtering requested with tag "
                        + StaticUtils.byteToHex(filterTag) + " is not implemented");
            }
            // TODO: I18N
            DEFAULT_LOG.warn("The type of filtering requested with tag {} is not implemented",
                    StaticUtils.byteToHex(filterTag));
            return UNDEFINED;
        }
    }
@@ -577,11 +532,9 @@
            final ByteString normalizedValue = rule.normalizeAttributeValue(v);
            return assertion.matches(normalizedValue);
        } catch (final DecodeException de) {
            if (DEBUG_LOG.isLoggable(Level.WARNING)) {
                DEBUG_LOG.warning("The attribute value " + v.toString() + " is "
                        + "invalid for matching rule " + rule.getNameOrOID()
                        + ". Possible schema error? : " + de.getMessage());
            }
            // TODO: I18N
            DEFAULT_LOG.warn("The attribute value {} is invalid for matching rule {}. Possible schema error?",
                    v.toString(), rule.getNameOrOID(), de);
            return ConditionResult.UNDEFINED;
        }
    }
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/EntryChangeNotificationResponseControl.java
@@ -167,8 +167,7 @@
                            changeNumber = reader.readInteger();
                        }
                    } catch (final IOException e) {
                        StaticUtils.DEBUG_LOG.throwing("EntryChangeNotificationControl.Decoder",
                                "decode", e);
                        StaticUtils.CONTROLS_LOG.debug("", e);
                        final LocalizableMessage message =
                                ERR_ECN_CANNOT_DECODE_VALUE.get(getExceptionMessage(e));
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/MatchedValuesRequestControl.java
@@ -207,7 +207,7 @@
                        return new MatchedValuesRequestControl(control.isCritical(), Collections
                                .unmodifiableList(filters));
                    } catch (final IOException e) {
                        StaticUtils.DEBUG_LOG.throwing("MatchedValuesControl.Decoder", "decode", e);
                        StaticUtils.CONTROLS_LOG.debug("", e);
                        final LocalizableMessage message =
                                ERR_MATCHEDVALUES_CANNOT_DECODE_VALUE_AS_SEQUENCE
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiringResponseControl.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2013 ForgeRock AS
 */
package org.forgerock.opendj.ldap.controls;
@@ -103,8 +104,7 @@
                    try {
                        secondsUntilExpiration = Integer.parseInt(control.getValue().toString());
                    } catch (final Exception e) {
                        StaticUtils.DEBUG_LOG.throwing("PasswordExpiringControl.Decoder", "decode",
                                e);
                        StaticUtils.CONTROLS_LOG.debug("", e);
                        final LocalizableMessage message =
                                ERR_PWEXPIRING_CANNOT_DECODE_SECONDS_UNTIL_EXPIRATION
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyResponseControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2013 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
@@ -182,8 +182,7 @@
                        return new PasswordPolicyResponseControl(control.isCritical(), warningType,
                                warningValue, errorType);
                    } catch (final IOException e) {
                        StaticUtils.DEBUG_LOG.throwing("PasswordPolicyControl.ResponseDecoder",
                                "decode", e);
                        StaticUtils.CONTROLS_LOG.debug("", e);
                        final LocalizableMessage message =
                                ERR_PWPOLICYRES_DECODE_ERROR.get(getExceptionMessage(e));
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchRequestControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2013 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
@@ -146,8 +146,7 @@
                        reader.readEndSequence();
                    } catch (final IOException e) {
                        StaticUtils.DEBUG_LOG.throwing("PersistentSearchControl.Decoder", "decode",
                                e);
                        StaticUtils.CONTROLS_LOG.debug("Unable to read sequence", e);
                        final LocalizableMessage message =
                                ERR_PSEARCH_CANNOT_DECODE_VALUE.get(getExceptionMessage(e));
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PostReadRequestControl.java
@@ -149,8 +149,7 @@
                        }
                        reader.readEndSequence();
                    } catch (final Exception ae) {
                        StaticUtils.DEBUG_LOG.throwing("PostReadRequestControl", "decodeControl",
                                ae);
                        StaticUtils.CONTROLS_LOG.debug("Unable to read sequence", ae);
                        final LocalizableMessage message =
                                ERR_POSTREADREQ_CANNOT_DECODE_VALUE.get(ae.getMessage());
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PostReadResponseControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2013 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
@@ -120,8 +120,7 @@
                    try {
                        searchEntry = LDAPUtils.decodeSearchResultEntry(reader, options);
                    } catch (final IOException le) {
                        StaticUtils.DEBUG_LOG.throwing("PostReadResponseControl", "decodeControl",
                                le);
                        StaticUtils.CONTROLS_LOG.debug("Unable to read result entry ", le);
                        final LocalizableMessage message =
                                ERR_POSTREADRESP_CANNOT_DECODE_VALUE.get(le.getMessage());
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PreReadRequestControl.java
@@ -147,13 +147,12 @@
                            attributes = emptyList();
                        }
                        reader.readEndSequence();
                    } catch (final Exception ae) {
                        StaticUtils.DEBUG_LOG
                                .throwing("PreReadRequestControl", "decodeControl", ae);
                    } catch (final Exception ex) {
                        StaticUtils.CONTROLS_LOG.debug("Unable to read sequence", ex);
                        final LocalizableMessage message =
                                ERR_PREREADREQ_CANNOT_DECODE_VALUE.get(ae.getMessage());
                        throw DecodeException.error(message, ae);
                                ERR_PREREADREQ_CANNOT_DECODE_VALUE.get(ex.getMessage());
                        throw DecodeException.error(message, ex);
                    }
                    if (attributes.isEmpty()) {
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PreReadResponseControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2013 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
@@ -119,8 +119,7 @@
                    try {
                        searchEntry = LDAPUtils.decodeSearchResultEntry(reader, options);
                    } catch (final IOException le) {
                        StaticUtils.DEBUG_LOG.throwing("PreReadResponseControl", "decodeControl",
                                le);
                        StaticUtils.CONTROLS_LOG.debug("Unable to read result entry", le);
                        final LocalizableMessage message =
                                ERR_PREREADRESP_CANNOT_DECODE_VALUE.get(le.getMessage());
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV1RequestControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2013 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
@@ -109,8 +109,7 @@
                        authorizationDNString = reader.readOctetStringAsString();
                        reader.readEndSequence();
                    } catch (final IOException e) {
                        StaticUtils.DEBUG_LOG.throwing("ProxiedAuthV1RequestControl",
                                "decodeControl", e);
                        StaticUtils.CONTROLS_LOG.debug("Unable to read sequence", e);
                        final LocalizableMessage message =
                                ERR_PROXYAUTH1_CANNOT_DECODE_VALUE.get(getExceptionMessage(e));
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV2RequestControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2013 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
@@ -129,8 +129,7 @@
                            authorizationID = control.getValue().toString();
                        }
                    } catch (final IOException e) {
                        StaticUtils.DEBUG_LOG.throwing("ProxiedAuthV2RequestControl",
                                "decodeControl", e);
                        StaticUtils.CONTROLS_LOG.debug("Unable to read exceptionID", e);
                        final LocalizableMessage message =
                                ERR_PROXYAUTH2_CANNOT_DECODE_VALUE.get(getExceptionMessage(e));
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/SimplePagedResultsControl.java
@@ -22,11 +22,12 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2013 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;
@@ -39,7 +40,6 @@
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import com.forgerock.opendj.util.StaticUtils;
import com.forgerock.opendj.util.Validator;
/**
@@ -169,7 +169,7 @@
                    try {
                        reader.readStartSequence();
                    } catch (final Exception e) {
                        StaticUtils.DEBUG_LOG.throwing("PagedResultsControl.Decoder", "decode", e);
                        CONTROLS_LOG.debug("Unable to read start sequence", e);
                        final LocalizableMessage message =
                                ERR_LDAP_PAGED_RESULTS_DECODE_SEQUENCE.get(String.valueOf(e));
@@ -180,7 +180,7 @@
                    try {
                        size = (int) reader.readInteger();
                    } catch (final Exception e) {
                        StaticUtils.DEBUG_LOG.throwing("PagedResultsControl.Decoder", "decode", e);
                        CONTROLS_LOG.debug("Unable to read size", e);
                        final LocalizableMessage message =
                                ERR_LDAP_PAGED_RESULTS_DECODE_SIZE.get(String.valueOf(e));
@@ -191,7 +191,7 @@
                    try {
                        cookie = reader.readOctetString();
                    } catch (final Exception e) {
                        StaticUtils.DEBUG_LOG.throwing("PagedResultsControl.Decoder", "decode", e);
                        CONTROLS_LOG.debug("Unable to read cookie", e);
                        final LocalizableMessage message =
                                ERR_LDAP_PAGED_RESULTS_DECODE_COOKIE.get(String.valueOf(e));
@@ -201,7 +201,7 @@
                    try {
                        reader.readEndSequence();
                    } catch (final Exception e) {
                        StaticUtils.DEBUG_LOG.throwing("PagedResultsControl.Decoder", "decode", e);
                        CONTROLS_LOG.debug("Unable to read end sequence", e);
                        final LocalizableMessage message =
                                ERR_LDAP_PAGED_RESULTS_DECODE_SEQUENCE.get(String.valueOf(e));
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/SubentriesRequestControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2012 ForgeRock AS
 *      Portions copyright 2011-2013 ForgeRock AS
 */
package org.forgerock.opendj.ldap.controls;
@@ -138,8 +138,7 @@
                    try {
                        visibility = reader.readBoolean();
                    } catch (final IOException e) {
                        StaticUtils.DEBUG_LOG.throwing("SubentriesRequestControl.Decoder",
                                "decode", e);
                        StaticUtils.CONTROLS_LOG.debug("Unable to read visbility", e);
                        final LocalizableMessage message =
                                ERR_SUBENTRIES_CANNOT_DECODE_VALUE.get(getExceptionMessage(e));
                        throw DecodeException.error(message);
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxImpl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011 ForgeRock AS
 *      Portions copyright 2011-2013 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
@@ -30,13 +30,13 @@
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 org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.DecodeException;
import com.forgerock.opendj.util.StaticUtils;
import com.forgerock.opendj.util.SubstringReader;
/**
@@ -75,7 +75,7 @@
                final LocalizableMessage message =
                        ERR_ATTR_SYNTAX_ATTRTYPE_EMPTY_VALUE1.get(definition);
                final DecodeException e = DecodeException.error(message);
                StaticUtils.DEBUG_LOG.throwing("AttributeTypeSyntax", "valueIsAcceptable", e);
                SCHEMA_LOG.debug("", 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);
                StaticUtils.DEBUG_LOG.throwing("AttributeTypeSyntax", "valueIsAcceptable", e);
                SCHEMA_LOG.debug("", e);
                throw e;
            }
@@ -198,8 +198,7 @@
                                WARN_ATTR_SYNTAX_ATTRTYPE_INVALID_ATTRIBUTE_USAGE1.get(definition,
                                        usageStr);
                        final DecodeException e = DecodeException.error(message);
                        StaticUtils.DEBUG_LOG.throwing("AttributeTypeSyntax", "valueIsAcceptable",
                                e);
                        SCHEMA_LOG.debug("", e);
                        throw e;
                    }
                } else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
@@ -214,7 +213,7 @@
                    final LocalizableMessage message =
                            ERR_ATTR_SYNTAX_ATTRTYPE_ILLEGAL_TOKEN1.get(definition, tokenName);
                    final DecodeException e = DecodeException.error(message);
                    StaticUtils.DEBUG_LOG.throwing("AttributeTypeSyntax", "valueIsAcceptable", e);
                    SCHEMA_LOG.debug("", e);
                    throw e;
                }
            }
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxImpl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011 ForgeRock AS
 *      Portions copyright 2011-2013 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
@@ -33,13 +33,13 @@
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 org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.DecodeException;
import com.forgerock.opendj.util.StaticUtils;
import com.forgerock.opendj.util.SubstringReader;
/**
@@ -82,7 +82,7 @@
                // whitespace. That is illegal.
                final LocalizableMessage message = ERR_ATTR_SYNTAX_DCR_EMPTY_VALUE1.get(definition);
                final DecodeException e = DecodeException.error(message);
                StaticUtils.DEBUG_LOG.throwing("DITConentRuleSyntax", "valueIsAcceptable", e);
                SCHEMA_LOG.debug("", e);
                throw e;
            }
@@ -94,7 +94,7 @@
                        ERR_ATTR_SYNTAX_DCR_EXPECTED_OPEN_PARENTHESIS.get(definition,
                                (reader.pos() - 1), String.valueOf(c));
                final DecodeException e = DecodeException.error(message);
                StaticUtils.DEBUG_LOG.throwing("DITContentRuleSyntax", "valueIsAcceptable", e);
                SCHEMA_LOG.debug("", e);
                throw e;
            }
@@ -151,7 +151,7 @@
                    final LocalizableMessage message =
                            ERR_ATTR_SYNTAX_DCR_ILLEGAL_TOKEN1.get(definition, tokenName);
                    final DecodeException e = DecodeException.error(message);
                    StaticUtils.DEBUG_LOG.throwing("DITContentRuleSyntax", "valueIsAcceptable", e);
                    SCHEMA_LOG.debug("", e);
                    throw e;
                }
            }
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRuleSyntaxImpl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011 ForgeRock AS
 *      Portions copyright 2011-2013 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
@@ -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.DEBUG_LOG.throwing("DITStructureRuleSyntax", "valueIsAcceptable", e);
                StaticUtils.SCHEMA_LOG.debug("", e);
                throw e;
            }
@@ -88,7 +88,7 @@
                        ERR_ATTR_SYNTAX_DSR_EXPECTED_OPEN_PARENTHESIS.get(definition,
                                (reader.pos() - 1), String.valueOf(c));
                final DecodeException e = DecodeException.error(message);
                StaticUtils.DEBUG_LOG.throwing("DITStructureRuleSyntax", "valueIsAcceptable", e);
                StaticUtils.SCHEMA_LOG.debug("", e);
                throw e;
            }
@@ -143,8 +143,7 @@
                    final LocalizableMessage message =
                            ERR_ATTR_SYNTAX_DSR_ILLEGAL_TOKEN1.get(definition, tokenName);
                    final DecodeException e = DecodeException.error(message);
                    StaticUtils.DEBUG_LOG
                            .throwing("DITStructureRuleSyntax", "valueIsAcceptable", e);
                    StaticUtils.SCHEMA_LOG.debug("", e);
                    throw e;
                }
            }
@@ -152,7 +151,7 @@
            if (nameForm == null) {
                final LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_NO_NAME_FORM.get(definition);
                final DecodeException e = DecodeException.error(message);
                StaticUtils.DEBUG_LOG.throwing("DITStructureRuleSyntax", "valueIsAcceptable", e);
                StaticUtils.SCHEMA_LOG.debug("", e);
                throw e;
            }
            return true;
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DoubleMetaphoneApproximateMatchingRuleImpl.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2013 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
@@ -890,8 +891,10 @@
            return true;
        } catch (final Exception e) {
            StaticUtils.DEBUG_LOG.throwing("DoubleMetaphoneApproximateMatchingRule",
                    "hasSubstring", e);
            if (StaticUtils.SCHEMA_LOG.isDebugEnabled()) {
                StaticUtils.SCHEMA_LOG.debug("Unable to check that '" + value + "' has substring '" + substring
                        + "' at position " + start, e);
            }
            return false;
        }
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleImpl.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2013 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
@@ -45,8 +46,7 @@
        try {
            return ByteString.valueOf(Integer.parseInt(value.toString()));
        } catch (final Exception e) {
            StaticUtils.DEBUG_LOG.throwing("IntegerEqualityMatchingRule",
                    "normalizeAttributeValue", e);
            StaticUtils.SCHEMA_LOG.debug("", e);
            final LocalizableMessage message =
                    WARN_ATTR_SYNTAX_ILLEGAL_INTEGER.get(value.toString());
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerFirstComponentEqualityMatchingRuleImpl.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2013 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
@@ -65,8 +66,7 @@
                }
            };
        } catch (final Exception e) {
            StaticUtils.DEBUG_LOG.throwing("IntegerFirstComponentEqualityMatchingRule",
                    "getAssertion", e);
            StaticUtils.SCHEMA_LOG.debug("", e);
            final LocalizableMessage message =
                    ERR_EMR_INTFIRSTCOMP_FIRST_COMPONENT_NOT_INT.get(value.toString());
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleImpl.java
@@ -45,8 +45,7 @@
        try {
            return ByteString.valueOf(Integer.parseInt(value.toString()));
        } catch (final Exception e) {
            StaticUtils.DEBUG_LOG.throwing("IntegerOrderingMatchingRule",
                    "normalizeAttributeValue", e);
            StaticUtils.SCHEMA_LOG.debug("", e);
            final LocalizableMessage message =
                    WARN_ATTR_SYNTAX_ILLEGAL_INTEGER.get(value.toString());
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxDescriptionSyntaxImpl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011 ForgeRock AS
 *      Portions copyright 2011-2013 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
@@ -30,6 +30,7 @@
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 java.util.Collections;
import java.util.HashMap;
@@ -43,7 +44,6 @@
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.DecodeException;
import com.forgerock.opendj.util.StaticUtils;
import com.forgerock.opendj.util.SubstringReader;
/**
@@ -84,8 +84,7 @@
                final LocalizableMessage message =
                        ERR_ATTR_SYNTAX_ATTRSYNTAX_EMPTY_VALUE1.get(definition);
                final DecodeException e = DecodeException.error(message);
                StaticUtils.DEBUG_LOG.throwing("LDAPSyntaxDescriptionSyntax", "valueIsAcceptable",
                        e);
                SCHEMA_LOG.debug("", e);
                throw e;
            }
@@ -97,8 +96,7 @@
                        ERR_ATTR_SYNTAX_ATTRSYNTAX_EXPECTED_OPEN_PARENTHESIS.get(definition,
                                (reader.pos() - 1), String.valueOf(c));
                final DecodeException e = DecodeException.error(message);
                StaticUtils.DEBUG_LOG.throwing("LDAPSyntaxDescriptionSyntax", "valueIsAcceptable",
                        e);
                SCHEMA_LOG.debug("", e);
                throw e;
            }
@@ -143,8 +141,7 @@
                    final LocalizableMessage message =
                            ERR_ATTR_SYNTAX_ATTRSYNTAX_ILLEGAL_TOKEN1.get(definition, tokenName);
                    final DecodeException e = DecodeException.error(message);
                    StaticUtils.DEBUG_LOG.throwing("LDAPSyntaxDescriptionSyntax",
                            "valueIsAcceptable", e);
                    SCHEMA_LOG.debug("", e);
                    throw e;
                }
            }
@@ -161,8 +158,7 @@
                                    WARN_ATTR_SYNTAX_LDAPSYNTAX_REGEX_INVALID_PATTERN.get(oid,
                                            pattern);
                            final DecodeException de = DecodeException.error(message, e);
                            StaticUtils.DEBUG_LOG.throwing("LDAPSyntaxDescriptionSyntax",
                                    "valueIsAcceptable", de);
                            SCHEMA_LOG.debug("", de);
                            throw de;
                        }
                        break;
@@ -177,8 +173,7 @@
                                        WARN_ATTR_SYNTAX_LDAPSYNTAX_ENUM_DUPLICATE_VALUE.get(oid,
                                                entry, j);
                                final DecodeException e = DecodeException.error(message);
                                StaticUtils.DEBUG_LOG.throwing("LDAPSyntaxDescriptionSyntax",
                                        "valueIsAcceptable", e);
                                SCHEMA_LOG.debug("", e);
                                throw e;
                            }
                        }
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxImpl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011 ForgeRock AS
 *      Portions copyright 2011-2013 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
@@ -30,13 +30,13 @@
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 org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.DecodeException;
import com.forgerock.opendj.util.StaticUtils;
import com.forgerock.opendj.util.SubstringReader;
/**
@@ -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);
                StaticUtils.DEBUG_LOG.throwing("MatchingRuleSyntax", "valueIsAcceptable", e);
                SCHEMA_LOG.debug("", e);
                throw e;
            }
@@ -102,7 +102,7 @@
                        ERR_ATTR_SYNTAX_MR_EXPECTED_OPEN_PARENTHESIS.get(definition,
                                (reader.pos() - 1), String.valueOf(c));
                final DecodeException e = DecodeException.error(message);
                StaticUtils.DEBUG_LOG.throwing("MatchingRuleSyntax", "valueIsAcceptable", e);
                SCHEMA_LOG.debug("", 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);
                    StaticUtils.DEBUG_LOG.throwing("MatchingRuleSyntax", "valueIsAcceptable", e);
                    SCHEMA_LOG.debug("", 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);
                StaticUtils.DEBUG_LOG.throwing("MatchingRuleSyntax", "valueIsAcceptable", e);
                SCHEMA_LOG.debug("", e);
                throw e;
            }
            return true;
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxImpl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011 ForgeRock AS
 *      Portions copyright 2011-2013 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
@@ -30,6 +30,7 @@
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;
@@ -38,7 +39,6 @@
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.DecodeException;
import com.forgerock.opendj.util.StaticUtils;
import com.forgerock.opendj.util.SubstringReader;
/**
@@ -93,7 +93,7 @@
                final LocalizableMessage message =
                        ERR_ATTR_SYNTAX_MRUSE_EMPTY_VALUE1.get(definition);
                final DecodeException e = DecodeException.error(message);
                StaticUtils.DEBUG_LOG.throwing("MatchingRuleUseSyntax", "valueIsAcceptable", e);
                SCHEMA_LOG.debug("", e);
                throw e;
            }
@@ -105,7 +105,7 @@
                        ERR_ATTR_SYNTAX_MRUSE_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader
                                .pos() - 1), String.valueOf(c));
                final DecodeException e = DecodeException.error(message);
                StaticUtils.DEBUG_LOG.throwing("MatchingRuleUseSyntax", "valueIsAcceptable", e);
                SCHEMA_LOG.debug("", e);
                throw e;
            }
@@ -158,7 +158,7 @@
                    final LocalizableMessage message =
                            ERR_ATTR_SYNTAX_MRUSE_ILLEGAL_TOKEN1.get(definition, tokenName);
                    final DecodeException e = DecodeException.error(message);
                    StaticUtils.DEBUG_LOG.throwing("MatchingRuleUseSyntax", "valueIsAcceptable", e);
                    SCHEMA_LOG.debug("", e);
                    throw e;
                }
            }
@@ -167,7 +167,7 @@
            if (attributes == null || attributes.size() == 0) {
                final LocalizableMessage message = ERR_ATTR_SYNTAX_MRUSE_NO_ATTR.get(definition);
                final DecodeException e = DecodeException.error(message);
                StaticUtils.DEBUG_LOG.throwing("MatchingRuleUseSyntax", "valueIsAcceptable", e);
                SCHEMA_LOG.debug("", e);
                throw e;
            }
            return true;
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NameFormSyntaxImpl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011 ForgeRock AS
 *      Portions copyright 2011-2013 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
@@ -30,6 +30,7 @@
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;
@@ -38,7 +39,6 @@
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.DecodeException;
import com.forgerock.opendj.util.StaticUtils;
import com.forgerock.opendj.util.SubstringReader;
/**
@@ -79,7 +79,7 @@
                final LocalizableMessage message =
                        ERR_ATTR_SYNTAX_NAME_FORM_EMPTY_VALUE1.get(definition);
                final DecodeException e = DecodeException.error(message);
                StaticUtils.DEBUG_LOG.throwing("NameFormSyntax", "valueIsAcceptable", e);
                SCHEMA_LOG.debug("", e);
                throw e;
            }
@@ -91,7 +91,7 @@
                        ERR_ATTR_SYNTAX_NAME_FORM_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader
                                .pos() - 1), c);
                final DecodeException e = DecodeException.error(message);
                StaticUtils.DEBUG_LOG.throwing("NameFormSyntax", "valueIsAcceptable", e);
                SCHEMA_LOG.debug("", e);
                throw e;
            }
@@ -151,7 +151,7 @@
                    final LocalizableMessage message =
                            ERR_ATTR_SYNTAX_NAME_FORM_ILLEGAL_TOKEN1.get(definition, tokenName);
                    final DecodeException e = DecodeException.error(message);
                    StaticUtils.DEBUG_LOG.throwing("NameFormSyntax", "valueIsAcceptable", e);
                    SCHEMA_LOG.debug("", e);
                    throw e;
                }
            }
@@ -162,7 +162,7 @@
                final LocalizableMessage message =
                        ERR_ATTR_SYNTAX_NAME_FORM_NO_STRUCTURAL_CLASS1.get(definition);
                final DecodeException e = DecodeException.error(message);
                StaticUtils.DEBUG_LOG.throwing("NameFormSyntax", "valueIsAcceptable", e);
                SCHEMA_LOG.debug("", e);
                throw e;
            }
@@ -170,7 +170,7 @@
                final LocalizableMessage message =
                        ERR_ATTR_SYNTAX_NAME_FORM_NO_REQUIRED_ATTR.get(definition);
                final DecodeException e = DecodeException.error(message);
                StaticUtils.DEBUG_LOG.throwing("NameFormSyntax", "valueIsAcceptable", e);
                SCHEMA_LOG.debug("", e);
                throw e;
            }
            return true;
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassSyntaxImpl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011 ForgeRock AS
 *      Portions copyright 2011-2013 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
@@ -33,13 +33,13 @@
import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_OBJECTCLASS_INVALID1;
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.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.DecodeException;
import com.forgerock.opendj.util.StaticUtils;
import com.forgerock.opendj.util.SubstringReader;
/**
@@ -80,7 +80,7 @@
                final LocalizableMessage message =
                        ERR_ATTR_SYNTAX_OBJECTCLASS_EMPTY_VALUE1.get(definition);
                final DecodeException e = DecodeException.error(message);
                StaticUtils.DEBUG_LOG.throwing("ObjectClassSyntax", "valueIsAcceptable", e);
                SCHEMA_LOG.debug("", e);
                throw e;
            }
@@ -92,7 +92,7 @@
                        ERR_ATTR_SYNTAX_OBJECTCLASS_EXPECTED_OPEN_PARENTHESIS1.get(definition,
                                (reader.pos() - 1), String.valueOf(c));
                final DecodeException e = DecodeException.error(message);
                StaticUtils.DEBUG_LOG.throwing("ObjectClassSyntax", "valueIsAcceptable", e);
                SCHEMA_LOG.debug("", e);
                throw e;
            }
@@ -158,7 +158,7 @@
                    final LocalizableMessage message =
                            ERR_ATTR_SYNTAX_OBJECTCLASS_ILLEGAL_TOKEN1.get(definition, tokenName);
                    final DecodeException e = DecodeException.error(message);
                    StaticUtils.DEBUG_LOG.throwing("ObjectClassSyntax", "valueIsAcceptable", e);
                    SCHEMA_LOG.debug("", e);
                    throw e;
                }
            }
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxImpl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS
 *      Portions copyright 2012-2013 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
@@ -148,7 +148,7 @@
            final LocalizableMessage message =
                    ERR_ATTR_SYNTAX_UTC_TIME_CANNOT_PARSE.get(valueString, String.valueOf(e));
            final DecodeException de = DecodeException.error(message, e);
            StaticUtils.DEBUG_LOG.throwing("UTCTimeSyntax", "decodeUTCTimeValue", de);
            StaticUtils.SCHEMA_LOG.debug("", de);
            throw de;
        }
    }
opendj-sdk/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/AbstractLoadBalancingAlgorithmTestCase.java
@@ -43,7 +43,6 @@
import org.testng.annotations.Test;
import com.forgerock.opendj.util.CompletedFutureResult;
import com.forgerock.opendj.util.StaticUtils;
@SuppressWarnings("javadoc")
public class AbstractLoadBalancingAlgorithmTestCase extends SdkTestCase {
@@ -88,7 +87,7 @@
     */
    @BeforeClass()
    public void disableLogging() {
        StaticUtils.DEBUG_LOG.setLevel(Level.SEVERE);
        setDefaultLogLevel(Level.SEVERE);
    }
    /**
@@ -96,7 +95,7 @@
     */
    @AfterClass()
    public void enableLogging() {
        StaticUtils.DEBUG_LOG.setLevel(Level.INFO);
        setDefaultLogLevel(Level.INFO);
    }
    /**
opendj-sdk/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ConnectionFactoryTestCase.java
@@ -71,7 +71,6 @@
import org.testng.annotations.Test;
import com.forgerock.opendj.util.CompletedFutureResult;
import com.forgerock.opendj.util.StaticUtils;
/**
 * Tests the {@code ConnectionFactory} classes.
@@ -120,7 +119,7 @@
     */
    @BeforeClass()
    public void disableLogging() {
        StaticUtils.DEBUG_LOG.setLevel(Level.SEVERE);
        setDefaultLogLevel(Level.SEVERE);
    }
    /**
@@ -128,7 +127,7 @@
     */
    @AfterClass()
    public void enableLogging() {
        StaticUtils.DEBUG_LOG.setLevel(Level.INFO);
        setDefaultLogLevel(Level.INFO);
    }
    @DataProvider
opendj-sdk/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactoryTestCase.java
@@ -62,7 +62,6 @@
import org.testng.annotations.Test;
import com.forgerock.opendj.util.CompletedFutureResult;
import com.forgerock.opendj.util.StaticUtils;
/**
 * Tests the connection pool implementation..
@@ -103,7 +102,7 @@
     */
    @BeforeClass()
    public void disableLogging() {
        StaticUtils.DEBUG_LOG.setLevel(Level.SEVERE);
        setDefaultLogLevel(Level.SEVERE);
    }
    /**
@@ -111,7 +110,7 @@
     */
    @AfterClass()
    public void enableLogging() {
        StaticUtils.DEBUG_LOG.setLevel(Level.INFO);
        setDefaultLogLevel(Level.INFO);
    }
    @AfterMethod(alwaysRun = true)
opendj-sdk/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LDAPListenerTestCase.java
@@ -56,7 +56,6 @@
import org.testng.annotations.Test;
import com.forgerock.opendj.util.AsynchronousFutureResult;
import com.forgerock.opendj.util.StaticUtils;
/**
 * Tests the LDAPListener class.
@@ -220,7 +219,7 @@
     */
    @BeforeClass()
    public void disableLogging() {
        StaticUtils.DEBUG_LOG.setLevel(Level.SEVERE);
        setDefaultLogLevel(Level.SEVERE);
    }
    /**
@@ -228,7 +227,7 @@
     */
    @AfterClass()
    public void enableLogging() {
        StaticUtils.DEBUG_LOG.setLevel(Level.INFO);
        setDefaultLogLevel(Level.INFO);
    }
    /**
opendj-sdk/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/SdkTestCase.java
@@ -28,9 +28,14 @@
import static org.fest.assertions.Fail.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.forgerock.testng.ForgeRockTestCase;
import org.testng.annotations.Test;
import com.forgerock.opendj.util.StaticUtils;
/**
 * An abstract class that all types unit tests should extend. A type represents
 * the classes found directly under the package org.forgerock.opendj.ldap.
@@ -46,4 +51,19 @@
    void failWasExpected(Class<? extends Throwable> exceptionClass) {
        fail("should throw an exception " + exceptionClass.getSimpleName());
    }
    /**
     * Dynamically change log level using java.util.logging framework.
     * <p>
     * slf4j ERROR maps to java.util.logging SEVERE
     * slf4j INFO maps to java.util.logging INFO
     * slf4j DEBUG maps to java.util.logging FINE
     * slf4j TRACE maps to java.util.logging FINEST
     *
     * @param level logging level to use
     */
    void setDefaultLogLevel(Level level) {
        Logger.getLogger(StaticUtils.DEFAULT_LOG.getName()).setLevel(level);
    }
}