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

Jean-Noël Rouvignac
29.51.2015 e4a9125f52a32d8a74c65b61d1454e93e1b16b7d
OPENDJ-1802 Make ByteString methods more intentional

ByteString.java:
Renamed:
- valueOf(byte[]) to valueOfBytes(byte[])
- valueOf(byte[], int, int) to valueOfBytes(byte[], int, int)
- valueOf(char[]) to valueOfUtf8(char[])
- valueOf(CharSequence) to valueOfUtf8(CharSequence)
- valueOf(Object) to valueOfObject(Object)
- valueOf(int) to valueOfInt(int)
- valueOf(long) to valueOfLong(long)
97 files modified
984 ■■■■ changed files
opendj-sdk/opendj-core/clirr-ignored-api-changes.xml 6 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedRequest.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/AVA.java 14 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractAttribute.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/Attribute.java 22 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/Attributes.java 10 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/ByteString.java 32 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/DN.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/Entry.java 10 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/Filter.java 40 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/Functions.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/LinkedAttribute.java 24 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/MemoryBackend.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/RDN.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityResponseControl.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/GenericControl.java 6 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiredResponseControl.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiringResponseControl.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV2RequestControl.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestImpl.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequest.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequestImpl.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequest.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestImpl.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequest.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequest.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestImpl.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/Requests.java 12 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResult.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResultImpl.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponse.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponseImpl.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResultImpl.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/Responses.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResultImpl.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImpl.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordExactEqualityMatchingRuleImpl.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleImpl.java 22 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleImpl.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DoubleMetaphoneApproximateMatchingRuleImpl.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/EnumOrderingMatchingRule.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/EnumSyntaxImpl.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleImpl.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleImpl.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerFirstComponentEqualityMatchingRuleImpl.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/KeywordEqualityMatchingRuleImpl.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierEqualityMatchingRuleImpl.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleImpl.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaConstants.java 7 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaUtils.java 8 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberEqualityMatchingRuleImpl.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSubstringMatchingRuleImpl.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TimeBasedMatchingRulesImpl.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleImpl.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleImpl.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldif/AbstractLDIFReader.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldif/AbstractLDIFWriter.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIF.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/com/forgerock/opendj/util/StringPrepProfileTestCase.java 9 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/io/LDAPReaderWriterTestCase.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/AttributeParserTestCase.java 12 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteStringBuilderTestCase.java 6 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteStringTestCase.java 48 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/EntryTestCase.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/FilterTestCase.java 46 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/LinkedAttributeTestCase.java 305 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/RDNTestCase.java 6 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestTestCase.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestTestCase.java 6 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImplTest.java 16 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxTestCase.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/ApproximateMatchingRuleTest.java 5 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateExactMatchingRuleImplTest.java 13 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxTest.java 6 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationEqualityMatchingRuleTest.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationGreaterThanMatchingRuleTest.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationGreaterThanOrEqualMatchingRuleTest.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationLessThanMatchingRuleTest.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationLessThanOrEqualMatchingRuleTest.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationSubstringMatchingRuleTest.java 8 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleTest.java 6 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/EnumSyntaxTestCase.java 8 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTest.java 9 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/OrderingMatchingRuleTest.java 12 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/PartialDateAndTimeMatchingRuleTestCase.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/RelativeTimeGreaterThanMatchingRuleTest.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/RelativeTimeLessThanMatchingRuleTest.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaBuilderTestCase.java 6 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaUtilsTest.java 10 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SubstringMatchingRuleTest.java 28 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Controls.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPCompare.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModify.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPSearch.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Utils.java 6 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Rest2LDAP.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Utils.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/clirr-ignored-api-changes.xml
@@ -536,4 +536,10 @@
    <method>%regex[(\w|\.)+ get\w*\([^)]*\)]</method>
    <justification>OPENDJ-1802 ByteSequenceReader.get*() => readByte(), readBytes() and read*()</justification>
  </difference>
  <difference>
    <className>org/forgerock/opendj/ldap/ByteString</className>
    <differenceType>7002</differenceType>
    <method>%regex[org\.forgerock\.opendj\.ldap\.ByteString valueOf\([^)]+\)]</method>
    <justification>OPENDJ-1802 ByteString.valueOf() => valueOfInt(), valueOfLong(), valueOfUtf8(), valueOfBytes(), valueOfObject()</justification>
  </difference>
</differences>
opendj-sdk/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedRequest.java
@@ -734,7 +734,7 @@
    }
    private void setBooleanProperty(PasswordPolicyStateOperationType property, final boolean state) {
        operations.add(new MultiValueOperation(property, ByteString.valueOf(String.valueOf(state))));
        operations.add(new MultiValueOperation(property, ByteString.valueOfUtf8(String.valueOf(state))));
    }
    private void setDateProperty(PasswordPolicyStateOperationType property, final Date date) {
@@ -758,7 +758,7 @@
    }
    private ByteString toByteString(final Date date) {
        return ByteString.valueOf(formatAsGeneralizedTime(date));
        return ByteString.valueOfUtf8(formatAsGeneralizedTime(date));
    }
    /** {@inheritDoc} */
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/AVA.java
@@ -383,7 +383,7 @@
                    reader.reset();
                    // Return what we have got here so far.
                    appendHexChars(reader, valueBuffer, hexBuffer);
                    return ByteString.valueOf(valueBuffer);
                    return ByteString.valueOfUtf8(valueBuffer);
                }
                // It is definitely not a delimiter at this point.
                appendHexChars(reader, valueBuffer, hexBuffer);
@@ -393,7 +393,7 @@
        }
        reader.reset();
        return ByteString.valueOf(valueBuffer);
        return ByteString.valueOfUtf8(valueBuffer);
    }
    private static AttributeType readAttributeName(final SubstringReader reader, final Schema schema) {
@@ -567,7 +567,7 @@
                length++;
            }
            reader.reset();
            final ByteString retString = ByteString.valueOf(reader.read(length));
            final ByteString retString = ByteString.valueOfUtf8(reader.read(length));
            reader.read();
            return retString;
        } else {
@@ -605,7 +605,7 @@
     * attribute type and value.
     * <p>
     * If {@code attributeValue} is not an instance of {@code ByteString} then
     * it will be converted using the {@link ByteString#valueOf(Object)} method.
     * it will be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param attributeType
     *            The attribute type.
@@ -619,7 +619,7 @@
        Reject.ifNull(attributeType, attributeValue);
        this.attributeType = attributeType;
        this.attributeValue = ByteString.valueOf(attributeValue);
        this.attributeValue = ByteString.valueOfObject(attributeValue);
    }
    /**
@@ -627,7 +627,7 @@
     * attribute type and value decoded using the default schema.
     * <p>
     * If {@code attributeValue} is not an instance of {@code ByteString} then
     * it will be converted using the {@link ByteString#valueOf(Object)} method.
     * it will be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param attributeType
     *            The attribute type.
@@ -643,7 +643,7 @@
        Reject.ifNull(attributeType, attributeValue);
        this.attributeType = Schema.getDefaultSchema().getAttributeType(attributeType);
        this.attributeValue = ByteString.valueOf(attributeValue);
        this.attributeValue = ByteString.valueOfObject(attributeValue);
    }
    /** {@inheritDoc} */
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractAttribute.java
@@ -156,7 +156,7 @@
        Reject.ifNull(values);
        boolean modified = false;
        for (final Object value : values) {
            modified |= add(ByteString.valueOf(value));
            modified |= add(ByteString.valueOfObject(value));
        }
        return modified;
    }
@@ -286,7 +286,7 @@
        final Map<ByteString, T> valuesToRetain = new HashMap<>(values.size());
        for (final T value : values) {
            valuesToRetain.put(normalizeValue(this, ByteString.valueOf(value)), value);
            valuesToRetain.put(normalizeValue(this, ByteString.valueOfObject(value)), value);
        }
        boolean modified = false;
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/Attribute.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2012-2013 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -41,7 +41,7 @@
 * <p>
 * Any methods which accept {@code Object} based attribute values convert the
 * attribute values to instances of {@code ByteString} using
 * {@link ByteString#valueOf(Object)}.
 * {@link ByteString#valueOfObject(Object)}.
 */
public interface Attribute extends Set<ByteString> {
    // TODO: matching against attribute value assertions.
@@ -67,7 +67,7 @@
     * not already present (optional operation).
     * <p>
     * Any attribute values which are not instances of {@code ByteString} will
     * be converted using the {@link ByteString#valueOf(Object)} method.
     * be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param values
     *            The attribute values to be added to this attribute.
@@ -108,7 +108,7 @@
     * {@code duplicateValues} if specified.
     * <p>
     * Any attribute values which are not instances of {@code ByteString} will
     * be converted using the {@link ByteString#valueOf(Object)} method.
     * be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param <T>
     *            The type of the attribute value objects being added.
@@ -140,7 +140,7 @@
     * Returns {@code true} if this attribute contains {@code value}.
     * <p>
     * If {@code value} is not an instance of {@code ByteString} then it will be
     * converted using the {@link ByteString#valueOf(Object)} method.
     * converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param value
     *            The attribute value whose presence in this attribute is to be
@@ -157,7 +157,7 @@
     * values contained in {@code values}.
     * <p>
     * Any attribute values which are not instances of {@code ByteString} will
     * be converted using the {@link ByteString#valueOf(Object)} method.
     * be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param values
     *            The attribute values whose presence in this attribute is to be
@@ -258,7 +258,7 @@
     * leaves the attribute unchanged and returns {@code false}.
     * <p>
     * If {@code value} is not an instance of {@code ByteString} then it will be
     * converted using the {@link ByteString#valueOf(Object)} method.
     * converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param value
     *            The attribute value to be removed from this attribute.
@@ -276,7 +276,7 @@
     * attribute if they are present (optional operation).
     * <p>
     * Any attribute values which are not instances of {@code ByteString} will
     * be converted using the {@link ByteString#valueOf(Object)} method.
     * be converted using the {@link ByteString#valueOfObject(Object)} method.
     * <p>
     * An invocation of this method is equivalent to:
     *
@@ -302,7 +302,7 @@
     * specified.
     * <p>
     * Any attribute values which are not instances of {@code ByteString} will
     * be converted using the {@link ByteString#valueOf(Object)} method.
     * be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param <T>
     *            The type of the attribute value objects being removed.
@@ -325,7 +325,7 @@
     * in {@code values} (optional operation).
     * <p>
     * Any attribute values which are not instances of {@code ByteString} will
     * be converted using the {@link ByteString#valueOf(Object)} method.
     * be converted using the {@link ByteString#valueOfObject(Object)} method.
     * <p>
     * An invocation of this method is equivalent to:
     *
@@ -350,7 +350,7 @@
     * not already present will be added to {@code missingValues} if specified.
     * <p>
     * Any attribute values which are not instances of {@code ByteString} will
     * be converted using the {@link ByteString#valueOf(Object)} method.
     * be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param <T>
     *            The type of the attribute value objects being retained.
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/Attributes.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS.
 *      Portions copyright 2011-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -249,7 +249,7 @@
        private SingletonAttribute(final AttributeDescription attributeDescription,
                final Object value) {
            this.attributeDescription = attributeDescription;
            this.value = ByteString.valueOf(value);
            this.value = ByteString.valueOfObject(value);
        }
        @Override
@@ -264,7 +264,7 @@
        @Override
        public boolean contains(final Object value) {
            final ByteString normalizedValue = normalizeValue(this, ByteString.valueOf(value));
            final ByteString normalizedValue = normalizeValue(this, ByteString.valueOfObject(value));
            return normalizedSingleValue().equals(normalizedValue);
        }
@@ -535,7 +535,7 @@
     * {@code UnsupportedOperationException}.
     * <p>
     * If {@code value} is not an instance of {@code ByteString} then it will be
     * converted using the {@link ByteString#valueOf(Object)} method.
     * converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param attributeDescription
     *            The attribute description.
@@ -558,7 +558,7 @@
     * {@code UnsupportedOperationException}.
     * <p>
     * If {@code value} is not an instance of {@code ByteString} then it will be
     * converted using the {@link ByteString#valueOf(Object)} method.
     * converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param attributeDescription
     *            The attribute description.
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/ByteString.java
@@ -69,10 +69,10 @@
     * @return The byte string containing the big-endian encoded bytes of the
     *         provided integer.
     */
    public static ByteString valueOf(int i) {
    public static ByteString valueOfInt(int i) {
        final byte[] bytes = new byte[4];
        for (int j = 3; j >= 0; j--) {
            bytes[j] = (byte) (i & 0xFF);
            bytes[j] = (byte) i;
            i >>>= 8;
        }
        return wrap(bytes);
@@ -87,10 +87,10 @@
     * @return The byte string containing the big-endian encoded bytes of the
     *         provided long.
     */
    public static ByteString valueOf(long l) {
    public static ByteString valueOfLong(long l) {
        final byte[] bytes = new byte[8];
        for (int i = 7; i >= 0; i--) {
            bytes[i] = (byte) (l & 0xFF);
            bytes[i] = (byte) l;
            l >>>= 8;
        }
        return wrap(bytes);
@@ -103,11 +103,11 @@
     * <li>if the object is an instance of {@code ByteSequence} then this method
     * is equivalent to calling {@code o.toByteString()}
     * <li>if the object is a {@code byte[]} then this method is equivalent to
     * calling {@link #valueOf(byte[])}
     * calling {@link #valueOfBytes(byte[])}
     * <li>if the object is a {@code char[]} then this method is equivalent to
     * calling {@link #valueOf(char[])}
     * calling {@link #valueOfUtf8(char[])}
     * <li>for all other types of object this method is equivalent to calling
     * {@link #valueOf(String)} with the {@code toString()} representation of
     * {@link #valueOfUtf8(CharSequence)} with the {@code toString()} representation of
     * the provided object.
     * </ul>
     * <b>Note:</b> this method treats {@code Long} and {@code Integer} objects
@@ -122,15 +122,15 @@
     *            The object to use.
     * @return The byte string containing the provided object.
     */
    public static ByteString valueOf(final Object o) {
    public static ByteString valueOfObject(final Object o) {
        if (o instanceof ByteSequence) {
            return ((ByteSequence) o).toByteString();
        } else if (o instanceof byte[]) {
            return valueOf((byte[]) o);
            return valueOfBytes((byte[]) o);
        } else if (o instanceof char[]) {
            return valueOf((char[]) o);
            return valueOfUtf8((char[]) o);
        } else {
            return valueOf(o.toString());
            return valueOfUtf8(o.toString());
        }
    }
@@ -142,7 +142,7 @@
     *            The char sequence to use.
     * @return The byte string with the encoded bytes of the provided string.
     */
    public static ByteString valueOf(final CharSequence s) {
    public static ByteString valueOfUtf8(final CharSequence s) {
        if (s.length() == 0) {
            return EMPTY;
        }
@@ -194,7 +194,7 @@
        for (int i = 0; i < arrayLength; i++) {
            bytes[i] = hexToByte(hexString, hexString.charAt(i * 2), hexString.charAt(i * 2 + 1));
        }
        return valueOf(bytes);
        return valueOfBytes(bytes);
    }
    /**
@@ -207,7 +207,7 @@
     *            The byte array to use.
     * @return A byte string containing a copy of the provided byte array.
     */
    public static ByteString valueOf(final byte[] bytes) {
    public static ByteString valueOfBytes(final byte[] bytes) {
        if (bytes.length == 0) {
            return EMPTY;
        }
@@ -232,7 +232,7 @@
     * @return A byte string containing a copy of the subsequence of the
     *         provided byte array.
     */
    public static ByteString valueOf(final byte[] bytes, final int offset, final int length) {
    public static ByteString valueOfBytes(final byte[] bytes, final int offset, final int length) {
        checkArrayBounds(bytes, offset, length);
        if (offset == length) {
            return EMPTY;
@@ -249,7 +249,7 @@
     * @return A byte string containing the UTF-8 encoded bytes of the provided
     *         char array.
     */
    public static ByteString valueOf(final char[] chars) {
    public static ByteString valueOfUtf8(final char[] chars) {
        if (chars.length == 0) {
            return EMPTY;
        }
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/DN.java
@@ -440,7 +440,7 @@
     * schema.
     * <p>
     * If {@code attributeValue} is not an instance of {@code ByteString} then
     * it will be converted using the {@link ByteString#valueOf(Object)} method.
     * it will be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param attributeType
     *            The attribute type.
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/Entry.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -143,7 +143,7 @@
     * with this entry (usually the default schema).
     * <p>
     * Any attribute values which are not instances of {@code ByteString} will
     * be converted using the {@link ByteString#valueOf(Object)} method.
     * be converted using the {@link ByteString#valueOfObject(Object)} method.
     * <p>
     * <b>NOTE:</b> When {@code attribute} is non-empty, this method implements
     * LDAP Modify add semantics.
@@ -203,7 +203,7 @@
     * with this entry (usually the default schema).
     * <p>
     * Any attribute values which are not instances of {@code ByteString} will
     * be converted using the {@link ByteString#valueOf(Object)} method.
     * be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param attributeDescription
     *            The name of the attribute whose presence in this entry is to
@@ -407,7 +407,7 @@
     * with this entry (usually the default schema).
     * <p>
     * Any attribute values which are not instances of {@code ByteString} will
     * be converted using the {@link ByteString#valueOf(Object)} method.
     * be converted using the {@link ByteString#valueOfObject(Object)} method.
     * <p>
     * <b>NOTE:</b> This method implements LDAP Modify delete semantics.
     *
@@ -462,7 +462,7 @@
     * with this entry (usually the default schema).
     * <p>
     * Any attribute values which are not instances of {@code ByteString} will
     * be converted using the {@link ByteString#valueOf(Object)} method.
     * be converted using the {@link ByteString#valueOfObject(Object)} method.
     * <p>
     * <b>NOTE:</b> This method implements LDAP Modify replace semantics as
     * described in <a href="http://tools.ietf.org/html/rfc4511#section-4.6"
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/Filter.java
@@ -526,7 +526,7 @@
     * attribute description and assertion value.
     * <p>
     * If {@code assertionValue} is not an instance of {@code ByteString} then
     * it will be converted using the {@link ByteString#valueOf(Object)} method.
     * it will be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param attributeDescription
     *            The attribute description.
@@ -537,7 +537,7 @@
    public static Filter approx(final String attributeDescription, final Object assertionValue) {
        Reject.ifNull(attributeDescription, assertionValue);
        return new Filter(new ApproxMatchImpl(attributeDescription, ByteString
                .valueOf(assertionValue)));
                .valueOfObject(assertionValue)));
    }
    /**
@@ -545,7 +545,7 @@
     * description and assertion value.
     * <p>
     * If {@code assertionValue} is not an instance of {@code ByteString} then
     * it will be converted using the {@link ByteString#valueOf(Object)} method.
     * it will be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param attributeDescription
     *            The attribute description.
@@ -556,7 +556,7 @@
    public static Filter equality(final String attributeDescription, final Object assertionValue) {
        Reject.ifNull(attributeDescription, assertionValue);
        return new Filter(new EqualityMatchImpl(attributeDescription, ByteString
                .valueOf(assertionValue)));
                .valueOfObject(assertionValue)));
    }
    /**
@@ -582,7 +582,7 @@
     * </pre>
     *
     * If {@code assertionValue} is not an instance of {@code ByteString} then
     * it will be converted using the {@link ByteString#valueOf(Object)} method.
     * it will be converted using the {@link ByteString#valueOfObject(Object)} method.
     * <p>
     * <b>Note:</b> assertion values do not and should not be escaped before
     * passing them to constructors like {@link #equality(String, Object)}.
@@ -597,7 +597,7 @@
     */
    public static String escapeAssertionValue(final Object assertionValue) {
        Reject.ifNull(assertionValue);
        final ByteString bytes = ByteString.valueOf(assertionValue);
        final ByteString bytes = ByteString.valueOfObject(assertionValue);
        final StringBuilder builder = new StringBuilder(bytes.length());
        valueToFilterString(builder, bytes);
        return builder.toString();
@@ -607,7 +607,7 @@
     * Creates a new {@code extensible match} filter.
     * <p>
     * If {@code assertionValue} is not an instance of {@code ByteString} then
     * it will be converted using the {@link ByteString#valueOf(Object)} method.
     * it will be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param matchingRule
     *            The matching rule name, may be {@code null} if
@@ -627,7 +627,7 @@
                "matchingRule and/or attributeDescription must not be null");
        Reject.ifNull(assertionValue);
        return new Filter(new ExtensibleMatchImpl(matchingRule, attributeDescription, ByteString
                .valueOf(assertionValue), dnAttributes));
                .valueOfObject(assertionValue), dnAttributes));
    }
    /**
@@ -635,7 +635,7 @@
     * attribute description and assertion value.
     * <p>
     * If {@code assertionValue} is not an instance of {@code ByteString} then
     * it will be converted using the {@link ByteString#valueOf(Object)} method.
     * it will be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param attributeDescription
     *            The attribute description.
@@ -647,7 +647,7 @@
            final Object assertionValue) {
        Reject.ifNull(attributeDescription, assertionValue);
        return new Filter(new GreaterOrEqualImpl(attributeDescription, ByteString
                .valueOf(assertionValue)));
                .valueOfObject(assertionValue)));
    }
    /**
@@ -655,7 +655,7 @@
     * description and assertion value.
     * <p>
     * If {@code assertionValue} is not an instance of {@code ByteString} then
     * it will be converted using the {@link ByteString#valueOf(Object)} method.
     * it will be converted using the {@link ByteString#valueOfObject(Object)} method.
     * <p>
     * <b>NOTE:</b> since LDAP does not support {@code greater than}
     * comparisons, this method returns a filter of the form
@@ -680,7 +680,7 @@
     * description and assertion value.
     * <p>
     * If {@code assertionValue} is not an instance of {@code ByteString} then
     * it will be converted using the {@link ByteString#valueOf(Object)} method.
     * it will be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param attributeDescription
     *            The attribute description.
@@ -691,7 +691,7 @@
    public static Filter lessOrEqual(final String attributeDescription, final Object assertionValue) {
        Reject.ifNull(attributeDescription, assertionValue);
        return new Filter(new LessOrEqualImpl(attributeDescription, ByteString
                .valueOf(assertionValue)));
                .valueOfObject(assertionValue)));
    }
    /**
@@ -699,7 +699,7 @@
     * description and assertion value.
     * <p>
     * If {@code assertionValue} is not an instance of {@code ByteString} then
     * it will be converted using the {@link ByteString#valueOf(Object)} method.
     * it will be converted using the {@link ByteString#valueOfObject(Object)} method.
     * <p>
     * <b>NOTE:</b> since LDAP does not support {@code less than} comparisons,
     * this method returns a filter of the form
@@ -823,7 +823,7 @@
     * description, {@code initial}, {@code final}, and {@code any} sub-strings.
     * <p>
     * Any substrings which are not instances of {@code ByteString} will be
     * converted using the {@link ByteString#valueOf(Object)} method.
     * converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param attributeDescription
     *            The attribute description.
@@ -855,20 +855,20 @@
        } else if (anySubstrings.size() == 1) {
            final Object anySubstring = anySubstrings.iterator().next();
            Reject.ifNull(anySubstring);
            anySubstringList = Collections.singletonList(ByteString.valueOf(anySubstring));
            anySubstringList = Collections.singletonList(ByteString.valueOfObject(anySubstring));
        } else {
            anySubstringList = new ArrayList<>(anySubstrings.size());
            for (final Object anySubstring : anySubstrings) {
                Reject.ifNull(anySubstring);
                anySubstringList.add(ByteString.valueOf(anySubstring));
                anySubstringList.add(ByteString.valueOfObject(anySubstring));
            }
            anySubstringList = Collections.unmodifiableList(anySubstringList);
        }
        return new Filter(new SubstringsImpl(attributeDescription,
                initialSubstring != null ? ByteString.valueOf(initialSubstring) : null,
                anySubstringList, finalSubstring != null ? ByteString.valueOf(finalSubstring)
                initialSubstring != null ? ByteString.valueOfObject(initialSubstring) : null,
                anySubstringList, finalSubstring != null ? ByteString.valueOfObject(finalSubstring)
                        : null));
    }
@@ -950,7 +950,7 @@
     * </pre>
     *
     * Any assertion values which are not instances of {@code ByteString} will
     * be converted using the {@link ByteString#valueOf(Object)} method.
     * be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param template
     *            The filter template.
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/Functions.java
@@ -72,7 +72,7 @@
    private static final Function<Object, ByteString, NeverThrowsException> OBJECT_TO_BYTESTRING =
            new Function<Object, ByteString, NeverThrowsException>() {
                public ByteString apply(final Object value) {
                    return ByteString.valueOf(value);
                    return ByteString.valueOfObject(value);
                }
            };
@@ -209,7 +209,7 @@
    /**
     * Returns a function which converts an {@code Object} to a
     * {@code ByteString} using the {@link ByteString#valueOf(Object)} method.
     * {@code ByteString} using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @return A function which converts an {@code Object} to a
     *         {@code ByteString} .
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/LinkedAttribute.java
@@ -65,7 +65,7 @@
            // TODO: could optimize if objects is a LinkedAttribute having the
            // same equality matching rule.
            for (final Object value : values) {
                if (!contains(attribute, ByteString.valueOf(value))) {
                if (!contains(attribute, ByteString.valueOfObject(value))) {
                    return false;
                }
            }
@@ -177,7 +177,7 @@
            final Map<ByteString, T> valuesToRetain = new HashMap<>(values.size());
            for (final T value : values) {
                valuesToRetain.put(normalizeValue(attribute, ByteString.valueOf(value)), value);
                valuesToRetain.put(normalizeValue(attribute, ByteString.valueOfObject(value)), value);
            }
            boolean modified = false;
@@ -331,7 +331,7 @@
            boolean retained = false;
            for (final T value : values) {
                final ByteString normalizedValue =
                        normalizeValue(attribute, ByteString.valueOf(value));
                        normalizeValue(attribute, ByteString.valueOfObject(value));
                if (normalizedSingleValue.equals(normalizedValue)) {
                    if (missingValues == null) {
                        // We can stop now.
@@ -500,7 +500,7 @@
     * single attribute value.
     * <p>
     * If {@code value} is not an instance of {@code ByteString} then it will be
     * converted using the {@link ByteString#valueOf(Object)} method.
     * converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param attributeDescription
     *            The attribute description.
@@ -520,7 +520,7 @@
     * attribute values.
     * <p>
     * Any attribute values which are not instances of {@code ByteString} will
     * be converted using the {@link ByteString#valueOf(Object)} method.
     * be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param attributeDescription
     *            The attribute description.
@@ -541,7 +541,7 @@
     * attribute values.
     * <p>
     * Any attribute values which are not instances of {@code ByteString} will
     * be converted using the {@link ByteString#valueOf(Object)} method.
     * be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param attributeDescription
     *            The attribute description.
@@ -580,7 +580,7 @@
     * default schema.
     * <p>
     * Any attribute values which are not instances of {@code ByteString} will
     * be converted using the {@link ByteString#valueOf(Object)} method.
     * be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param attributeDescription
     *            The attribute description.
@@ -604,7 +604,7 @@
     * the default schema.
     * <p>
     * If {@code value} is not an instance of {@code ByteString} then it will be
     * converted using the {@link ByteString#valueOf(Object)} method.
     * converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param attributeDescription
     *            The attribute description.
@@ -619,7 +619,7 @@
     */
    public LinkedAttribute(final String attributeDescription, final Object value) {
        this(attributeDescription);
        add(ByteString.valueOf(value));
        add(ByteString.valueOfObject(value));
    }
    /**
@@ -628,7 +628,7 @@
     * default schema.
     * <p>
     * Any attribute values which are not instances of {@code ByteString} will
     * be converted using the {@link ByteString#valueOf(Object)} method.
     * be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param attributeDescription
     *            The attribute description.
@@ -663,7 +663,7 @@
    @Override
    public boolean contains(final Object value) {
        Reject.ifNull(value);
        return pimpl.contains(this, ByteString.valueOf(value));
        return pimpl.contains(this, ByteString.valueOfObject(value));
    }
    /** {@inheritDoc} */
@@ -695,7 +695,7 @@
    @Override
    public boolean remove(final Object value) {
        Reject.ifNull(value);
        return pimpl.remove(this, ByteString.valueOf(value));
        return pimpl.remove(this, ByteString.valueOfObject(value));
    }
    /** {@inheritDoc} */
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/MemoryBackend.java
@@ -531,7 +531,7 @@
        }
        final Result result = newResult(ResultCode.SUCCESS);
        if (pageSize > 0) {
            final ByteString cookie = numberOfResults == pageSize ? ByteString.valueOf(String.valueOf(position))
            final ByteString cookie = numberOfResults == pageSize ? ByteString.valueOfUtf8(String.valueOf(position))
                    : ByteString.empty();
            result.addControl(SimplePagedResultsControl.newControl(true, 0, cookie));
        }
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/RDN.java
@@ -191,7 +191,7 @@
     * Creates a new RDN using the provided attribute type and value.
     * <p>
     * If {@code attributeValue} is not an instance of {@code ByteString} then
     * it will be converted using the {@link ByteString#valueOf(Object)} method.
     * it will be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param attributeType
     *            The attribute type.
@@ -210,7 +210,7 @@
     * using the default schema.
     * <p>
     * If {@code attributeValue} is not an instance of {@code ByteString} then
     * it will be converted using the {@link ByteString#valueOf(Object)} method.
     * it will be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param attributeType
     *            The attribute type.
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityResponseControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
@@ -164,7 +164,7 @@
    /** {@inheritDoc} */
    public ByteString getValue() {
        return ByteString.valueOf(authorizationID);
        return ByteString.valueOfUtf8(authorizationID);
    }
    /** {@inheritDoc} */
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/GenericControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
@@ -91,7 +91,7 @@
     * Creates a new control having the provided OID, criticality, and value.
     * <p>
     * If {@code value} is not an instance of {@code ByteString} then it will be
     * converted using the {@link ByteString#valueOf(Object)} method.
     * converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param oid
     *            The numeric OID associated with this control.
@@ -110,7 +110,7 @@
    public static GenericControl newControl(final String oid, final boolean isCritical,
            final Object value) {
        return new GenericControl(oid, isCritical, (value == null) ? null : ByteString
                .valueOf(value));
                .valueOfObject(value));
    }
    private final String oid;
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiredResponseControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 *      Portions Copyright 2014-2015 ForgeRock AS
 */
package org.forgerock.opendj.ldap.controls;
@@ -120,7 +120,7 @@
                }
            };
    private static final ByteString CONTROL_VALUE = ByteString.valueOf("0");
    private static final ByteString CONTROL_VALUE = ByteString.valueOfUtf8("0");
    /**
     * Creates a new Netscape password expired response control.
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiringResponseControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2013-2014 ForgeRock AS
 *      Portions copyright 2013-2015 ForgeRock AS
 */
package org.forgerock.opendj.ldap.controls;
@@ -162,7 +162,7 @@
    /** {@inheritDoc} */
    public ByteString getValue() {
        return ByteString.valueOf(String.valueOf(secondsUntilExpiration));
        return ByteString.valueOfUtf8(String.valueOf(secondsUntilExpiration));
    }
    /** {@inheritDoc} */
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV2RequestControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2014 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
@@ -216,7 +216,7 @@
    /** {@inheritDoc} */
    public ByteString getValue() {
        return ByteString.valueOf(authorizationID);
        return ByteString.valueOfUtf8(authorizationID);
    }
    /** {@inheritDoc} */
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestImpl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.requests;
@@ -40,7 +40,7 @@
        private Client(final AnonymousSASLBindRequestImpl initialBindRequest,
                final String serverName) {
            super(initialBindRequest);
            setNextSASLCredentials(ByteString.valueOf(initialBindRequest.getTraceString()));
            setNextSASLCredentials(ByteString.valueOfUtf8(initialBindRequest.getTraceString()));
        }
    }
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequest.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.requests;
@@ -107,7 +107,7 @@
     * Sets the assertion value to be compared.
     * <p>
     * If the assertion value is not an instance of {@code ByteString} then it
     * will be converted using the {@link ByteString#valueOf(Object)} method.
     * will be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param value
     *            The assertion value to be compared.
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequestImpl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.requests;
@@ -80,7 +80,7 @@
    @Override
    public CompareRequest setAssertionValue(final Object value) {
        Reject.ifNull(value);
        this.assertionValue = ByteString.valueOf(value);
        this.assertionValue = ByteString.valueOfObject(value);
        return this;
    }
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequest.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.requests;
@@ -94,7 +94,7 @@
     * is defined by the specification of this extended request.
     * <p>
     * If {@code value} is not an instance of {@code ByteString} then it will be
     * converted using the {@link ByteString#valueOf(Object)} method.
     * converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param value
     *            TThe value associated with this extended request, or
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestImpl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.requests;
@@ -142,7 +142,7 @@
    @Override
    public GenericExtendedRequest setValue(final Object value) {
        this.requestValue = value != null ? ByteString.valueOf(value) : null;
        this.requestValue = value != null ? ByteString.valueOfObject(value) : null;
        return this;
    }
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequest.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.requests;
@@ -85,7 +85,7 @@
     * with this modify request.
     * <p>
     * If the attribute value is not an instance of {@code ByteString} then it
     * will be converted using the {@link ByteString#valueOf(Object)} method.
     * will be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param type
     *            The type of modification to be performed.
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequest.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.requests;
@@ -206,7 +206,7 @@
     * identity may or may not be a distinguished name.
     * <p>
     * If {@code userIdentity} is not an instance of {@code ByteString} then it
     * will be converted using the {@link ByteString#valueOf(Object)} method.
     * will be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param userIdentity
     *            The identity of the user whose password is to be modified, or
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestImpl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2013 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.requests;
@@ -275,7 +275,7 @@
    @Override
    public PasswordModifyExtendedRequest setUserIdentity(final Object userIdentity) {
        this.userIdentity = (userIdentity != null) ? ByteString.valueOf(userIdentity) : null;
        this.userIdentity = (userIdentity != null) ? ByteString.valueOfObject(userIdentity) : null;
        return this;
    }
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/Requests.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions copyright 2011-2015 ForgeRock AS
 */
package org.forgerock.opendj.ldap.requests;
@@ -513,7 +513,7 @@
     * attribute name, and assertion value.
     * <p>
     * If the assertion value is not an instance of {@code ByteString} then it
     * will be converted using the {@link ByteString#valueOf(Object)} method.
     * will be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param name
     *            The distinguished name of the entry to be compared.
@@ -530,7 +530,7 @@
            final AttributeDescription attributeDescription, final Object assertionValue) {
        Reject.ifNull(name, attributeDescription, assertionValue);
        return new CompareRequestImpl(name, attributeDescription, ByteString
                .valueOf(assertionValue));
                .valueOfObject(assertionValue));
    }
    /**
@@ -538,7 +538,7 @@
     * attribute name, and assertion value decoded using the default schema.
     * <p>
     * If the assertion value is not an instance of {@code ByteString} then it
     * will be converted using the {@link ByteString#valueOf(Object)} method.
     * will be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param name
     *            The distinguished name of the entry to be compared.
@@ -558,7 +558,7 @@
            final String attributeDescription, final Object assertionValue) {
        Reject.ifNull(name, attributeDescription, assertionValue);
        return new CompareRequestImpl(DN.valueOf(name), AttributeDescription
                .valueOf(attributeDescription), ByteString.valueOf(assertionValue));
                .valueOf(attributeDescription), ByteString.valueOfObject(assertionValue));
    }
    /**
@@ -757,7 +757,7 @@
     * optional value.
     * <p>
     * If the request value is not an instance of {@code ByteString} then it
     * will be converted using the {@link ByteString#valueOf(Object)} method.
     * will be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param requestName
     *            The dotted-decimal representation of the unique OID
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResult.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.responses;
@@ -115,7 +115,7 @@
     * is defined by the specification of this extended result.
     * <p>
     * If {@code value} is not an instance of {@code ByteString} then it will be
     * converted using the {@link ByteString#valueOf(Object)} method.
     * converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param value
     *            The value associated with this extended result, or
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResultImpl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.responses;
@@ -72,7 +72,7 @@
    @Override
    public GenericExtendedResult setValue(final Object value) {
        this.responseValue = value != null ? ByteString.valueOf(value) : null;
        this.responseValue = value != null ? ByteString.valueOfObject(value) : null;
        return this;
    }
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponse.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.responses;
@@ -78,7 +78,7 @@
     * format is defined by the specification of this intermediate response.
     * <p>
     * If {@code value} is not an instance of {@code ByteString} then it will be
     * converted using the {@link ByteString#valueOf(Object)} method.
     * converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param value
     *            The value associated with this intermediate response, or
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponseImpl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.responses;
@@ -72,7 +72,7 @@
    @Override
    public GenericIntermediateResponse setValue(final Object value) {
        this.responseValue = value != null ? ByteString.valueOf(value) : null;
        this.responseValue = value != null ? ByteString.valueOfObject(value) : null;
        return this;
    }
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResultImpl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2013 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.responses;
@@ -122,7 +122,7 @@
        builder.append(getReferralURIs());
        if (password != null) {
            builder.append(", genPassword=");
            builder.append(ByteString.valueOf(password));
            builder.append(ByteString.valueOfBytes(password));
        }
        builder.append(", controls=");
        builder.append(getControls());
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/Responses.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.responses;
@@ -240,7 +240,7 @@
     * name and value.
     * <p>
     * If the response value is not an instance of {@code ByteString} then it
     * will be converted using the {@link ByteString#valueOf(Object)} method.
     * will be converted using the {@link ByteString#valueOfObject(Object)} method.
     *
     * @param responseName
     *            The dotted-decimal representation of the unique OID
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResultImpl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.responses;
@@ -66,7 +66,7 @@
    @Override
    public ByteString getValue() {
        return (authorizationID != null) ? ByteString.valueOf(authorizationID) : null;
        return (authorizationID != null) ? ByteString.valueOfUtf8(authorizationID) : null;
    }
    @Override
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImpl.java
@@ -529,7 +529,7 @@
            return valueBuffer.toByteString();
        }
        if (length > 0) {
            return ByteString.valueOf(reader.read(length));
            return ByteString.valueOfUtf8(reader.read(length));
        }
        return ByteString.empty();
    }
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordExactEqualityMatchingRuleImpl.java
@@ -51,6 +51,6 @@
        normalizedValue.append('$');
        normalizedValue.append(authPWComponents[2]);
        return ByteString.valueOf(normalizedValue);
        return ByteString.valueOfUtf8(normalizedValue);
    }
}
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleImpl.java
@@ -31,7 +31,6 @@
import static com.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_BIT_STRING_TOO_SHORT;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
@@ -50,19 +49,15 @@
    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
            throws DecodeException {
        final String valueString = value.toString().toUpperCase();
        final int length = valueString.length();
        if (length < 3) {
            final LocalizableMessage message =
                    WARN_ATTR_SYNTAX_BIT_STRING_TOO_SHORT.get(value.toString());
            throw DecodeException.error(message);
            throw DecodeException.error(WARN_ATTR_SYNTAX_BIT_STRING_TOO_SHORT.get(value));
        }
        if (valueString.charAt(0) != '\'' || valueString.charAt(length - 2) != '\''
                || valueString.charAt(length - 1) != 'B') {
            final LocalizableMessage message =
                    WARN_ATTR_SYNTAX_BIT_STRING_NOT_QUOTED.get(value.toString());
            throw DecodeException.error(message);
        if (valueString.charAt(0) != '\''
                || valueString.charAt(length - 1) != 'B'
                || valueString.charAt(length - 2) != '\'') {
            throw DecodeException.error(WARN_ATTR_SYNTAX_BIT_STRING_NOT_QUOTED.get(value));
        }
        for (int i = 1; i < length - 2; i++) {
@@ -72,13 +67,10 @@
                // These characters are fine.
                break;
            default:
                final LocalizableMessage message =
                        WARN_ATTR_SYNTAX_BIT_STRING_INVALID_BIT.get(value.toString(), String
                                .valueOf(valueString.charAt(i)));
                throw DecodeException.error(message);
                throw DecodeException.error(WARN_ATTR_SYNTAX_BIT_STRING_INVALID_BIT.get(value, valueString.charAt(i)));
            }
        }
        return ByteString.valueOf(valueString);
        return ByteString.valueOfUtf8(valueString);
    }
}
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleImpl.java
@@ -89,7 +89,7 @@
        final String string = SchemaUtils.readQuotedString(reader);
        // Grab the substring between the start pos and the current pos
        return ByteString.valueOf(string);
        return ByteString.valueOfUtf8(string);
    }
    @Override
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DoubleMetaphoneApproximateMatchingRuleImpl.java
@@ -851,7 +851,7 @@
            }
        }
        return ByteString.valueOf(metaphone);
        return ByteString.valueOfUtf8(metaphone);
    }
    /**
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/EnumOrderingMatchingRule.java
@@ -57,7 +57,7 @@
            throw DecodeException.error(WARN_ATTR_SYNTAX_LDAPSYNTAX_ENUM_INVALID_VALUE.get(value
                    .toString(), syntax.getName()));
        }
        return ByteString.valueOf(index);
        return ByteString.valueOfInt(index);
    }
}
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/EnumSyntaxImpl.java
@@ -61,7 +61,7 @@
        final List<String> entryStrings = new ArrayList<>(entries.size());
        for (final String entry : entries) {
            final String normalized = normalize(ByteString.valueOf(entry));
            final String normalized = normalize(ByteString.valueOfUtf8(entry));
            if (!entryStrings.contains(normalized)) {
                entryStrings.add(normalized);
            }
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleImpl.java
@@ -47,7 +47,7 @@
    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
            throws DecodeException {
        try {
            return ByteString.valueOf(GeneralizedTime.valueOf(value.toString()).getTimeInMillis());
            return ByteString.valueOfLong(GeneralizedTime.valueOf(value.toString()).getTimeInMillis());
        } catch (LocalizedIllegalArgumentException e) {
            throw DecodeException.error(e.getMessageObject());
        }
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleImpl.java
@@ -48,7 +48,7 @@
    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
            throws DecodeException {
        try {
            return ByteString.valueOf(GeneralizedTime.valueOf(value.toString()).getTimeInMillis());
            return ByteString.valueOfLong(GeneralizedTime.valueOf(value.toString()).getTimeInMillis());
        } catch (LocalizedIllegalArgumentException e) {
            throw DecodeException.error(e.getMessageObject());
        }
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerFirstComponentEqualityMatchingRuleImpl.java
@@ -60,7 +60,7 @@
            final String definition = assertionValue.toString();
            final SubstringReader reader = new SubstringReader(definition);
            final int intValue = SchemaUtils.readRuleID(reader);
            return defaultAssertion(ByteString.valueOf(intValue));
            return defaultAssertion(ByteString.valueOfInt(intValue));
        } catch (final Exception e) {
            logger.debug(LocalizableMessage.raw("%s", e));
@@ -98,6 +98,6 @@
        reader.skipWhitespaces();
        // The next set of characters must be the OID.
        return ByteString.valueOf(SchemaUtils.readRuleID(reader));
        return ByteString.valueOfObject(SchemaUtils.readRuleID(reader));
    }
}
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/KeywordEqualityMatchingRuleImpl.java
@@ -134,7 +134,7 @@
    }
    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
        return ByteString.valueOf(normalize(value));
        return ByteString.valueOfUtf8(normalize(value));
    }
    private String normalize(final ByteSequence value) {
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierEqualityMatchingRuleImpl.java
@@ -76,7 +76,7 @@
        final String definition = value.toString();
        final SubstringReader reader = new SubstringReader(definition);
        final String oid = readOID(reader, schema.getOption(ALLOW_MALFORMED_NAMES_AND_OPTIONS));
        return ByteString.valueOf(resolveNames(schema, oid));
        return ByteString.valueOfUtf8(resolveNames(schema, oid));
    }
    @Override
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleImpl.java
@@ -87,6 +87,6 @@
        // The next set of characters must be the OID.
        final String oid = readOID(reader, schema.getOption(ALLOW_MALFORMED_NAMES_AND_OPTIONS));
        return ByteString.valueOf(resolveNames(schema, oid));
        return ByteString.valueOfUtf8(resolveNames(schema, oid));
    }
}
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaConstants.java
@@ -23,6 +23,7 @@
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2014 Manuel Gaupp
 *      Portions Copyright 2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.schema;
@@ -1478,17 +1479,17 @@
    /**
     * The value representing just one space character.
     */
    public static final ByteString SINGLE_SPACE_VALUE = ByteString.valueOf(" ");
    public static final ByteString SINGLE_SPACE_VALUE = ByteString.valueOfUtf8(" ");
    /**
     * The normalized true value.
     */
    public static final ByteString TRUE_VALUE = ByteString.valueOf("TRUE");
    public static final ByteString TRUE_VALUE = ByteString.valueOfUtf8("TRUE");
    /**
     * The normalized false value.
     */
    public static final ByteString FALSE_VALUE = ByteString.valueOf("FALSE");
    public static final ByteString FALSE_VALUE = ByteString.valueOfUtf8("FALSE");
    /**
     * The name of the time zone for universal coordinated time (UTC).
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaUtils.java
@@ -702,7 +702,7 @@
            return singleSpaceOrEmpty(value);
        }
        trimUnnecessarySpacesInStringList(buffer);
        return ByteString.valueOf(buffer);
        return ByteString.valueOfUtf8(buffer);
    }
    private static void trimUnnecessarySpacesInStringList(StringBuilder buffer) {
@@ -729,7 +729,7 @@
        if (buffer.length() == 0) {
            return singleSpaceOrEmpty(value);
        }
        return ByteString.valueOf(buffer);
        return ByteString.valueOfUtf8(buffer);
    }
    static ByteString normalizeIA5StringAttributeValue(final ByteSequence value, boolean trim, boolean foldCase)
@@ -741,7 +741,7 @@
            return singleSpaceOrEmpty(value);
        }
        throwIfIA5IllegalCharacter(buffer, value);
        return ByteString.valueOf(buffer);
        return ByteString.valueOfUtf8(buffer);
    }
    static void throwDecodeException(LocalizedLogger logger, LocalizableMessage message) throws DecodeException {
@@ -780,7 +780,7 @@
        if (buffer.length() == 0) {
            return ByteString.empty();
        }
        return ByteString.valueOf(buffer);
        return ByteString.valueOfUtf8(buffer);
    }
}
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberEqualityMatchingRuleImpl.java
@@ -59,7 +59,7 @@
            }
        }
        return ByteString.valueOf(buffer);
        return ByteString.valueOfUtf8(buffer);
    }
    @Override
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSubstringMatchingRuleImpl.java
@@ -59,6 +59,6 @@
            }
        }
        return ByteString.valueOf(buffer);
        return ByteString.valueOfUtf8(buffer);
    }
}
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TimeBasedMatchingRulesImpl.java
@@ -106,7 +106,7 @@
        @Override
        public final ByteString normalizeAttributeValue(Schema schema, ByteSequence value) throws DecodeException {
            try {
                return ByteString.valueOf(GeneralizedTime.valueOf(value.toString()).getTimeInMillis());
                return ByteString.valueOfLong(GeneralizedTime.valueOf(value.toString()).getTimeInMillis());
            } catch (final LocalizedIllegalArgumentException e) {
                throw error(e.getMessageObject());
            }
@@ -216,7 +216,7 @@
            long delta = (second + minute * 60 + hour * 3600 + day * 24 * 3600 + week * 7 * 24 * 3600) * 1000;
            long now = timeService.now();
            return ByteString.valueOf(signed ? now - delta : now + delta);
            return ByteString.valueOfLong(signed ? now - delta : now + delta);
        }
    }
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleImpl.java
@@ -168,6 +168,6 @@
        final long uuidLow64 = uuid128Bytes.readLong();
        final long uuid64 = uuidHigh64 ^ uuidLow64;
        final int hash32 = ((int) (uuid64 >> 32)) ^ (int) uuid64;
        return ByteString.valueOf(hash32);
        return ByteString.valueOfInt(hash32);
    }
}
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleImpl.java
@@ -64,7 +64,7 @@
            final ByteSequence seq2 = value.subSequence(closingBracePos + 1, value.length());
            StaticUtils.toLowerCase(seq1, builder);
            builder.append(seq2);
            return ByteString.valueOf(builder);
            return ByteString.valueOfUtf8(builder);
        } else {
            return value.toByteString();
        }
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldif/AbstractLDIFReader.java
@@ -329,7 +329,7 @@
                    pos++;
                }
                value = ByteString.valueOf(ldifLine.substring(pos));
                value = ByteString.valueOfUtf8(ldifLine.substring(pos));
            }
        }
        return value;
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldif/AbstractLDIFWriter.java
@@ -300,7 +300,7 @@
    final void writeKeyAndValue(final CharSequence key, final CharSequence value)
            throws IOException {
        writeKeyAndValue(key, ByteString.valueOf(value));
        writeKeyAndValue(key, ByteString.valueOfUtf8(value));
    }
    final void writeLine(final CharSequence line) throws IOException {
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIF.java
@@ -98,8 +98,8 @@
     */
    private static final Comparator<byte[]> DN_ORDER = new Comparator<byte[]>() {
        public int compare(byte[] b1, byte[] b2) {
            final ByteString bs = ByteString.valueOf(b1);
            final ByteString bs2 = ByteString.valueOf(b2);
            final ByteString bs = ByteString.valueOfBytes(b1);
            final ByteString bs2 = ByteString.valueOfBytes(b2);
            return bs.compareTo(bs2);
        }
    };
opendj-sdk/opendj-core/src/test/java/com/forgerock/opendj/util/StringPrepProfileTestCase.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions Copyright 2015 ForgeRock AS.
 */
package com.forgerock.opendj.util;
@@ -51,9 +52,9 @@
            final ConditionResult result) throws Exception {
        // Take any caseExact matching rule.
        final MatchingRule rule = Schema.getCoreSchema().getMatchingRule("2.5.13.5");
        final Assertion assertion = rule.getAssertion(ByteString.valueOf(value1));
        final Assertion assertion = rule.getAssertion(ByteString.valueOfUtf8(value1));
        final ByteString normalizedValue2 =
                rule.normalizeAttributeValue(ByteString.valueOf(value2));
                rule.normalizeAttributeValue(ByteString.valueOfUtf8(value2));
        final ConditionResult liveResult = assertion.matches(normalizedValue2);
        assertEquals(result, liveResult);
    }
@@ -67,9 +68,9 @@
            final ConditionResult result) throws Exception {
        // Take any caseExact matching rule.
        final MatchingRule rule = Schema.getCoreSchema().getMatchingRule("2.5.13.2");
        final Assertion assertion = rule.getAssertion(ByteString.valueOf(value1));
        final Assertion assertion = rule.getAssertion(ByteString.valueOfUtf8(value1));
        final ByteString normalizedValue2 =
                rule.normalizeAttributeValue(ByteString.valueOf(value2));
                rule.normalizeAttributeValue(ByteString.valueOfUtf8(value2));
        final ConditionResult liveResult = assertion.matches(normalizedValue2);
        assertEquals(result, liveResult);
    }
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/io/LDAPReaderWriterTestCase.java
@@ -305,7 +305,7 @@
            public void intermediateResponse(int messageID, IntermediateResponse response)
                    throws DecodeException, IOException {
                assertThat(response.getOID()).isEqualTo(oid);
                assertThat(response.getValue()).isEqualTo(ByteString.valueOf(responseValue));
                assertThat(response.getValue()).isEqualTo(ByteString.valueOfUtf8(responseValue));
            }
        } };
    }
@@ -464,7 +464,7 @@
    Object[] unrecognizedMessage() {
        final byte messageTag = 0x01;
        final ByteString messageBytes = ByteString.valueOf("message");
        final ByteString messageBytes = ByteString.valueOfUtf8("message");
        return new Object[] { new LDAPWrite() {
            @Override
            public void perform(LDAPWriter<? extends ASN1Writer> writer) throws IOException {
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/AttributeParserTestCase.java
@@ -21,7 +21,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2012 ForgeRock AS.
 *      Copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -278,14 +278,14 @@
    @Test
    public void testAsByteString() {
        Entry e = new LinkedHashMapEntry("dn: cn=test", "objectClass: test", "type: cn");
        assertThat(e.parseAttribute("type").asByteString()).isEqualTo(ByteString.valueOf("cn"));
        assertThat(e.parseAttribute("type").asByteString()).isEqualTo(ByteString.valueOfUtf8("cn"));
    }
    @Test
    public void testAsByteStringDefault() {
        Entry e = new LinkedHashMapEntry("dn: cn=test", "objectClass: test", "type: cn");
        assertThat(e.parseAttribute("type").asByteString(ByteString.valueOf("sn"))).isEqualTo(
                ByteString.valueOf("cn"));
        assertThat(e.parseAttribute("type").asByteString(ByteString.valueOfUtf8("sn"))).isEqualTo(
                ByteString.valueOfUtf8("cn"));
    }
    @Test
@@ -297,8 +297,8 @@
    @Test
    public void testAsByteStringMissingDefault() {
        Entry e = new LinkedHashMapEntry("dn: cn=test", "objectClass: test");
        assertThat(e.parseAttribute("type").asByteString(ByteString.valueOf("sn"))).isEqualTo(
                ByteString.valueOf("sn"));
        assertThat(e.parseAttribute("type").asByteString(ByteString.valueOfUtf8("sn"))).isEqualTo(
                ByteString.valueOfUtf8("sn"));
    }
    @Test(expectedExceptions = { NoSuchElementException.class })
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteStringBuilderTestCase.java
@@ -414,7 +414,7 @@
    @Test
    public void testByteStringBuilderCompareTo() {
        final ByteString orig = ByteString.valueOf("this is a ByteString");
        final ByteString orig = ByteString.valueOfUtf8("this is a ByteString");
        final ByteStringBuilder builder = new ByteStringBuilder(orig);
        Assert.assertEquals(builder.compareTo(builder), 0);
        Assert.assertEquals(builder.compareTo(orig), 0);
@@ -423,7 +423,7 @@
    @Test
    public void testSubSequenceCompareTo() {
        final ByteString orig = ByteString.valueOf("this is a ByteString");
        final ByteString orig = ByteString.valueOfUtf8("this is a ByteString");
        final ByteStringBuilder builder = new ByteStringBuilder(orig);
        final ByteSequence subSequence = builder.subSequence(0, 4);
        Assert.assertEquals(subSequence.compareTo(subSequence), 0);
@@ -433,7 +433,7 @@
    @Test
    public void testSubSequenceEqualsAndHashCode() {
        final ByteString orig = ByteString.valueOf("this is a ByteString");
        final ByteString orig = ByteString.valueOfUtf8("this is a ByteString");
        final ByteStringBuilder builder = new ByteStringBuilder(orig);
        final ByteSequence subSequence = builder.subSequence(0, builder.length());
        final ByteSequence subSequence2 = builder.subSequence(0, builder.length());
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteStringTestCase.java
@@ -62,29 +62,29 @@
            { ByteString.valueOfBase64("AAA="), new byte[] { 0x00, 0x00 }},
            { ByteString.valueOfBase64("AAAA"), new byte[] { 0x00, 0x00, 0x00 }},
            { ByteString.valueOfBase64("AAAAAA=="), new byte[] { 0x00, 0x00, 0x00, 0x00 }},
            { ByteString.valueOf(1),
            { ByteString.valueOfInt(1),
                new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01 } },
            { ByteString.valueOf(Integer.MAX_VALUE),
            { ByteString.valueOfInt(Integer.MAX_VALUE),
                new byte[] { (byte) 0x7F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF } },
            { ByteString.valueOf(Integer.MIN_VALUE),
            { ByteString.valueOfInt(Integer.MIN_VALUE),
                new byte[] { (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00 } },
            {
                ByteString.valueOf(Long.MAX_VALUE),
                ByteString.valueOfLong(Long.MAX_VALUE),
                new byte[] { (byte) 0x7F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
                    (byte) 0xFF, (byte) 0xFF, (byte) 0xFF } },
            {
                ByteString.valueOf(Long.MIN_VALUE),
                ByteString.valueOfLong(Long.MIN_VALUE),
                new byte[] { (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
                    (byte) 0x00, (byte) 0x00, (byte) 0x00 } },
            { ByteString.valueOf("cn=testvalue"), "cn=testvalue".getBytes("UTF-8") },
            { ByteString.valueOf((Object) "cn=testvalue"), "cn=testvalue".getBytes("UTF-8") },
            { ByteString.valueOf("cn=testvalue".toCharArray()), "cn=testvalue".getBytes("UTF-8") },
            { ByteString.valueOf((Object) "cn=testvalue".toCharArray()),
            { ByteString.valueOfUtf8("cn=testvalue"), "cn=testvalue".getBytes("UTF-8") },
            { ByteString.valueOfObject((Object) "cn=testvalue"), "cn=testvalue".getBytes("UTF-8") },
            { ByteString.valueOfUtf8("cn=testvalue".toCharArray()), "cn=testvalue".getBytes("UTF-8") },
            { ByteString.valueOfObject((Object) "cn=testvalue".toCharArray()),
                "cn=testvalue".getBytes("UTF-8") },
            { ByteString.valueOf(new byte[0]), new byte[0] },
            { ByteString.valueOf(testBytes), testBytes },
            { ByteString.valueOf((Object) testBytes), testBytes },
            { ByteString.valueOf(ByteString.valueOf("cn=testvalue")),
            { ByteString.valueOfBytes(new byte[0]), new byte[0] },
            { ByteString.valueOfBytes(testBytes), testBytes },
            { ByteString.valueOfObject((Object) testBytes), testBytes },
            { ByteString.valueOfObject(ByteString.valueOfUtf8("cn=testvalue")),
                "cn=testvalue".getBytes("UTF-8") },
            { ByteString.wrap(new byte[0]), new byte[0] },
            {
@@ -117,16 +117,16 @@
    @DataProvider(name = "byteStringIntegerProvider")
    public Object[][] byteStringIntegerProvider() {
        return new Object[][] { { ByteString.valueOf(0), 0 }, { ByteString.valueOf(1), 1 },
            { ByteString.valueOf(Integer.MAX_VALUE), Integer.MAX_VALUE },
            { ByteString.valueOf(Integer.MIN_VALUE), Integer.MIN_VALUE }, };
        return new Object[][] { { ByteString.valueOfInt(0), 0 }, { ByteString.valueOfInt(1), 1 },
            { ByteString.valueOfInt(Integer.MAX_VALUE), Integer.MAX_VALUE },
            { ByteString.valueOfInt(Integer.MIN_VALUE), Integer.MIN_VALUE }, };
    }
    @DataProvider(name = "byteStringLongProvider")
    public Object[][] byteStringLongProvider() {
        return new Object[][] { { ByteString.valueOf(0L), 0L }, { ByteString.valueOf(1L), 1L },
            { ByteString.valueOf(Long.MAX_VALUE), Long.MAX_VALUE },
            { ByteString.valueOf(Long.MIN_VALUE), Long.MIN_VALUE } };
        return new Object[][] { { ByteString.valueOfLong(0L), 0L }, { ByteString.valueOfLong(1L), 1L },
            { ByteString.valueOfLong(Long.MAX_VALUE), Long.MAX_VALUE },
            { ByteString.valueOfLong(Long.MIN_VALUE), Long.MIN_VALUE } };
    }
    @DataProvider(name = "byteStringCharArrayProvider")
@@ -151,20 +151,20 @@
    @Test(dataProvider = "byteStringCharArrayProvider")
    public void testFromStringToCharArray(final String s) {
        ByteString bs = ByteString.valueOf(s);
        ByteString bs = ByteString.valueOfUtf8(s);
        Assert.assertTrue(Arrays.equals(bs.toCharArray(), s.toCharArray()));
    }
    @Test(dataProvider = "byteStringCharArrayProvider")
    public void testFromCharArrayToCharArray(final String s) {
        final char[] chars = s.toCharArray();
        ByteString bs = ByteString.valueOf(chars);
        ByteString bs = ByteString.valueOfUtf8(chars);
        Assert.assertTrue(Arrays.equals(bs.toCharArray(), chars));
    }
    @Test(dataProvider = "byteStringCharArrayProvider")
    public void testValueOfCharArray(final String s) {
        ByteString bs = ByteString.valueOf(s.toCharArray());
        ByteString bs = ByteString.valueOfUtf8(s.toCharArray());
        Assert.assertEquals(bs.toString(), s);
    }
@@ -245,8 +245,8 @@
        }
        result[len++] = new Object[] { ByteString.empty(), new byte[0], 0 };
        result[len++] = new Object[] { ByteString.empty(), "bla".getBytes("UTF8"), -3 };
        result[len++] = new Object[] { ByteString.valueOf("bla"), new byte[0], 3 };
        result[len++] = new Object[] { ByteString.valueOf("bla"), "bla".getBytes("UTF8"), 0 };
        result[len++] = new Object[] { ByteString.valueOfUtf8("bla"), new byte[0], 3 };
        result[len++] = new Object[] { ByteString.valueOfUtf8("bla"), "bla".getBytes("UTF8"), 0 };
        return result;
    }
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/EntryTestCase.java
@@ -133,7 +133,7 @@
                .isFalse();
        assertThat(entry.getAttribute(AD_CN)).hasSize(1);
        assertThat(duplicateValues).hasSize(1);
        assertThat(duplicateValues).contains(ByteString.valueOf("test"));
        assertThat(duplicateValues).contains(ByteString.valueOfUtf8("test"));
    }
    @Test(dataProvider = "EntryFactory")
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/FilterTestCase.java
@@ -57,52 +57,52 @@
    @DataProvider(name = "filterstrings")
    public Object[][] getFilterStrings() throws Exception {
        final Filter equal =
                Filter.equality("objectClass", ByteString.valueOf("\\test*(Value)"));
        final Filter equal2 = Filter.equality("objectClass", ByteString.valueOf(""));
                Filter.equality("objectClass", ByteString.valueOfUtf8("\\test*(Value)"));
        final Filter equal2 = Filter.equality("objectClass", ByteString.valueOfUtf8(""));
        final Filter approx =
                Filter.approx("sn", ByteString.valueOf("\\test*(Value)"));
                Filter.approx("sn", ByteString.valueOfUtf8("\\test*(Value)"));
        final Filter greater =
                Filter.greaterOrEqual("employeeNumber", ByteString
                        .valueOf("\\test*(Value)"));
                        .valueOfUtf8("\\test*(Value)"));
        final Filter less =
                Filter.lessOrEqual("dob", ByteString.valueOf("\\test*(Value)"));
                Filter.lessOrEqual("dob", ByteString.valueOfUtf8("\\test*(Value)"));
        final Filter presense = Filter.present("login");
        final ArrayList<ByteString> any = new ArrayList<>(0);
        final ArrayList<ByteString> multiAny = new ArrayList<>(1);
        multiAny.add(ByteString.valueOf("\\wid*(get)"));
        multiAny.add(ByteString.valueOf("*"));
        multiAny.add(ByteString.valueOfUtf8("\\wid*(get)"));
        multiAny.add(ByteString.valueOfUtf8("*"));
        final Filter substring1 =
                Filter.substrings("givenName", ByteString.valueOf("\\Jo*()"), any,
                        ByteString.valueOf("\\n*()"));
                Filter.substrings("givenName", ByteString.valueOfUtf8("\\Jo*()"), any,
                        ByteString.valueOfUtf8("\\n*()"));
        final Filter substring2 =
                Filter.substrings("givenName", ByteString.valueOf("\\Jo*()"), multiAny,
                        ByteString.valueOf("\\n*()"));
                Filter.substrings("givenName", ByteString.valueOfUtf8("\\Jo*()"), multiAny,
                        ByteString.valueOfUtf8("\\n*()"));
        final Filter substring3 =
                Filter.substrings("givenName", ByteString.valueOf(""), any, ByteString
                        .valueOf("\\n*()"));
                Filter.substrings("givenName", ByteString.valueOfUtf8(""), any, ByteString
                        .valueOfUtf8("\\n*()"));
        final Filter substring4 =
                Filter.substrings("givenName", ByteString.valueOf("\\Jo*()"), any,
                        ByteString.valueOf(""));
                Filter.substrings("givenName", ByteString.valueOfUtf8("\\Jo*()"), any,
                        ByteString.valueOfUtf8(""));
        final Filter substring5 =
                Filter.substrings("givenName", ByteString.valueOf(""), multiAny,
                        ByteString.valueOf(""));
                Filter.substrings("givenName", ByteString.valueOfUtf8(""), multiAny,
                        ByteString.valueOfUtf8(""));
        final Filter extensible1 =
                Filter.extensible("2.4.6.8.19", "cn", ByteString
                        .valueOf("\\John* (Doe)"), false);
                        .valueOfUtf8("\\John* (Doe)"), false);
        final Filter extensible2 =
                Filter.extensible("2.4.6.8.19", "cn", ByteString
                        .valueOf("\\John* (Doe)"), true);
                        .valueOfUtf8("\\John* (Doe)"), true);
        final Filter extensible3 =
                Filter.extensible("2.4.6.8.19", null, ByteString
                        .valueOf("\\John* (Doe)"), true);
                        .valueOfUtf8("\\John* (Doe)"), true);
        final Filter extensible4 =
                Filter.extensible(null, "cn", ByteString.valueOf("\\John* (Doe)"),
                Filter.extensible(null, "cn", ByteString.valueOfUtf8("\\John* (Doe)"),
                        true);
        final Filter extensible5 =
                Filter.extensible("2.4.6.8.19", null, ByteString
                        .valueOf("\\John* (Doe)"), false);
                        .valueOfUtf8("\\John* (Doe)"), false);
        final ArrayList<Filter> list1 = new ArrayList<>();
        list1.add(equal);
@@ -259,7 +259,7 @@
    @Test
    public void testMatcher() throws Exception {
        final Filter equal =
                Filter.equality("cn", ByteString.valueOf("\\test*(Value)"));
                Filter.equality("cn", ByteString.valueOfUtf8("\\test*(Value)"));
        final LinkedHashMapEntry entry =
                new LinkedHashMapEntry(DN.valueOf("cn=\\test*(Value),dc=org"));
        entry.addAttribute("cn", "\\test*(Value)");
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/LinkedAttributeTestCase.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -50,11 +51,11 @@
        attribute.add(1);
        attribute.add("a value");
        attribute.add(ByteString.valueOf("another value"));
        attribute.add(ByteString.valueOfUtf8("another value"));
        Assert.assertTrue(attribute.contains(1));
        Assert.assertTrue(attribute.contains("a value"));
        Assert.assertTrue(attribute.contains(ByteString.valueOf("another value")));
        Assert.assertTrue(attribute.contains(ByteString.valueOfUtf8("another value")));
        Assert.assertEquals(attribute.size(), 3);
        Assert.assertTrue(attribute.remove(1));
@@ -63,24 +64,24 @@
        Assert.assertEquals(attribute.size(), 2);
        Assert.assertTrue(attribute.remove("a value"));
        Assert.assertEquals(attribute.size(), 1);
        Assert.assertTrue(attribute.remove(ByteString.valueOf("another value")));
        Assert.assertTrue(attribute.remove(ByteString.valueOfUtf8("another value")));
        Assert.assertEquals(attribute.size(), 0);
    }
    @Test
    public void testAdd() {
        Attribute a = new LinkedAttribute("test");
        Assert.assertTrue(a.add(ByteString.valueOf("value1")));
        Assert.assertFalse(a.add(ByteString.valueOf("value1")));
        Assert.assertTrue(a.add(ByteString.valueOf("value2")));
        Assert.assertFalse(a.add(ByteString.valueOf("value2")));
        Assert.assertTrue(a.add(ByteString.valueOf("value3")));
        Assert.assertFalse(a.add(ByteString.valueOf("value3")));
        Assert.assertTrue(a.add(ByteString.valueOfUtf8("value1")));
        Assert.assertFalse(a.add(ByteString.valueOfUtf8("value1")));
        Assert.assertTrue(a.add(ByteString.valueOfUtf8("value2")));
        Assert.assertFalse(a.add(ByteString.valueOfUtf8("value2")));
        Assert.assertTrue(a.add(ByteString.valueOfUtf8("value3")));
        Assert.assertFalse(a.add(ByteString.valueOfUtf8("value3")));
        Assert.assertEquals(a.size(), 3);
        Iterator<ByteString> i = a.iterator();
        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
        Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value2"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value3"));
        Assert.assertFalse(i.hasNext());
    }
@@ -93,66 +94,66 @@
        Assert.assertFalse(i.hasNext());
        a = new LinkedAttribute("test");
        Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOf("value1")), null));
        Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOfUtf8("value1")), null));
        i = a.iterator();
        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value1"));
        Assert.assertFalse(i.hasNext());
        a = new LinkedAttribute("test");
        Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
                .valueOf("value2")), null));
        Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOfUtf8("value1"), ByteString
                .valueOfUtf8("value2")), null));
        i = a.iterator();
        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value2"));
        Assert.assertFalse(i.hasNext());
        // addAll to a single-valued attribute.
        a = new LinkedAttribute("test", ByteString.valueOf("value1"));
        a = new LinkedAttribute("test", ByteString.valueOfUtf8("value1"));
        Assert.assertFalse(a.addAll(Collections.<ByteString> emptyList(), null));
        i = a.iterator();
        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value1"));
        Assert.assertFalse(i.hasNext());
        a = new LinkedAttribute("test", ByteString.valueOf("value1"));
        Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOf("value2")), null));
        a = new LinkedAttribute("test", ByteString.valueOfUtf8("value1"));
        Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOfUtf8("value2")), null));
        i = a.iterator();
        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value2"));
        Assert.assertFalse(i.hasNext());
        a = new LinkedAttribute("test", ByteString.valueOf("value1"));
        Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOf("value2"), ByteString
                .valueOf("value3")), null));
        a = new LinkedAttribute("test", ByteString.valueOfUtf8("value1"));
        Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOfUtf8("value2"), ByteString
                .valueOfUtf8("value3")), null));
        i = a.iterator();
        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
        Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value2"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value3"));
        Assert.assertFalse(i.hasNext());
        // addAll to a multi-valued attribute.
        a = new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString.valueOf("value2"));
        a = new LinkedAttribute("test", ByteString.valueOfUtf8("value1"), ByteString.valueOfUtf8("value2"));
        Assert.assertFalse(a.addAll(Collections.<ByteString> emptyList(), null));
        i = a.iterator();
        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value2"));
        Assert.assertFalse(i.hasNext());
        a = new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString.valueOf("value2"));
        Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOf("value3")), null));
        a = new LinkedAttribute("test", ByteString.valueOfUtf8("value1"), ByteString.valueOfUtf8("value2"));
        Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOfUtf8("value3")), null));
        i = a.iterator();
        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
        Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value2"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value3"));
        Assert.assertFalse(i.hasNext());
        a = new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString.valueOf("value2"));
        Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOf("value3"), ByteString
                .valueOf("value4")), null));
        a = new LinkedAttribute("test", ByteString.valueOfUtf8("value1"), ByteString.valueOfUtf8("value2"));
        Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOfUtf8("value3"), ByteString
                .valueOfUtf8("value4")), null));
        i = a.iterator();
        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
        Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
        Assert.assertEquals(i.next(), ByteString.valueOf("value4"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value2"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value3"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value4"));
        Assert.assertFalse(i.hasNext());
    }
@@ -165,24 +166,24 @@
        Assert.assertTrue(a.isEmpty());
        Assert.assertEquals(a.size(), 0);
        a.add(ByteString.valueOf("value1"));
        a.add(ByteString.valueOfUtf8("value1"));
        Assert.assertFalse(a.isEmpty());
        Assert.assertEquals(a.size(), 1);
        a.clear();
        Assert.assertTrue(a.isEmpty());
        Assert.assertEquals(a.size(), 0);
        a.add(ByteString.valueOf("value1"));
        a.add(ByteString.valueOf("value2"));
        a.add(ByteString.valueOfUtf8("value1"));
        a.add(ByteString.valueOfUtf8("value2"));
        Assert.assertFalse(a.isEmpty());
        Assert.assertEquals(a.size(), 2);
        a.clear();
        Assert.assertTrue(a.isEmpty());
        Assert.assertEquals(a.size(), 0);
        a.add(ByteString.valueOf("value1"));
        a.add(ByteString.valueOf("value2"));
        a.add(ByteString.valueOf("value3"));
        a.add(ByteString.valueOfUtf8("value1"));
        a.add(ByteString.valueOfUtf8("value2"));
        a.add(ByteString.valueOfUtf8("value3"));
        Assert.assertFalse(a.isEmpty());
        Assert.assertEquals(a.size(), 3);
        a.clear();
@@ -193,49 +194,49 @@
    @Test
    public void testContains() {
        Attribute a = new LinkedAttribute("test");
        Assert.assertFalse(a.contains(ByteString.valueOf("value4")));
        Assert.assertFalse(a.contains(ByteString.valueOfUtf8("value4")));
        a.add(ByteString.valueOf("value1"));
        Assert.assertTrue(a.contains(ByteString.valueOf("value1")));
        Assert.assertFalse(a.contains(ByteString.valueOf("value4")));
        a.add(ByteString.valueOfUtf8("value1"));
        Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value1")));
        Assert.assertFalse(a.contains(ByteString.valueOfUtf8("value4")));
        a.add(ByteString.valueOf("value2"));
        Assert.assertTrue(a.contains(ByteString.valueOf("value1")));
        Assert.assertTrue(a.contains(ByteString.valueOf("value2")));
        Assert.assertFalse(a.contains(ByteString.valueOf("value4")));
        a.add(ByteString.valueOfUtf8("value2"));
        Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value1")));
        Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value2")));
        Assert.assertFalse(a.contains(ByteString.valueOfUtf8("value4")));
        a.add(ByteString.valueOf("value3"));
        Assert.assertTrue(a.contains(ByteString.valueOf("value1")));
        Assert.assertTrue(a.contains(ByteString.valueOf("value2")));
        Assert.assertTrue(a.contains(ByteString.valueOf("value3")));
        Assert.assertFalse(a.contains(ByteString.valueOf("value4")));
        a.add(ByteString.valueOfUtf8("value3"));
        Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value1")));
        Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value2")));
        Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value3")));
        Assert.assertFalse(a.contains(ByteString.valueOfUtf8("value4")));
    }
    @Test
    public void testContainsAll() {
        Attribute a = new LinkedAttribute("test");
        Assert.assertTrue(a.containsAll(Collections.<ByteString> emptyList()));
        Assert.assertFalse(a.containsAll(Arrays.asList(ByteString.valueOf("value1"))));
        Assert.assertFalse(a.containsAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
                .valueOf("value2"))));
        Assert.assertFalse(a.containsAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
                .valueOf("value2"), ByteString.valueOf("value3"))));
        Assert.assertFalse(a.containsAll(Arrays.asList(ByteString.valueOfUtf8("value1"))));
        Assert.assertFalse(a.containsAll(Arrays.asList(ByteString.valueOfUtf8("value1"), ByteString
                .valueOfUtf8("value2"))));
        Assert.assertFalse(a.containsAll(Arrays.asList(ByteString.valueOfUtf8("value1"), ByteString
                .valueOfUtf8("value2"), ByteString.valueOfUtf8("value3"))));
        a.add(ByteString.valueOf("value1"));
        a.add(ByteString.valueOfUtf8("value1"));
        Assert.assertTrue(a.containsAll(Collections.<ByteString> emptyList()));
        Assert.assertTrue(a.containsAll(Arrays.asList(ByteString.valueOf("value1"))));
        Assert.assertFalse(a.containsAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
                .valueOf("value2"))));
        Assert.assertFalse(a.containsAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
                .valueOf("value2"), ByteString.valueOf("value3"))));
        Assert.assertTrue(a.containsAll(Arrays.asList(ByteString.valueOfUtf8("value1"))));
        Assert.assertFalse(a.containsAll(Arrays.asList(ByteString.valueOfUtf8("value1"), ByteString
                .valueOfUtf8("value2"))));
        Assert.assertFalse(a.containsAll(Arrays.asList(ByteString.valueOfUtf8("value1"), ByteString
                .valueOfUtf8("value2"), ByteString.valueOfUtf8("value3"))));
        a.add(ByteString.valueOf("value2"));
        a.add(ByteString.valueOfUtf8("value2"));
        Assert.assertTrue(a.containsAll(Collections.<ByteString> emptyList()));
        Assert.assertTrue(a.containsAll(Arrays.asList(ByteString.valueOf("value1"))));
        Assert.assertTrue(a.containsAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
                .valueOf("value2"))));
        Assert.assertFalse(a.containsAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
                .valueOf("value2"), ByteString.valueOf("value3"))));
        Assert.assertTrue(a.containsAll(Arrays.asList(ByteString.valueOfUtf8("value1"))));
        Assert.assertTrue(a.containsAll(Arrays.asList(ByteString.valueOfUtf8("value1"), ByteString
                .valueOfUtf8("value2"))));
        Assert.assertFalse(a.containsAll(Arrays.asList(ByteString.valueOfUtf8("value1"), ByteString
                .valueOfUtf8("value2"), ByteString.valueOfUtf8("value3"))));
    }
    @Test
@@ -248,14 +249,14 @@
            // Expected.
        }
        a = new LinkedAttribute("test", ByteString.valueOf("value1"));
        Assert.assertEquals(a.firstValue(), ByteString.valueOf("value1"));
        a = new LinkedAttribute("test", ByteString.valueOfUtf8("value1"));
        Assert.assertEquals(a.firstValue(), ByteString.valueOfUtf8("value1"));
        a = new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString.valueOf("value2"));
        Assert.assertEquals(a.firstValue(), ByteString.valueOf("value1"));
        a = new LinkedAttribute("test", ByteString.valueOfUtf8("value1"), ByteString.valueOfUtf8("value2"));
        Assert.assertEquals(a.firstValue(), ByteString.valueOfUtf8("value1"));
        a = new LinkedAttribute("test", ByteString.valueOf("value2"), ByteString.valueOf("value1"));
        Assert.assertEquals(a.firstValue(), ByteString.valueOf("value2"));
        a = new LinkedAttribute("test", ByteString.valueOfUtf8("value2"), ByteString.valueOfUtf8("value1"));
        Assert.assertEquals(a.firstValue(), ByteString.valueOfUtf8("value2"));
    }
    @Test
@@ -271,51 +272,51 @@
        Iterator<ByteString> i = a.iterator();
        Assert.assertFalse(i.hasNext());
        a = new LinkedAttribute("test", ByteString.valueOf("value1"));
        a = new LinkedAttribute("test", ByteString.valueOfUtf8("value1"));
        i = a.iterator();
        Assert.assertTrue(i.hasNext());
        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value1"));
        Assert.assertFalse(i.hasNext());
        a = new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString.valueOf("value2"));
        a = new LinkedAttribute("test", ByteString.valueOfUtf8("value1"), ByteString.valueOfUtf8("value2"));
        i = a.iterator();
        Assert.assertTrue(i.hasNext());
        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value1"));
        Assert.assertTrue(i.hasNext());
        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value2"));
        Assert.assertFalse(i.hasNext());
    }
    @Test
    public void testRemove() {
        Attribute a = new LinkedAttribute("test");
        Assert.assertFalse(a.remove(ByteString.valueOf("value1")));
        Assert.assertFalse(a.remove(ByteString.valueOfUtf8("value1")));
        Iterator<ByteString> i = a.iterator();
        Assert.assertFalse(i.hasNext());
        a = new LinkedAttribute("test", ByteString.valueOf("value1"));
        Assert.assertFalse(a.remove(ByteString.valueOf("value2")));
        a = new LinkedAttribute("test", ByteString.valueOfUtf8("value1"));
        Assert.assertFalse(a.remove(ByteString.valueOfUtf8("value2")));
        i = a.iterator();
        Assert.assertTrue(i.hasNext());
        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value1"));
        Assert.assertFalse(i.hasNext());
        Assert.assertTrue(a.remove(ByteString.valueOf("value1")));
        Assert.assertTrue(a.remove(ByteString.valueOfUtf8("value1")));
        i = a.iterator();
        Assert.assertFalse(i.hasNext());
        a = new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString.valueOf("value2"));
        Assert.assertFalse(a.remove(ByteString.valueOf("value3")));
        a = new LinkedAttribute("test", ByteString.valueOfUtf8("value1"), ByteString.valueOfUtf8("value2"));
        Assert.assertFalse(a.remove(ByteString.valueOfUtf8("value3")));
        i = a.iterator();
        Assert.assertTrue(i.hasNext());
        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value2"));
        Assert.assertFalse(i.hasNext());
        Assert.assertTrue(a.remove(ByteString.valueOf("value1")));
        Assert.assertTrue(a.remove(ByteString.valueOfUtf8("value1")));
        i = a.iterator();
        Assert.assertTrue(i.hasNext());
        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value2"));
        Assert.assertFalse(i.hasNext());
        Assert.assertTrue(a.remove(ByteString.valueOf("value2")));
        Assert.assertTrue(a.remove(ByteString.valueOfUtf8("value2")));
        i = a.iterator();
        Assert.assertFalse(i.hasNext());
    }
@@ -329,101 +330,101 @@
        Assert.assertFalse(i.hasNext());
        a = new LinkedAttribute("test");
        Assert.assertFalse(a.removeAll(Arrays.asList(ByteString.valueOf("value1")), null));
        Assert.assertFalse(a.removeAll(Arrays.asList(ByteString.valueOfUtf8("value1")), null));
        i = a.iterator();
        Assert.assertFalse(i.hasNext());
        a = new LinkedAttribute("test");
        Assert.assertFalse(a.removeAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
                .valueOf("value2"))));
        Assert.assertFalse(a.removeAll(Arrays.asList(ByteString.valueOfUtf8("value1"), ByteString
                .valueOfUtf8("value2"))));
        i = a.iterator();
        Assert.assertFalse(i.hasNext());
        // removeAll from single-valued attribute.
        a = new LinkedAttribute("test", ByteString.valueOf("value1"));
        a = new LinkedAttribute("test", ByteString.valueOfUtf8("value1"));
        Assert.assertFalse(a.removeAll(Collections.<ByteString> emptyList(), null));
        i = a.iterator();
        Assert.assertTrue(i.hasNext());
        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value1"));
        Assert.assertFalse(i.hasNext());
        a = new LinkedAttribute("test", ByteString.valueOf("value1"));
        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOf("value1")), null));
        a = new LinkedAttribute("test", ByteString.valueOfUtf8("value1"));
        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOfUtf8("value1")), null));
        i = a.iterator();
        Assert.assertFalse(i.hasNext());
        a = new LinkedAttribute("test", ByteString.valueOf("value1"));
        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
                .valueOf("value2"))));
        a = new LinkedAttribute("test", ByteString.valueOfUtf8("value1"));
        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOfUtf8("value1"), ByteString
                .valueOfUtf8("value2"))));
        i = a.iterator();
        Assert.assertFalse(i.hasNext());
        // removeAll from multi-valued attribute.
        a =
                new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString
                        .valueOf("value2"), ByteString.valueOf("value3"), ByteString
                        .valueOf("value4"));
                new LinkedAttribute("test", ByteString.valueOfUtf8("value1"), ByteString
                        .valueOfUtf8("value2"), ByteString.valueOfUtf8("value3"), ByteString
                        .valueOfUtf8("value4"));
        Assert.assertFalse(a.removeAll(Collections.<ByteString> emptyList(), null));
        i = a.iterator();
        Assert.assertTrue(i.hasNext());
        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
        Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
        Assert.assertEquals(i.next(), ByteString.valueOf("value4"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value1"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value2"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value3"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value4"));
        Assert.assertFalse(i.hasNext());
        a =
                new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString
                        .valueOf("value2"), ByteString.valueOf("value3"), ByteString
                        .valueOf("value4"));
        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOf("value1")), null));
                new LinkedAttribute("test", ByteString.valueOfUtf8("value1"), ByteString
                        .valueOfUtf8("value2"), ByteString.valueOfUtf8("value3"), ByteString
                        .valueOfUtf8("value4"));
        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOfUtf8("value1")), null));
        i = a.iterator();
        Assert.assertTrue(i.hasNext());
        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
        Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
        Assert.assertEquals(i.next(), ByteString.valueOf("value4"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value2"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value3"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value4"));
        Assert.assertFalse(i.hasNext());
        a =
                new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString
                        .valueOf("value2"), ByteString.valueOf("value3"), ByteString
                        .valueOf("value4"));
        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
                .valueOf("value2")), null));
                new LinkedAttribute("test", ByteString.valueOfUtf8("value1"), ByteString
                        .valueOfUtf8("value2"), ByteString.valueOfUtf8("value3"), ByteString
                        .valueOfUtf8("value4"));
        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOfUtf8("value1"), ByteString
                .valueOfUtf8("value2")), null));
        i = a.iterator();
        Assert.assertTrue(i.hasNext());
        Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
        Assert.assertEquals(i.next(), ByteString.valueOf("value4"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value3"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value4"));
        Assert.assertFalse(i.hasNext());
        a =
                new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString
                        .valueOf("value2"), ByteString.valueOf("value3"), ByteString
                        .valueOf("value4"));
        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
                .valueOf("value2"), ByteString.valueOf("value3")), null));
                new LinkedAttribute("test", ByteString.valueOfUtf8("value1"), ByteString
                        .valueOfUtf8("value2"), ByteString.valueOfUtf8("value3"), ByteString
                        .valueOfUtf8("value4"));
        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOfUtf8("value1"), ByteString
                .valueOfUtf8("value2"), ByteString.valueOfUtf8("value3")), null));
        i = a.iterator();
        Assert.assertTrue(i.hasNext());
        Assert.assertEquals(i.next(), ByteString.valueOf("value4"));
        Assert.assertEquals(i.next(), ByteString.valueOfUtf8("value4"));
        Assert.assertFalse(i.hasNext());
        a =
                new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString
                        .valueOf("value2"), ByteString.valueOf("value3"), ByteString
                        .valueOf("value4"));
        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
                .valueOf("value2"), ByteString.valueOf("value3"), ByteString.valueOf("value4")),
                new LinkedAttribute("test", ByteString.valueOfUtf8("value1"), ByteString
                        .valueOfUtf8("value2"), ByteString.valueOfUtf8("value3"), ByteString
                        .valueOfUtf8("value4"));
        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOfUtf8("value1"), ByteString
                .valueOfUtf8("value2"), ByteString.valueOfUtf8("value3"), ByteString.valueOfUtf8("value4")),
                null));
        i = a.iterator();
        Assert.assertFalse(i.hasNext());
        a =
                new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString
                        .valueOf("value2"), ByteString.valueOf("value3"), ByteString
                        .valueOf("value4"));
        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
                .valueOf("value2"), ByteString.valueOf("value3"), ByteString.valueOf("value4"),
                ByteString.valueOf("value5")), null));
                new LinkedAttribute("test", ByteString.valueOfUtf8("value1"), ByteString
                        .valueOfUtf8("value2"), ByteString.valueOfUtf8("value3"), ByteString
                        .valueOfUtf8("value4"));
        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOfUtf8("value1"), ByteString
                .valueOfUtf8("value2"), ByteString.valueOfUtf8("value3"), ByteString.valueOfUtf8("value4"),
                ByteString.valueOfUtf8("value5")), null));
        i = a.iterator();
        Assert.assertFalse(i.hasNext());
    }
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/RDNTestCase.java
@@ -62,11 +62,11 @@
        ATTR_TYPE_DC = Schema.getCoreSchema().getAttributeType("dc");
        ATTR_TYPE_CN = Schema.getCoreSchema().getAttributeType("cn");
        // Set the avas.
        ATTR_VALUE_DC_ORG = new AVA(ATTR_TYPE_DC, ByteString.valueOf("org"));
        ATTR_VALUE_DC_ORG = new AVA(ATTR_TYPE_DC, ByteString.valueOfUtf8("org"));
    }
    /** "org" bytestring. */
    private static final ByteString ORG = ByteString.valueOf("org");
    private static final ByteString ORG = ByteString.valueOfUtf8("org");
    /**
     * RDN test data provider.
@@ -424,7 +424,7 @@
     */
    @Test
    public void testEscaping() {
        RDN rdn = new RDN(ATTR_TYPE_DC, ByteString.valueOf(" "));
        RDN rdn = new RDN(ATTR_TYPE_DC, ByteString.valueOfUtf8(" "));
        assertEquals(rdn.toString(), "dc=\\ ");
    }
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestTestCase.java
@@ -21,7 +21,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2013 ForgeRock AS
 *      Copyright 2013-2015 ForgeRock AS
 */
package org.forgerock.opendj.ldap.requests;
@@ -105,7 +105,7 @@
            GenericExtendedRequest decoded = GenericExtendedRequest.DECODER.decodeExtendedRequest(copy,
                    new DecodeOptions());
            assertThat(decoded.getOID()).isEqualTo(oid);
            assertThat(decoded.getValue()).isEqualTo(ByteString.valueOf(value));
            assertThat(decoded.getValue()).isEqualTo(ByteString.valueOfUtf8(value));
            assertThat(decoded.getControls().contains(control)).isTrue();
        } catch (DecodeException e) {
            throw e;
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestTestCase.java
@@ -21,7 +21,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2013-2014 ForgeRock AS.
 *      Copyright 2013-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.requests;
@@ -69,7 +69,7 @@
        final PasswordModifyExtendedRequest copy = (PasswordModifyExtendedRequest) copyOf(original);
        copy.setNewPassword(password.toCharArray());
        copy.setOldPassword(oldPassword.toCharArray());
        copy.setUserIdentity(ByteString.valueOf(userIdentity));
        copy.setUserIdentity(ByteString.valueOfUtf8(userIdentity));
        assertThat(copy.getNewPassword()).isEqualTo(password.getBytes());
        assertThat(original.getNewPassword()).isNull();
@@ -97,7 +97,7 @@
                    new DecodeOptions());
            assertThat(decoded.getNewPassword()).isEqualTo(password.getBytes());
            assertThat(decoded.getOldPassword()).isEqualTo(oldPassword.getBytes());
            assertThat(decoded.getUserIdentity()).isEqualTo(ByteString.valueOf(userIdentity));
            assertThat(decoded.getUserIdentity()).isEqualTo(ByteString.valueOfUtf8(userIdentity));
            assertThat(decoded.getControls().contains(control)).isTrue();
        } catch (DecodeException e) {
            throw e;
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImplTest.java
@@ -165,7 +165,7 @@
    @Test(dataProvider = "invalidAssertions", expectedExceptions = { DecodeException.class })
    public void testInvalidAssertion(String assertionValue) throws Exception {
        getRule().getAssertion(null, valueOf(assertionValue));
        getRule().getAssertion(null, valueOfUtf8(assertionValue));
    }
    @DataProvider
@@ -201,8 +201,8 @@
    public void testValidAssertions(String attrValue, String assertionValue, ConditionResult expected)
            throws Exception {
        final MatchingRuleImpl rule = getRule();
        final ByteString normValue = rule.normalizeAttributeValue(null, valueOf(attrValue));
        Assertion assertion = rule.getAssertion(null, valueOf(assertionValue));
        final ByteString normValue = rule.normalizeAttributeValue(null, valueOfUtf8(attrValue));
        Assertion assertion = rule.getAssertion(null, valueOfUtf8(assertionValue));
        assertEquals(assertion.matches(normValue), expected);
    }
@@ -210,7 +210,7 @@
    @SuppressWarnings("unchecked")
    public void testSubstringCreateIndexQueryForFinalWithMultipleSubqueries() throws Exception {
        Assertion assertion = getRule().getSubstringAssertion(
            null, null, Collections.EMPTY_LIST, valueOf("this"));
            null, null, Collections.EMPTY_LIST, valueOfUtf8("this"));
        assertEquals(
            assertion.createIndexQuery(new FakeIndexQueryFactory(newIndexingOptions())),
@@ -223,7 +223,7 @@
    @Test
    public void testSubstringCreateIndexQueryForAllNoSubqueries() throws Exception {
        Assertion assertion = getRule().getSubstringAssertion(
            null, valueOf("abc"), Arrays.asList(toByteStrings("def", "ghi")), valueOf("jkl"));
            null, valueOfUtf8("abc"), Arrays.asList(toByteStrings("def", "ghi")), valueOfUtf8("jkl"));
        assertEquals(
            assertion.createIndexQuery(new FakeIndexQueryFactory(newIndexingOptions())),
@@ -240,7 +240,7 @@
    @SuppressWarnings("unchecked")
    public void testSubstringCreateIndexQueryWithInitial() throws Exception {
        Assertion assertion = getRule().getSubstringAssertion(
            null, valueOf("aa"), Collections.EMPTY_LIST, null);
            null, valueOfUtf8("aa"), Collections.EMPTY_LIST, null);
        assertEquals(
            assertion.createIndexQuery(new FakeIndexQueryFactory(newIndexingOptions())),
@@ -274,14 +274,14 @@
        Assertions.assertThat(indexer.getIndexID()).isEqualTo(SMR_CASE_EXACT_OID + ":" + options.substringKeySize());
        final TreeSet<ByteString> keys = new TreeSet<>();
        indexer.createKeys(Schema.getCoreSchema(), valueOf("ABCDE"), keys);
        indexer.createKeys(Schema.getCoreSchema(), valueOfUtf8("ABCDE"), keys);
        Assertions.assertThat(keys).containsOnly((Object[]) toByteStrings("ABC", "BCD", "CDE", "DE", "E"));
    }
    private ByteString[] toByteStrings(String... strings) {
        final ByteString[] results = new ByteString[strings.length];
        for (int i = 0; i < strings.length; i++) {
            results[i] = valueOf(strings[i]);
            results[i] = valueOfUtf8(strings[i]);
        }
        return results;
    }
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxTestCase.java
@@ -54,7 +54,7 @@
        final Syntax syntax = getRule();
        final LocalizableMessageBuilder reason = new LocalizableMessageBuilder();
        final Boolean liveResult = syntax.valueIsAcceptable(ByteString.valueOf(value), reason);
        final Boolean liveResult = syntax.valueIsAcceptable(ByteString.valueOfUtf8(value), reason);
        assertEquals(liveResult, result,
            syntax + ".valueIsAcceptable gave bad result for " + value + "reason : " + reason);
    }
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/ApproximateMatchingRuleTest.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions Copyright 2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.schema;
@@ -48,11 +49,11 @@
            final String value2, final ConditionResult result) throws Exception {
        // normalize the 2 provided values
        final ByteString normalizedValue1 =
                rule.normalizeAttributeValue(ByteString.valueOf(value1));
                rule.normalizeAttributeValue(ByteString.valueOfUtf8(value1));
        // check that the approximatelyMatch return the expected result.
        final ConditionResult liveResult =
                rule.getAssertion(ByteString.valueOf(value2)).matches(normalizedValue1);
                rule.getAssertion(ByteString.valueOfUtf8(value2)).matches(normalizedValue1);
        assertEquals(result, liveResult);
    }
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateExactMatchingRuleImplTest.java
@@ -23,6 +23,7 @@
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Portions Copyright 2013-2014 Manuel Gaupp
 *      Portions Copyright 2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.schema;
@@ -75,10 +76,10 @@
                + "CN=Babs Jensen,OU=Product Development,L=Cupertione,C=US\" }";
        return new Object[][]{
            {ByteString.valueOfBase64(validcert1), ByteString.valueOf(assertion), ConditionResult.TRUE},
            {ByteString.valueOfBase64(validcert1), ByteString.valueOf(assertionWithSpaces), ConditionResult.TRUE},
            {ByteString.valueOfBase64(validcert1), ByteString.valueOf(assertionDNencoded), ConditionResult.TRUE},
            {ByteString.valueOfBase64(validcert1), ByteString.valueOf(assertionWrong), ConditionResult.FALSE},
            {ByteString.valueOfBase64(validcert1), ByteString.valueOfUtf8(assertion), ConditionResult.TRUE},
            {ByteString.valueOfBase64(validcert1), ByteString.valueOfUtf8(assertionWithSpaces), ConditionResult.TRUE},
            {ByteString.valueOfBase64(validcert1), ByteString.valueOfUtf8(assertionDNencoded), ConditionResult.TRUE},
            {ByteString.valueOfBase64(validcert1), ByteString.valueOfUtf8(assertionWrong), ConditionResult.FALSE},
            {ByteString.valueOfBase64(incompleteCert), ByteString.valueOfBase64(incompleteCert), ConditionResult.TRUE},
            {ByteString.valueOfBase64(validcert1), ByteString.valueOfBase64(validcert1), ConditionResult.TRUE}
        };
@@ -178,7 +179,7 @@
        MatchingRule rule = getRule();
        // normalize the provided assertion values
        rule.getAssertion(ByteString.valueOf(value));
        rule.getAssertion(ByteString.valueOfUtf8(value));
    }
    /**
@@ -192,7 +193,7 @@
        MatchingRule rule = getRule();
        // normalize the provided assertion value
        rule.getAssertion(ByteString.valueOf(value));
        rule.getAssertion(ByteString.valueOfUtf8(value));
    }
    /**
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxTest.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2014 ForgeRock AS.
 *      Portions copyright 2014-2015 ForgeRock AS.
 *      Portions Copyright 2014 Manuel Gaupp
 */
package org.forgerock.opendj.ldap.schema;
@@ -90,10 +90,10 @@
        return new Object[][]{
            {ByteString.valueOfBase64(validcert1), true},
            {ByteString.valueOf(validcert1), false},
            {ByteString.valueOfUtf8(validcert1), false},
            {ByteString.valueOfBase64(invalidcert1), false},
            {ByteString.valueOfBase64(brokencert1), false},
            {ByteString.valueOf("invalid"), false}
            {ByteString.valueOfUtf8("invalid"), false}
        };
    }
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationEqualityMatchingRuleTest.java
@@ -21,7 +21,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2014 ForgeRock AS.
 *      Copyright 2014-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.schema;
@@ -108,7 +108,7 @@
    @Test
    public void testCreateIndexQuery() throws Exception {
        ByteString value = ByteString.valueOf("abc");
        ByteString value = ByteString.valueOfUtf8("abc");
        MatchingRule matchingRule = getRule();
        Assertion assertion = matchingRule.getAssertion(value);
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationGreaterThanMatchingRuleTest.java
@@ -21,7 +21,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2014 ForgeRock AS.
 *      Copyright 2014-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.schema;
@@ -89,7 +89,7 @@
    @Test
    public void testCreateIndexQuery() throws Exception {
        ByteString value = ByteString.valueOf("abc");
        ByteString value = ByteString.valueOfUtf8("abc");
        MatchingRule matchingRule = getRule();
        Assertion assertion = matchingRule.getAssertion(value);
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationGreaterThanOrEqualMatchingRuleTest.java
@@ -21,7 +21,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2014 ForgeRock AS.
 *      Copyright 2014-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.schema;
@@ -90,7 +90,7 @@
    @Test
    public void testCreateIndexQuery() throws Exception {
        ByteString value = ByteString.valueOf("abc");
        ByteString value = ByteString.valueOfUtf8("abc");
        MatchingRule matchingRule = getRule();
        Assertion assertion = matchingRule.getAssertion(value);
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationLessThanMatchingRuleTest.java
@@ -21,7 +21,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2014 ForgeRock AS.
 *      Copyright 2014-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.schema;
@@ -89,7 +89,7 @@
    @Test
    public void testCreateIndexQuery() throws Exception {
        ByteString value = ByteString.valueOf("abc");
        ByteString value = ByteString.valueOfUtf8("abc");
        MatchingRule matchingRule = getRule();
        Assertion assertion = matchingRule.getAssertion(value);
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationLessThanOrEqualMatchingRuleTest.java
@@ -21,7 +21,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2014 ForgeRock AS.
 *      Copyright 2014-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.schema;
@@ -89,7 +89,7 @@
    @Test
    public void testCreateIndexQuery() throws Exception {
        ByteString value = ByteString.valueOf("abc");
        ByteString value = ByteString.valueOfUtf8("abc");
        MatchingRule matchingRule = getRule();
        Assertion assertion = matchingRule.getAssertion(value);
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationSubstringMatchingRuleTest.java
@@ -21,7 +21,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2014 ForgeRock AS.
 *      Copyright 2014-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.schema;
@@ -149,14 +149,14 @@
    @Test
    public void testCreateIndexQuery() throws Exception {
        ByteString value = ByteString.valueOf("a*c");
        ByteString value = ByteString.valueOfUtf8("a*c");
        MatchingRule matchingRule = getRule();
        Assertion assertion = matchingRule.getAssertion(value);
        String indexQuery = assertion.createIndexQuery(new FakeIndexQueryFactory(newIndexingOptions(), false));
        ByteString binit = matchingRule.normalizeAttributeValue(ByteString.valueOf("a"));
        ByteString bfinal = matchingRule.normalizeAttributeValue(ByteString.valueOf("c"));
        ByteString binit = matchingRule.normalizeAttributeValue(ByteString.valueOfUtf8("a"));
        ByteString bfinal = matchingRule.normalizeAttributeValue(ByteString.valueOfUtf8("c"));
        assertEquals(indexQuery,
            "intersect["
            + "rangeMatch(fr.shared, '" + binit.toHexString() + "' <= value < '00 54'), "
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleTest.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2013 ForgeRock AS.
 *      Portions copyright 2013-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.schema;
@@ -200,8 +200,8 @@
    public void testNormalization(final String value1, final String value2) throws Exception {
        final MatchingRule rule = getRule();
        final ByteString normalizedValue1 =
                rule.normalizeAttributeValue(ByteString.valueOf(value1));
        final ByteString expectedValue = ByteString.valueOf(value2);
                rule.normalizeAttributeValue(ByteString.valueOfUtf8(value1));
        final ByteString expectedValue = ByteString.valueOfUtf8(value2);
        assertEquals(normalizedValue1, expectedValue);
    }
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/EnumSyntaxTestCase.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2014 ForgeRock AS.
 *      Portions copyright 2014-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.schema;
@@ -56,11 +56,11 @@
        final Schema schema = builder.toSchema();
        final Syntax syntax = schema.getSyntax("3.3.3");
        final MatchingRule rule = syntax.getOrderingMatchingRule();
        final ByteString monday = ByteString.valueOf("monday");
        final ByteString monday = ByteString.valueOfUtf8("monday");
        final ByteString normMonday = rule.normalizeAttributeValue(monday);
        final ByteString tuesday = ByteString.valueOf("tuesday");
        final ByteString tuesday = ByteString.valueOfUtf8("tuesday");
        final ByteString normTuesday = rule.normalizeAttributeValue(tuesday);
        final ByteString normThursday = rule.normalizeAttributeValue(ByteString.valueOf("thursday"));
        final ByteString normThursday = rule.normalizeAttributeValue(ByteString.valueOfUtf8("thursday"));
        assertEquals(rule.getGreaterOrEqualAssertion(monday).matches(normThursday), TRUE);
        assertEquals(rule.getLessOrEqualAssertion(monday).matches(normThursday), FALSE);
        assertEquals(rule.getGreaterOrEqualAssertion(tuesday).matches(normMonday), FALSE);
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTest.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions Copyright 2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.schema;
@@ -75,8 +76,8 @@
        // normalize the 2 provided values and check that they are equals
        final ByteString normalizedValue1 =
                rule.normalizeAttributeValue(ByteString.valueOf(value1));
        final Assertion assertion = rule.getAssertion(ByteString.valueOf(value2));
                rule.normalizeAttributeValue(ByteString.valueOfUtf8(value1));
        final Assertion assertion = rule.getAssertion(ByteString.valueOfUtf8(value2));
        final ConditionResult liveResult = assertion.matches(normalizedValue1);
        assertEquals(result, liveResult);
@@ -91,7 +92,7 @@
        // Get the instance of the rule to be tested.
        final MatchingRule rule = getRule();
        rule.getAssertion(ByteString.valueOf(value));
        rule.getAssertion(ByteString.valueOfUtf8(value));
    }
    /**
@@ -103,7 +104,7 @@
        // Get the instance of the rule to be tested.
        final MatchingRule rule = getRule();
        rule.normalizeAttributeValue(ByteString.valueOf(value));
        rule.normalizeAttributeValue(ByteString.valueOfUtf8(value));
    }
    /**
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/OrderingMatchingRuleTest.java
@@ -65,9 +65,9 @@
        final MatchingRule ruleInstance = getRule();
        final ByteString normalizedValue1 =
                ruleInstance.normalizeAttributeValue(ByteString.valueOf(value1));
                ruleInstance.normalizeAttributeValue(ByteString.valueOfUtf8(value1));
        final ByteString normalizedValue2 =
                ruleInstance.normalizeAttributeValue(ByteString.valueOf(value2));
                ruleInstance.normalizeAttributeValue(ByteString.valueOfUtf8(value2));
        // Test the comparator
        final int comp = normalizedValue1.compareTo(normalizedValue2);
@@ -79,13 +79,13 @@
            Assert.assertTrue(result < 0);
        }
        Assertion a = ruleInstance.getGreaterOrEqualAssertion(ByteString.valueOf(value2));
        Assertion a = ruleInstance.getGreaterOrEqualAssertion(ByteString.valueOfUtf8(value2));
        Assert.assertEquals(a.matches(normalizedValue1), ConditionResult.valueOf(result >= 0));
        a = ruleInstance.getLessOrEqualAssertion(ByteString.valueOf(value2));
        a = ruleInstance.getLessOrEqualAssertion(ByteString.valueOfUtf8(value2));
        Assert.assertEquals(a.matches(normalizedValue1), ConditionResult.valueOf(result <= 0));
        a = ruleInstance.getAssertion(ByteString.valueOf(value2));
        a = ruleInstance.getAssertion(ByteString.valueOfUtf8(value2));
        Assert.assertEquals(a.matches(normalizedValue1), ConditionResult.valueOf(result < 0));
    }
@@ -99,7 +99,7 @@
        final MatchingRule ruleInstance = getRule();
        // normalize the 2 provided values
        ruleInstance.normalizeAttributeValue(ByteString.valueOf(value));
        ruleInstance.normalizeAttributeValue(ByteString.valueOfUtf8(value));
    }
    /**
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/PartialDateAndTimeMatchingRuleTestCase.java
@@ -184,7 +184,7 @@
    @Test
    public void testCreateIndexQuery() throws Exception {
        Assertion assertion = getRule().getAssertion(ByteString.valueOf("2012Y"));
        Assertion assertion = getRule().getAssertion(ByteString.valueOfUtf8("2012Y"));
        String indexQuery = assertion.createIndexQuery(new FakeIndexQueryFactory(newIndexingOptions(), false));
        assertThat(indexQuery).matches(
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/RelativeTimeGreaterThanMatchingRuleTest.java
@@ -118,7 +118,7 @@
    @Test
    public void testCreateIndexQuery() throws Exception {
        Assertion assertion = getRule().getAssertion(ByteString.valueOf("+5m"));
        Assertion assertion = getRule().getAssertion(ByteString.valueOfUtf8("+5m"));
        String indexQuery = assertion.createIndexQuery(new FakeIndexQueryFactory(newIndexingOptions(), false));
        assertThat(indexQuery).startsWith("rangeMatch(" + EMR_GENERALIZED_TIME_NAME + ", '")
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/RelativeTimeLessThanMatchingRuleTest.java
@@ -119,7 +119,7 @@
    @Test
    public void testCreateIndexQuery() throws Exception {
        Assertion assertion = getRule().getAssertion(ByteString.valueOf("+5m"));
        Assertion assertion = getRule().getAssertion(ByteString.valueOfUtf8("+5m"));
        String indexQuery = assertion.createIndexQuery(new FakeIndexQueryFactory(newIndexingOptions(), false));
        assertThat(indexQuery).startsWith("rangeMatch(" + EMR_GENERALIZED_TIME_NAME + ", '' < value < '");
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaBuilderTestCase.java
@@ -2146,7 +2146,7 @@
                        CoreSchema.getOctetStringSyntax().toString(), false).toSchema();
        // Ensure that the substituted syntax is usable.
        assertThat(schema.getSyntax("9.9.9").valueIsAcceptable(ByteString.valueOf("test"), null))
        assertThat(schema.getSyntax("9.9.9").valueIsAcceptable(ByteString.valueOfUtf8("test"), null))
                .isTrue();
    }
@@ -2162,8 +2162,8 @@
        // Ensure that the substituted rule is usable: was triggering a NPE with OPENDJ-1252.
        assertThat(
                schema.getMatchingRule("9.9.9").normalizeAttributeValue(ByteString.valueOf("test")))
                .isEqualTo(ByteString.valueOf("test"));
                schema.getMatchingRule("9.9.9").normalizeAttributeValue(ByteString.valueOfUtf8("test")))
                .isEqualTo(ByteString.valueOfUtf8("test"));
    }
}
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaUtilsTest.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011 ForgeRock AS
 *      Portions copyright 2011-2015 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
@@ -164,7 +164,7 @@
    @Test(dataProvider = "stringProvider")
    public void testNormalizeStringProvider(String value, boolean trim, boolean foldCase, String expected)
            throws Exception {
        ByteString val = ByteString.valueOf(value);
        ByteString val = ByteString.valueOfUtf8(value);
        ByteString normValue = SchemaUtils.normalizeStringAttributeValue(val, trim, foldCase);
        Assertions.assertThat(normValue.toString()).isEqualTo(expected);
    }
@@ -184,7 +184,7 @@
    @Test(dataProvider = "stringProvider")
    public void testNormalizeIA5String(String value, boolean trim, boolean foldCase, String expected)
            throws Exception {
        ByteString val = ByteString.valueOf(value);
        ByteString val = ByteString.valueOfUtf8(value);
        ByteString normValue = SchemaUtils.normalizeIA5StringAttributeValue(val, trim, foldCase);
        Assertions.assertThat(normValue.toString()).isEqualTo(expected);
    }
@@ -204,7 +204,7 @@
    @Test(dataProvider = "stringProvider")
    public void testNormalizeStringList(String value, boolean trim, boolean foldCase, String expected)
            throws Exception {
        ByteString val = ByteString.valueOf(value);
        ByteString val = ByteString.valueOfUtf8(value);
        ByteString normValue = SchemaUtils.normalizeStringListAttributeValue(val, trim, foldCase);
        Assertions.assertThat(normValue.toString()).isEqualTo(expected);
    }
@@ -255,7 +255,7 @@
    @Test(dataProvider = "numericStringProvider")
    public void testNormalizeNumericString(String value, String expected) throws Exception {
        ByteString val = ByteString.valueOf(value);
        ByteString val = ByteString.valueOfUtf8(value);
        ByteString normValue = SchemaUtils.normalizeNumericStringAttributeValue(val);
        Assertions.assertThat(normValue.toString()).isEqualTo(expected);
    }
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SubstringMatchingRuleTest.java
@@ -93,12 +93,12 @@
        final MatchingRule rule = getRule();
        // normalize the 2 provided values and check that they are equals
        final ByteString normalizedValue = rule.normalizeAttributeValue(ByteString.valueOf(value));
        final ByteString normalizedValue = rule.normalizeAttributeValue(ByteString.valueOfUtf8(value));
        final ConditionResult substringAssertionMatches =
            rule.getSubstringAssertion(null, null, ByteString.valueOf(finalValue)).matches(normalizedValue);
            rule.getSubstringAssertion(null, null, ByteString.valueOfUtf8(finalValue)).matches(normalizedValue);
        final ConditionResult assertionMatches =
            rule.getAssertion(ByteString.valueOf("*" + finalValue)).matches(normalizedValue);
            rule.getAssertion(ByteString.valueOfUtf8("*" + finalValue)).matches(normalizedValue);
        final String message = getMessage("final", rule, value, finalValue);
        assertEquals(substringAssertionMatches, result, message);
        assertEquals(assertionMatches, result, message);
@@ -113,12 +113,12 @@
        final MatchingRule rule = getRule();
        // normalize the 2 provided values and check that they are equals
        final ByteString normalizedValue = rule.normalizeAttributeValue(ByteString.valueOf(value));
        final ByteString normalizedValue = rule.normalizeAttributeValue(ByteString.valueOfUtf8(value));
        final ConditionResult substringAssertionMatches =
            rule.getSubstringAssertion(ByteString.valueOf(initial), null, null).matches(normalizedValue);
            rule.getSubstringAssertion(ByteString.valueOfUtf8(initial), null, null).matches(normalizedValue);
        final ConditionResult assertionMatches =
            rule.getAssertion(ByteString.valueOf(initial + "*")).matches(normalizedValue);
            rule.getAssertion(ByteString.valueOfUtf8(initial + "*")).matches(normalizedValue);
        final String message = getMessage("initial", rule, value, initial);
        assertEquals(substringAssertionMatches, result, message);
        assertEquals(assertionMatches, result, message);
@@ -142,10 +142,10 @@
        final List<ByteSequence> anyList = new ArrayList<>(anys.length);
        for (final String middleSub : anys) {
            anyList.add(ByteString.valueOf(middleSub));
            anyList.add(ByteString.valueOfUtf8(middleSub));
        }
        rule.getSubstringAssertion(subInitial == null ? null : ByteString.valueOf(subInitial), anyList,
                subFinal == null ? null : ByteString.valueOf(subFinal));
        rule.getSubstringAssertion(subInitial == null ? null : ByteString.valueOfUtf8(subInitial), anyList,
                subFinal == null ? null : ByteString.valueOfUtf8(subFinal));
    }
    /**
@@ -170,7 +170,7 @@
        if (subFinal != null) {
            assertionString.append(subFinal);
        }
        rule.getAssertion(ByteString.valueOf(assertionString.toString()));
        rule.getAssertion(ByteString.valueOfUtf8(assertionString.toString()));
    }
    /**
@@ -182,7 +182,7 @@
        final MatchingRule rule = getRule();
        // normalize the 2 provided values and check that they are equals
        final ByteString normalizedValue = rule.normalizeAttributeValue(ByteString.valueOf(value));
        final ByteString normalizedValue = rule.normalizeAttributeValue(ByteString.valueOfUtf8(value));
        final StringBuilder printableMiddleSubs = new StringBuilder();
        final List<ByteSequence> middleList = new ArrayList<>(middleSubs.length);
@@ -190,13 +190,13 @@
        for (final String middleSub : middleSubs) {
            printableMiddleSubs.append(middleSub);
            printableMiddleSubs.append("*");
            middleList.add(ByteString.valueOf(middleSub));
            middleList.add(ByteString.valueOfUtf8(middleSub));
        }
        final ConditionResult substringAssertionMatches =
            rule.getSubstringAssertion(null, middleList, null).matches(normalizedValue);
        final ConditionResult assertionMatches =
            rule.getAssertion(ByteString.valueOf(printableMiddleSubs)).matches(normalizedValue);
            rule.getAssertion(ByteString.valueOfUtf8(printableMiddleSubs)).matches(normalizedValue);
        final String message = getMessage("middle", rule, value, printableMiddleSubs.toString());
        assertEquals(substringAssertionMatches, result, message);
        assertEquals(assertionMatches, result, message);
@@ -211,7 +211,7 @@
        // Get the instance of the rule to be tested.
        final MatchingRule rule = getRule();
        rule.normalizeAttributeValue(ByteString.valueOf(value));
        rule.normalizeAttributeValue(ByteString.valueOfUtf8(value));
    }
    /**
opendj-sdk/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Controls.java
@@ -20,7 +20,7 @@
 *
 * CDDL HEADER END
 *
 *      Copyright 2012-2014 ForgeRock AS
 *      Copyright 2012-2015 ForgeRock AS
 *
 */
@@ -1024,7 +1024,7 @@
                            .addControl(
                                    VirtualListViewRequestControl.newAssertionControl(
                                            true,
                                            ByteString.valueOf("Jensen"),
                                            ByteString.valueOfUtf8("Jensen"),
                                            2, 2, contextID));
            final SearchResultHandler resultHandler = new MySearchResultHandler();
opendj-sdk/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPCompare.java
@@ -299,10 +299,10 @@
                    return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
                }
            } else {
                attributeVal = ByteString.valueOf(remainder);
                attributeVal = ByteString.valueOfUtf8(remainder);
            }
        } else {
            attributeVal = ByteString.valueOf(remainder);
            attributeVal = ByteString.valueOfUtf8(remainder);
        }
        final CompareRequest compare = Requests.newCompareRequest("", attributeType, attributeVal);
opendj-sdk/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModify.java
@@ -296,7 +296,7 @@
        }
        if (result.getGeneratedPassword() != null) {
            println(INFO_LDAPPWMOD_GENERATED_PASSWORD.get(ByteString.valueOf(
            println(INFO_LDAPPWMOD_GENERATED_PASSWORD.get(ByteString.valueOfBytes(
                    result.getGeneratedPassword()).toString()));
        }
opendj-sdk/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPSearch.java
@@ -749,7 +749,7 @@
                try {
                    final int beforeCount = Integer.parseInt(tokenizer.nextToken());
                    final int afterCount = Integer.parseInt(tokenizer.nextToken());
                    final ByteString assertionValue = ByteString.valueOf(tokenizer.nextToken());
                    final ByteString assertionValue = ByteString.valueOfUtf8(tokenizer.nextToken());
                    search.addControl(VirtualListViewRequestControl.newAssertionControl(true,
                            assertionValue, beforeCount, afterCount, null));
                } catch (final Exception e) {
opendj-sdk/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Utils.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions copyright 2014 ForgeRock AS
 *      Portions copyright 2014-2015 ForgeRock AS
 */
package com.forgerock.opendj.ldap.tools;
@@ -143,7 +143,7 @@
        final String valString = remainder.substring(idx + 1, remainder.length());
        if (valString.charAt(0) == ':') {
            controlValue = ByteString.valueOf(valString.substring(1, valString.length()));
            controlValue = ByteString.valueOfUtf8(valString.substring(1, valString.length()));
        } else if (valString.charAt(0) == '<') {
            // Read data from the file.
            final String filePath = valString.substring(1, valString.length());
@@ -154,7 +154,7 @@
                return null;
            }
        } else {
            controlValue = ByteString.valueOf(valString);
            controlValue = ByteString.valueOfUtf8(valString);
        }
        return GenericControl.newControl(controlOID, controlCriticality, controlValue);
opendj-sdk/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Rest2LDAP.java
@@ -729,7 +729,7 @@
                            + "client provided resource ID");
                }
            } else {
                entry.addAttribute(new LinkedAttribute(idAttribute, ByteString.valueOf(resourceId)));
                entry.addAttribute(new LinkedAttribute(idAttribute, ByteString.valueOfUtf8(resourceId)));
            }
            final String rdnValue = entry.parseAttribute(dnAttribute).asString();
            final RDN rdn = new RDN(dnAttribute.getAttributeType(), rdnValue);
@@ -765,7 +765,7 @@
                final Entry entry) throws ResourceException {
            if (resourceId != null) {
                entry.setName(baseDN.child(rdn(resourceId)));
                entry.addAttribute(new LinkedAttribute(attribute, ByteString.valueOf(resourceId)));
                entry.addAttribute(new LinkedAttribute(attribute, ByteString.valueOfUtf8(resourceId)));
            } else if (entry.getAttribute(attribute) != null) {
                entry.setName(baseDN.child(rdn(entry.parseAttribute(attribute).asString())));
            } else {
opendj-sdk/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Utils.java
@@ -164,9 +164,9 @@
                if (isJSONPrimitive(value)) {
                    final Syntax syntax = ad.getAttributeType().getSyntax();
                    if (syntax.equals(getGeneralizedTimeSyntax())) {
                        return ByteString.valueOf(GeneralizedTime.valueOf(parseDateTime(value.toString())));
                        return ByteString.valueOfObject(GeneralizedTime.valueOf(parseDateTime(value.toString())));
                    } else {
                        return ByteString.valueOf(value);
                        return ByteString.valueOfObject(value);
                    }
                } else {
                    throw new IllegalArgumentException("Unrecognized type of JSON value: "