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

Jean-Noël Rouvignac
28.10.2015 07e7cb84f497a907074b5ca46f3147f65488d6ed
opendj-server-legacy/src/dsml/org/opends/dsml/protocol/ByteStringUtility.java
@@ -69,7 +69,7 @@
        {
          is = ((URI) obj).toURL().openStream();
          ByteStringBuilder bsb = new ByteStringBuilder();
          while (bsb.append(is, 2048) != -1)
          while (bsb.appendBytes(is, 2048) != -1)
          {
            // do nothing
          }
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/RemoteSchemaLoader.java
@@ -177,7 +177,7 @@
      for (final Object definition : remainingAttrs)
      {
        final ByteStringBuilder sb = new ByteStringBuilder();
        sb.append(definition);
        sb.appendObject(definition);
        try
        {
          switch (schemaAttr)
@@ -209,7 +209,7 @@
    for (final Object definition : remainingAttrs)
    {
      final ByteStringBuilder sb = new ByteStringBuilder();
      sb.append(definition);
      sb.appendObject(definition);
      if (definition.toString().contains(SchemaConstants.OID_OPENDS_SERVER_BASE))
      {
        try
opendj-server-legacy/src/main/java/org/opends/server/api/CompressedSchema.java
@@ -224,12 +224,12 @@
    // Encode the attribute.
    final byte[] idBytes = encodeId(id);
    builder.appendBERLength(idBytes.length);
    builder.append(idBytes);
    builder.appendBytes(idBytes);
    builder.appendBERLength(attribute.size());
    for (final ByteString v : attribute)
    {
      builder.appendBERLength(v.length());
      builder.append(v);
      builder.appendBytes(v);
    }
  }
@@ -273,7 +273,7 @@
    // Encode the object classes.
    final byte[] idBytes = encodeId(id);
    builder.appendBERLength(idBytes.length);
    builder.append(idBytes);
    builder.appendBytes(idBytes);
  }
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/DBTest.java
@@ -1449,7 +1449,7 @@
      byte[] vBytes = StaticUtils.getBytes(value);
      ByteStringBuilder builder = new ByteStringBuilder();
      builder.appendBERLength(vBytes.length);
      builder.append(vBytes);
      builder.appendBytes(vBytes);
      return builder.toByteArray();
    }
    else
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/DN2URI.java
@@ -145,9 +145,9 @@
  private byte[] encodeURIAndDN(String labeledURI, DN dn)
  {
    return new ByteStringBuilder()
      .append(labeledURI)
      .append(STRING_SEPARATOR)
      .append(dn.toString())
      .appendUtf8(labeledURI)
      .appendByte(STRING_SEPARATOR)
      .appendUtf8(dn.toString())
      .toByteArray();
  }
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/ID2Entry.java
@@ -181,7 +181,7 @@
      entry.encode(entryBuffer, dataConfig.getEntryEncodeConfig());
      // First write the DB format version byte.
      encodedBuffer.append(JebFormat.FORMAT_VERSION);
      encodedBuffer.appendByte(JebFormat.FORMAT_VERSION);
      try
      {
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/JebFormat.java
@@ -304,7 +304,7 @@
    int startSize = dn.size() - prefixRDNs - 1;
    for (int i = startSize; i >= 0; i--)
    {
        builder.append(DN.NORMALIZED_RDN_SEPARATOR);
        builder.appendByte(DN.NORMALIZED_RDN_SEPARATOR);
        dn.getRDN(i).toNormalizedByteString(builder);
    }
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/SortValuesSet.java
@@ -493,7 +493,7 @@
          final MatchingRule eqRule = types[i].getEqualityMatchingRule();
          final ByteString nv = eqRule.normalizeAttributeValue(v);
          builder.appendBERLength(nv.length());
          builder.append(nv);
          builder.appendBytes(nv);
        }
      }
      builder.trimToSize();
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/VLVIndex.java
@@ -1124,10 +1124,10 @@
          final MatchingRule eqRule = types[i].getEqualityMatchingRule();
          final ByteString nv = eqRule.normalizeAttributeValue(v);
          builder.appendBERLength(nv.length());
          builder.append(nv);
          builder.appendBytes(nv);
        }
      }
      builder.append(entryID);
      builder.appendLong(entryID);
      builder.trimToSize();
      return builder.getBackingArray();
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2ID.java
@@ -204,7 +204,7 @@
        cursor.delete();
        ByteString newDnKeySuffix = currentDnKey.subSequence(oldTargetDnKeyLength, currentDnKey.length());
        ByteSequence newDnKey = new ByteStringBuilder(newTargetDnKey).append(newDnKeySuffix);
        ByteSequence newDnKey = new ByteStringBuilder(newTargetDnKey).appendBytes(newDnKeySuffix);
        EntryID newID = renumberEntryIDs ? rootContainer.getNextEntryID() : oldID;
        txn.put(getName(), newDnKey, newID.toByteString());
@@ -312,7 +312,7 @@
    private ByteSequence nextSibling()
    {
      return builder.clear().append(delegate.getKey()).append((byte) 0x1);
      return builder.clear().appendBytes(delegate.getKey()).appendByte(0x1);
    }
  }
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2URI.java
@@ -120,14 +120,14 @@
      // encode the dn inside the value
      // because the dn is encoded in a non reversible way in the key
      byte[] dnBytes = StaticUtils.getBytes(dn.toString());
      b.append(dnBytes.length);
      b.append(dnBytes);
      b.append(col.size());
      b.appendInt(dnBytes.length);
      b.appendBytes(dnBytes);
      b.appendInt(col.size());
      for (String s : col)
      {
        byte[] bytes = StaticUtils.getBytes(s);
        b.append(bytes.length);
        b.append(bytes);
        b.appendInt(bytes.length);
        b.appendBytes(bytes);
      }
      return b;
    }
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DnKeyFormat.java
@@ -80,7 +80,7 @@
    final int startSize = dn.size() - prefixRDNs - 1;
    for (int i = startSize; i >= 0; i--)
    {
        builder.append(DN.NORMALIZED_RDN_SEPARATOR);
        builder.appendByte(DN.NORMALIZED_RDN_SEPARATOR);
        dn.getRDN(i).toNormalizedByteString(builder);
    }
    return builder.toByteString();
@@ -105,16 +105,16 @@
  static ByteStringBuilder beforeKey(final ByteSequence key)
  {
    final ByteStringBuilder beforeKey = new ByteStringBuilder(key.length() + 1);
    beforeKey.append(key);
    beforeKey.append((byte) 0x00);
    beforeKey.appendBytes(key);
    beforeKey.appendByte(0x00);
    return beforeKey;
  }
  static ByteStringBuilder afterKey(final ByteSequence key)
  {
    final ByteStringBuilder afterKey = new ByteStringBuilder(key.length() + 1);
    afterKey.append(key);
    afterKey.append((byte) 0x01);
    afterKey.appendBytes(key);
    afterKey.appendByte(0x01);
    return afterKey;
  }
}
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryIDSet.java
@@ -480,12 +480,12 @@
      {
        for (long value : idSet.getIDs())
        {
          builder.append(value);
          builder.appendLong(value);
        }
        return builder;
      }
      // Set top bit.
      return builder.append((byte) 0x80);
      return builder.appendByte(0x80);
    }
  }
@@ -537,7 +537,7 @@
      }
      else
      {
        builder.append(UNDEFINED_SET);
        builder.appendByte(UNDEFINED_SET);
      }
      return builder;
    }
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/ID2Entry.java
@@ -195,7 +195,7 @@
      entry.encode(entryBuffer, dataConfig.getEntryEncodeConfig());
      // First write the DB format version byte.
      encodedBuffer.append(DnKeyFormat.FORMAT_VERSION);
      encodedBuffer.appendByte(DnKeyFormat.FORMAT_VERSION);
      try
      {
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java
@@ -742,7 +742,7 @@
  {
    final ByteStringBuilder builder = new ByteStringBuilder();
    encodeVLVKey0(sortOrder, entry, builder);
    builder.append(entryID);
    builder.appendLong(entryID);
    return builder.toByteString();
  }
@@ -826,7 +826,7 @@
        if ((b & (byte) 0x01) == b)
        {
          // Escape bytes that look like a separator.
          builder.append(escape);
          builder.appendByte(escape);
        }
        else if (i == 0 && (b & (byte) 0xfe) == (byte) 0xfe)
        {
@@ -834,18 +834,18 @@
           * Ensure that all keys sort before (ascending) or after (descending) null keys, by
           * escaping the first byte if it looks like a null key.
           */
          builder.append((byte) ~escape);
          builder.appendByte(~escape);
        }
        // Invert the bits if this key is in descending order.
        builder.append((byte) (b ^ sortOrderMask));
        builder.appendByte(b ^ sortOrderMask);
      }
    }
    else
    {
      // Ensure that null keys sort after (ascending) or before (descending) all other keys.
      builder.append(ascending ? (byte) 0xff : (byte) 0x00);
      builder.appendByte(ascending ? 0xFF : 0x00);
    }
    builder.append(separator);
    builder.appendByte(separator);
  }
  @Override
opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/InternalLDAPOutputStream.java
@@ -313,7 +313,7 @@
    // Append any unused data in the channel buffer to the save buffer
    if(byteBuffer.remaining() > 0)
    {
      saveBuffer.append(byteBuffer, byteBuffer.remaining());
      saveBuffer.appendBytes(byteBuffer, byteBuffer.remaining());
    }
  }
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ASN1ByteChannelReader.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2011-2014 ForgeRock AS.
 *      Portions Copyright 2011-2015 ForgeRock AS.
 */
package org.opends.server.protocols.ldap;
@@ -329,7 +329,7 @@
    // Append any unused data in the channel buffer to the save buffer
    if (byteBuffer.remaining() > 0)
    {
      saveBuffer.append(byteBuffer, byteBuffer.remaining());
      saveBuffer.appendBytes(byteBuffer, byteBuffer.remaining());
    }
    byteBuffer.clear();
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPFilter.java
@@ -709,11 +709,11 @@
                throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message);
            }
            valueBuffer.append(byteValue);
            valueBuffer.appendByte(byteValue);
          }
          else
          {
            valueBuffer.append(valueBytes[i]);
            valueBuffer.appendByte(valueBytes[i]);
          }
        }
@@ -1063,11 +1063,11 @@
                throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message);
            }
            buffer.append(byteValue);
            buffer.appendByte(byteValue);
          }
          else
          {
            buffer.append(valueBytes[i]);
            buffer.appendByte(valueBytes[i]);
          }
        }
@@ -1225,11 +1225,11 @@
                throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message);
            }
            buffer.append(byteValue);
            buffer.appendByte(byteValue);
          }
          else
          {
            buffer.append(valueBytes[i]);
            buffer.appendByte(valueBytes[i]);
          }
        }
@@ -1396,11 +1396,11 @@
                throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message);
            }
            buffer.append(byteValue);
            buffer.appendByte(byteValue);
          }
          else
          {
            buffer.append(valueBytes[i]);
            buffer.appendByte(valueBytes[i]);
          }
        }
@@ -1658,11 +1658,11 @@
              throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message);
          }
          valueBuffer.append(byteValue);
          valueBuffer.appendByte(byteValue);
        }
        else
        {
          valueBuffer.append(valueBytes[i]);
          valueBuffer.appendByte(valueBytes[i]);
        }
      }
opendj-server-legacy/src/main/java/org/opends/server/replication/common/CSN.java
@@ -236,8 +236,7 @@
   */
  public ByteStringBuilder toByteString(ByteStringBuilder builder)
  {
    return builder.append(timeStamp).append((short) (serverId & 0xffff))
        .append(seqnum);
    return builder.appendLong(timeStamp).appendShort(serverId & 0xffff).appendInt(seqnum);
  }
  /**
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRuleImpl.java
@@ -75,9 +75,9 @@
    public String keyToHumanReadableString(ByteSequence key)
    {
      ByteStringBuilder bsb = new ByteStringBuilder();
      bsb.append(key.subSequence(2, 10));
      bsb.append(key.subSequence(0, 2));
      bsb.append(key.subSequence(10, 14));
      bsb.appendBytes(key.subSequence(2, 10));
      bsb.appendBytes(key.subSequence(0, 2));
      bsb.appendBytes(key.subSequence(10, 14));
      CSN csn = CSN.valueOf(bsb.toByteString());
      return csn.toStringUI();
    }
@@ -97,9 +97,9 @@
      int csnIndex = value.toString().indexOf(':') + 1;
      String csn = value.subSequence(csnIndex, csnIndex + 28).toString();
      ByteStringBuilder builder = new ByteStringBuilder(14);
      builder.append(hexStringToByteArray(csn.substring(16, 20)));
      builder.append(hexStringToByteArray(csn.substring(0, 16)));
      builder.append(hexStringToByteArray(csn.substring(20, 28)));
      builder.appendBytes(hexStringToByteArray(csn.substring(16, 20)));
      builder.appendBytes(hexStringToByteArray(csn.substring(0, 16)));
      builder.appendBytes(hexStringToByteArray(csn.substring(20, 28)));
      return builder.toByteString();
    }
    catch (Exception e)
opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/AddMsg.java
@@ -349,7 +349,7 @@
  public void addAttribute(String name, String value) throws DecodeException
  {
    ByteStringBuilder byteBuilder = new ByteStringBuilder();
    byteBuilder.append(encodedAttributes);
    byteBuilder.appendBytes(encodedAttributes);
    ASN1Writer writer = ASN1.getWriter(byteBuilder);
opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ByteArrayBuilder.java
@@ -20,7 +20,7 @@
 *
 * CDDL HEADER END
 *
 *      Copyright 2014 ForgeRock AS
 *      Copyright 2014-2015 ForgeRock AS
 */
package org.opends.server.replication.protocol;
@@ -78,7 +78,7 @@
   */
  public ByteArrayBuilder appendBoolean(boolean b)
  {
    appendByte((byte) (b ? 1 : 0));
    appendByte(b ? 1 : 0);
    return this;
  }
@@ -89,9 +89,9 @@
   *          the byte to append.
   * @return this ByteArrayBuilder
   */
  public ByteArrayBuilder appendByte(byte b)
  public ByteArrayBuilder appendByte(int b)
  {
    builder.append(b);
    builder.appendByte(b);
    return this;
  }
@@ -102,9 +102,9 @@
   *          the short to append.
   * @return this ByteArrayBuilder
   */
  public ByteArrayBuilder appendShort(short s)
  public ByteArrayBuilder appendShort(int s)
  {
    builder.append(s);
    builder.appendShort(s);
    return this;
  }
@@ -117,7 +117,7 @@
   */
  public ByteArrayBuilder appendInt(int i)
  {
    builder.append(i);
    builder.appendInt(i);
    return this;
  }
@@ -130,7 +130,7 @@
   */
  public ByteArrayBuilder appendLong(long l)
  {
    builder.append(l);
    builder.appendLong(l);
    return this;
  }
@@ -170,7 +170,7 @@
  public ByteArrayBuilder appendStrings(Collection<String> col)
  {
    //appendInt() would have been safer, but byte is compatible with legacy code
    appendByte((byte) col.size());
    appendByte(col.size());
    for (String s : col)
    {
      appendString(s);
@@ -253,7 +253,7 @@
   */
  public ByteArrayBuilder appendByteArray(byte[] bytes)
  {
    builder.append(bytes);
    builder.appendBytes(bytes);
    return this;
  }
@@ -271,13 +271,13 @@
   */
  public ByteArrayBuilder appendZeroTerminatedByteArray(byte[] bytes)
  {
    builder.append(bytes);
    builder.appendBytes(bytes);
    return appendZeroSeparator();
  }
  private ByteArrayBuilder appendZeroSeparator()
  {
    builder.append((byte) 0);
    builder.appendByte(0);
    return this;
  }
opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/LDAPUpdateMsg.java
@@ -221,7 +221,7 @@
     */
    final ByteArrayBuilder builder = new ByteArrayBuilder();
    builder.appendByte(msgType);
    builder.appendByte((byte) protocolVersion);
    builder.appendByte(protocolVersion);
    builder.appendCSNUTF8(csn);
    builder.appendDN(dn);
    builder.appendString(entryUUID);
opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/MonitorMsg.java
@@ -296,7 +296,7 @@
      if (protocolVersion == ProtocolVersion.REPLICATION_PROTOCOL_V1)
      {
        // legacy coding mistake
        builder.appendByte((byte) 0);
        builder.appendByte(0);
      }
      return builder.toByteArray();
    }
@@ -315,7 +315,7 @@
    }
    else if (protocolVersion <= ProtocolVersion.REPLICATION_PROTOCOL_V3)
    {
      builder.appendShort((short) data);
      builder.appendShort(data);
    }
    else // protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V4
    {
opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/StartMsg.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2013-2014 ForgeRock AS.
 *      Portions Copyright 2013-2015 ForgeRock AS.
 */
package org.opends.server.replication.protocol;
@@ -79,7 +79,7 @@
     * <message type><protocol version><generation id><group id>
     */
    builder.appendByte(msgType);
    builder.appendByte((byte) protocolVersion);
    builder.appendByte(protocolVersion);
    builder.appendLongUTF8(generationId);
    builder.appendByte(groupId);
  }
@@ -98,8 +98,8 @@
     * <message type><protocol version><generation id>
     */
    builder.appendByte(msgType);
    builder.appendByte((byte) ProtocolVersion.REPLICATION_PROTOCOL_V1_REAL);
    builder.appendByte((byte) 0);
    builder.appendByte(ProtocolVersion.REPLICATION_PROTOCOL_V1_REAL);
    builder.appendByte(0);
    builder.appendLongUTF8(generationId);
  }
opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/StartSessionMsg.java
@@ -132,11 +132,11 @@
      ByteStringBuilder byteBuilder = new ByteStringBuilder();
      ASN1Writer writer = ASN1.getWriter(byteBuilder);
      byteBuilder.append(MSG_TYPE_START_SESSION);
      byteBuilder.append(status.getValue());
      byteBuilder.append(assuredFlag ? (byte) 1 : (byte) 0);
      byteBuilder.append(assuredMode.getValue());
      byteBuilder.append(safeDataLevel);
      byteBuilder.appendByte(MSG_TYPE_START_SESSION);
      byteBuilder.appendByte(status.getValue());
      byteBuilder.appendByte(assuredFlag ? 1 : 0);
      byteBuilder.appendByte(assuredMode.getValue());
      byteBuilder.appendByte(safeDataLevel);
      writer.writeStartSequence();
      for (String url : referralsURLs)
opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/TopologyMsg.java
@@ -210,7 +210,7 @@
    builder.appendByte(MSG_TYPE_TOPOLOGY);
    // Put DS infos
    builder.appendByte((byte) replicaInfos.size());
    builder.appendByte(replicaInfos.size());
    for (DSInfo dsInfo : replicaInfos.values())
    {
      builder.appendIntUTF8(dsInfo.getDsId());
@@ -235,12 +235,12 @@
        {
          builder.appendStrings(dsInfo.getEclIncludesForDeletes());
        }
        builder.appendByte((byte) dsInfo.getProtocolVersion());
        builder.appendByte(dsInfo.getProtocolVersion());
      }
    }
    // Put RS infos
    builder.appendByte((byte) rsInfos.size());
    builder.appendByte(rsInfos.size());
    for (RSInfo rsInfo : rsInfos)
    {
      builder.appendIntUTF8(rsInfo.getId());
opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/UpdateMsg.java
@@ -219,10 +219,9 @@
   */
  protected ByteArrayBuilder encodeHeader(byte msgType, short protocolVersion)
  {
    final ByteArrayBuilder builder =
        new ByteArrayBuilder(bytes(6) + csnsUTF8(1));
    final ByteArrayBuilder builder = new ByteArrayBuilder(bytes(6) + csnsUTF8(1));
    builder.appendByte(msgType);
    builder.appendByte((byte) ProtocolVersion.getCurrentVersion());
    builder.appendByte(ProtocolVersion.getCurrentVersion());
    builder.appendCSNUTF8(getCSN());
    builder.appendBoolean(assuredFlag);
    builder.appendByte(assuredMode.getValue());
opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/file/BlockLogReader.java
@@ -314,7 +314,7 @@
      {
        if (distanceToBlockStart != 0)
        {
          recordBytes.append(reader, distanceToBlockStart);
          recordBytes.appendBytes(reader, distanceToBlockStart);
        }
        // skip the offset
        reader.skipBytes(SIZE_OF_BLOCK_OFFSET);
@@ -327,7 +327,7 @@
      if (remainingBytesToRead > 0)
      {
        // last bytes of the record
        recordBytes.append(reader, remainingBytesToRead);
        recordBytes.appendBytes(reader, remainingBytesToRead);
      }
      return recordBytes.toByteString();
    }
@@ -366,10 +366,10 @@
    final ByteStringBuilder lengthBytes = new ByteStringBuilder(SIZE_OF_RECORD_SIZE);
    if (distanceToBlockStart > 0 && distanceToBlockStart < SIZE_OF_RECORD_SIZE)
    {
      lengthBytes.append(reader, distanceToBlockStart);
      lengthBytes.appendBytes(reader, distanceToBlockStart);
      // skip the offset
      reader.skipBytes(SIZE_OF_BLOCK_OFFSET);
      lengthBytes.append(reader, SIZE_OF_RECORD_SIZE - distanceToBlockStart);
      lengthBytes.appendBytes(reader, SIZE_OF_RECORD_SIZE - distanceToBlockStart);
    }
    else
    {
@@ -378,7 +378,7 @@
        // skip the offset
        reader.skipBytes(SIZE_OF_BLOCK_OFFSET);
      }
      lengthBytes.append(reader, SIZE_OF_RECORD_SIZE);
      lengthBytes.appendBytes(reader, SIZE_OF_RECORD_SIZE);
    }
    return lengthBytes.toByteString().toInt();
  }
opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/file/BlockLogWriter.java
@@ -180,8 +180,8 @@
  {
    // Add length of record before writing
    ByteString data = new ByteStringBuilder(SIZE_OF_RECORD_SIZE + record.length()).
        append(record.length()).
        append(record).
        appendInt(record.length()).
        appendBytes(record).
        toByteString();
    int distanceToBlockStart = BlockLogReader.getDistanceToNextBlockStart(writer.getBytesWritten(), blockSize);
opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/file/FileChangeNumberIndexDB.java
@@ -410,10 +410,11 @@
    {
      final ChangeNumberIndexRecord cnIndexRecord = record.getValue();
      return new ByteStringBuilder()
        .append((long) record.getKey())
        .append(cnIndexRecord.getBaseDN().toString())
        .append(STRING_SEPARATOR)
        .append(cnIndexRecord.getCSN().toByteString()).toByteString();
        .appendLong(record.getKey())
        .appendUtf8(cnIndexRecord.getBaseDN().toString())
        .appendByte(STRING_SEPARATOR)
        .appendBytes(cnIndexRecord.getCSN().toByteString())
        .toByteString();
    }
    @Override
opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/Installation.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2011-2013 ForgeRock AS
 *      Portions Copyright 2011-2015 ForgeRock AS
 */
package org.opends.server.tools.upgrade;
opendj-server-legacy/src/main/java/org/opends/server/types/DN.java
@@ -2116,7 +2116,7 @@
    int length = dnString.length();
    if (pos >= length)
    {
      attributeValue.append("");
      attributeValue.appendUtf8("");
      return pos;
    }
@@ -2207,8 +2207,7 @@
      // octet string.
      try
      {
        attributeValue.append(
            hexStringToByteArray(hexString.toString()));
        attributeValue.appendBytes(hexStringToByteArray(hexString.toString()));
        return pos;
      }
      catch (Exception e)
@@ -2225,8 +2224,7 @@
    // should continue until the corresponding closing quotation mark.
    else if (c == '"')
    {
      // Keep reading until we find an unescaped closing quotation
      // mark.
      // Keep reading until we find an unescaped closing quotation mark.
      boolean escaped = false;
      StringBuilder valueString = new StringBuilder();
      while (true)
@@ -2267,7 +2265,7 @@
        }
      }
      attributeValue.append(valueString.toString());
      attributeValue.appendUtf8(valueString.toString());
      return pos;
    }
    else if(c == '+' || c == ',')
@@ -2409,7 +2407,7 @@
      }
      attributeValue.append(valueString.toString());
      attributeValue.appendUtf8(valueString.toString());
      return pos;
    }
  }
@@ -2592,7 +2590,7 @@
        rdnComponents[numComponents - 1].toNormalizedByteString(builder);
        for (int i = numComponents - 2; i >= 0; i--)
        {
          builder.append(NORMALIZED_RDN_SEPARATOR);
          builder.appendByte(NORMALIZED_RDN_SEPARATOR);
          rdnComponents[i].toNormalizedByteString(builder);
        }
        normalizedDN = builder.toByteString();
opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
@@ -3311,7 +3311,7 @@
         throws DirectoryException
  {
    // The version number will be one byte.
    buffer.append((byte)0x03);
    buffer.appendByte(0x03);
    // Get the encoded representation of the config.
    config.encode(buffer);
@@ -3324,7 +3324,7 @@
      // TODO: Can we encode the DN directly into buffer?
      byte[] dnBytes  = getBytes(dn.toString());
      buffer.appendBERLength(dnBytes.length);
      buffer.append(dnBytes);
      buffer.appendBytes(dnBytes);
    }
@@ -3339,8 +3339,8 @@
      buffer.appendBERLength(objectClasses.size());
      for (String ocName : objectClasses.values())
      {
        buffer.append(ocName);
        buffer.append((byte)0x00);
        buffer.appendUtf8(ocName);
        buffer.appendByte(0x00);
      }
    }
@@ -3420,14 +3420,14 @@
        for (Attribute a : attrList)
        {
          byte[] nameBytes = getBytes(a.getNameWithOptions());
          buffer.append(nameBytes);
          buffer.append((byte)0x00);
          buffer.appendBytes(nameBytes);
          buffer.appendByte(0x00);
          buffer.appendBERLength(a.size());
          for(ByteString v : a)
          {
            buffer.appendBERLength(v.length());
            buffer.append(v);
            buffer.appendBytes(v);
          }
        }
      }
opendj-server-legacy/src/main/java/org/opends/server/types/EntryEncodeConfig.java
@@ -266,7 +266,7 @@
  public void encode(ByteStringBuilder buffer)
  {
    buffer.appendBERLength(1);
    buffer.append(encodedRepresentation);
    buffer.appendByte(encodedRepresentation);
  }
opendj-server-legacy/src/main/java/org/opends/server/types/RDN.java
@@ -1038,7 +1038,7 @@
  {
    if (normalizedRDN != null)
    {
      return builder.append(normalizedRDN);
      return builder.appendBytes(normalizedRDN);
    }
    return computeNormalizedByteString(builder);
  }
@@ -1063,11 +1063,11 @@
      }
      Iterator<ByteString> iterator = avaStrings.iterator();
      builder.append(iterator.next());
      builder.appendBytes(iterator.next());
      while (iterator.hasNext())
      {
        builder.append(DN.NORMALIZED_AVA_SEPARATOR);
        builder.append(iterator.next());
        builder.appendByte(DN.NORMALIZED_AVA_SEPARATOR);
        builder.appendBytes(iterator.next());
      }
    }
@@ -1091,12 +1091,12 @@
   */
  private ByteStringBuilder normalizeAVAToByteString(int position, final ByteStringBuilder builder)
  {
    builder.append(attributeTypes[position].getNormalizedPrimaryNameOrOID());
    builder.append("=");
    builder.appendUtf8(attributeTypes[position].getNormalizedPrimaryNameOrOID());
    builder.appendUtf8("=");
    final ByteString value = getEqualityNormalizedValue(position);
    if (value.length() > 0)
    {
      builder.append(escapeBytes(value));
      builder.appendBytes(escapeBytes(value));
    }
    return builder;
  }
@@ -1120,9 +1120,9 @@
      final byte b = value.byteAt(i);
      if (isByteToEscape(b))
      {
        builder.append(DN.NORMALIZED_ESC_BYTE);
        builder.appendByte(DN.NORMALIZED_ESC_BYTE);
      }
      builder.append(b);
      builder.appendByte(b);
    }
    return builder.toByteString();
  }
opendj-server-legacy/src/main/java/org/opends/server/types/RecordingInputStream.java
@@ -57,11 +57,12 @@
  }
  /** {@inheritDoc} */
  @Override
  public int read() throws IOException {
    int readByte = parentStream.read();
    if(enableRecording)
    {
      buffer.append((byte)readByte);
      buffer.appendByte(readByte);
    }
    return readByte;
  }
@@ -72,7 +73,7 @@
    int bytesRead = parentStream.read(bytes);
    if(enableRecording)
    {
      buffer.append(bytes, 0, bytesRead);
      buffer.appendBytes(bytes, 0, bytesRead);
    }
    return bytesRead;
  }
@@ -83,7 +84,7 @@
    int bytesRead = parentStream.read(bytes, i, i1);
    if(enableRecording)
    {
      buffer.append(bytes, i, bytesRead);
      buffer.appendBytes(bytes, i, bytesRead);
    }
    return bytesRead;
  }
opendj-server-legacy/src/main/java/org/opends/server/types/RecordingOutputStream.java
@@ -56,10 +56,11 @@
  }
  /** {@inheritDoc} */
  @Override
  public void write(int i) throws IOException {
    if(enableRecording)
    {
      buffer.append((byte) i);
      buffer.appendByte(i);
    }
    parentStream.write(i);
  }
@@ -69,7 +70,7 @@
  public void write(byte[] bytes) throws IOException {
    if(enableRecording)
    {
      buffer.append(bytes);
      buffer.appendBytes(bytes);
    }
    parentStream.write(bytes);
  }
@@ -79,7 +80,7 @@
  public void write(byte[] bytes, int i, int i1) throws IOException {
    if(enableRecording)
    {
      buffer.append(bytes, i, i1);
      buffer.appendBytes(bytes, i, i1);
    }
    parentStream.write(bytes, i, i1);
  }
opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java
@@ -974,11 +974,11 @@
                               ResultCode.PROTOCOL_ERROR, message);
            }
            valueBuffer.append(byteValue);
            valueBuffer.appendByte(byteValue);
          }
          else
          {
            valueBuffer.append(valueBytes[i]);
            valueBuffer.appendByte(valueBytes[i]);
          }
        }
@@ -1362,11 +1362,11 @@
                               ResultCode.PROTOCOL_ERROR, message);
            }
            buffer.append(byteValue);
            buffer.appendByte(byteValue);
          }
          else
          {
            buffer.append(valueBytes[i]);
            buffer.appendByte(valueBytes[i]);
          }
        }
@@ -1530,11 +1530,11 @@
                               ResultCode.PROTOCOL_ERROR, message);
            }
            buffer.append(byteValue);
            buffer.appendByte(byteValue);
          }
          else
          {
            buffer.append(valueBytes[i]);
            buffer.appendByte(valueBytes[i]);
          }
        }
@@ -1707,11 +1707,11 @@
                               ResultCode.PROTOCOL_ERROR, message);
            }
            buffer.append(byteValue);
            buffer.appendByte(byteValue);
          }
          else
          {
            buffer.append(valueBytes[i]);
            buffer.appendByte(valueBytes[i]);
          }
        }
@@ -2013,11 +2013,11 @@
                                           message);
          }
          valueBuffer.append(byteValue);
          valueBuffer.appendByte(byteValue);
        }
        else
        {
          valueBuffer.append(valueBytes[i]);
          valueBuffer.appendByte(valueBytes[i]);
        }
      }
opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
@@ -1568,7 +1568,7 @@
          ByteStringBuilder builder = new ByteStringBuilder(4096);
          inputStream  = contentURL.openConnection().getInputStream();
          while (builder.append(inputStream, 4096) != -1) { /* Do nothing */ }
          while (builder.appendBytes(inputStream, 4096) != -1) { /* Do nothing */ }
          value = builder.toByteString();
        }
opendj-server-legacy/src/test/java/org/opends/quicksetup/TestUtilities.java
@@ -99,8 +99,8 @@
    if (p.waitFor() != 0) {
      ByteStringBuilder stdOut = new ByteStringBuilder();
      ByteStringBuilder stdErr = new ByteStringBuilder();
      while(stdOut.append(p.getInputStream(), 512) > 0) {}
      while(stdErr.append(p.getErrorStream(), 512) > 0) {}
      while(stdOut.appendBytes(p.getInputStream(), 512) > 0) {}
      while(stdErr.appendBytes(p.getErrorStream(), 512) > 0) {}
      throw new IllegalStateException(
          "setup server process failed:\n" +
          "exit value: " + p.exitValue() + "\n" +
opendj-server-legacy/src/test/java/org/opends/server/api/AuthenticationPolicyTestCase.java
@@ -332,10 +332,10 @@
          .getRootConnection();
      ByteStringBuilder credentials = new ByteStringBuilder();
      credentials.append((byte) 0);
      credentials.append("dn:" + userDNString);
      credentials.append((byte) 0);
      credentials.append("password");
      credentials.appendByte(0);
      credentials.appendUtf8("dn:" + userDNString);
      credentials.appendByte(0);
      credentials.appendUtf8("password");
      BindOperation bind = conn.processSASLBind(DN.rootDN(), "PLAIN",
          credentials.toByteString());
opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestJebFormat.java
@@ -222,12 +222,12 @@
         throws DirectoryException
  {
    // The version number will be one byte.
    buffer.append((byte)0x01);
    buffer.appendByte(0x01);
    // TODO: Can we encode the DN directly into buffer?
    byte[] dnBytes  = getBytes(entry.getName().toString());
    buffer.appendBERLength(dnBytes.length);
    buffer.append(dnBytes);
    buffer.appendBytes(dnBytes);
    // Encode number of OCs and 0 terminated names.
@@ -235,15 +235,15 @@
    ByteStringBuilder bsb = new ByteStringBuilder();
    for (String ocName : entry.getObjectClasses().values())
    {
      bsb.append(ocName);
      bsb.appendUtf8(ocName);
      if(i < entry.getObjectClasses().values().size())
      {
        bsb.append((byte)0x00);
        bsb.appendByte(0x00);
      }
      i++;
    }
    buffer.appendBERLength(bsb.length());
    buffer.append(bsb);
    buffer.appendBytes(bsb);
    // Encode the user attributes in the appropriate manner.
@@ -294,7 +294,7 @@
         throws DirectoryException
  {
    // The version number will be one byte.
    buffer.append((byte)0x02);
    buffer.appendByte(0x02);
    // Get the encoded respresentation of the config.
    config.encode(buffer);
@@ -307,7 +307,7 @@
      // TODO: Can we encode the DN directly into buffer?
      byte[] dnBytes  = getBytes(entry.getName().toString());
      buffer.appendBERLength(dnBytes.length);
      buffer.append(dnBytes);
      buffer.appendBytes(dnBytes);
    }
@@ -324,15 +324,15 @@
      ByteStringBuilder bsb = new ByteStringBuilder();
      for (String ocName : entry.getObjectClasses().values())
      {
        bsb.append(ocName);
        bsb.appendUtf8(ocName);
        if(i < entry.getObjectClasses().values().size())
        {
          bsb.append((byte)0x00);
          bsb.appendByte(0x00);
        }
        i++;
      }
      buffer.appendBERLength(bsb.length());
      buffer.append(bsb);
      buffer.appendBytes(bsb);
    }
@@ -383,7 +383,7 @@
          ByteStringBuilder bsb = new ByteStringBuilder();
          config.getCompressedSchema().encodeAttribute(bsb, a);
          buffer.appendBERLength(bsb.length());
          buffer.append(bsb);
          buffer.appendBytes(bsb);
        }
      }
    }
@@ -410,14 +410,14 @@
      for (Attribute a : attrList)
      {
        byte[] nameBytes = getBytes(a.getNameWithOptions());
        buffer.append(nameBytes);
        buffer.append((byte)0x00);
        buffer.appendBytes(nameBytes);
        buffer.appendByte(0x00);
        buffer.appendBERLength(a.size());
        for (ByteString v : a)
        {
          buffer.appendBERLength(v.length());
          buffer.append(v);
          buffer.appendBytes(v);
        }
      }
    }
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/OnDiskMergeImporterTest.java
@@ -371,8 +371,8 @@
      Collections.sort(resultContainer);
      for (ByteString s : resultContainer)
      {
        builder.append(s);
        builder.append(new char[] { '-' });
        builder.appendBytes(s);
        builder.appendUtf8(new char[] { '-' });
      }
      builder.setLength(builder.length() - 1);
      return builder.toByteString();
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/TestDnKeyFormat.java
@@ -148,12 +148,12 @@
         throws DirectoryException
  {
    // The version number will be one byte.
    buffer.append((byte)0x01);
    buffer.appendByte(0x01);
    // TODO: Can we encode the DN directly into buffer?
    byte[] dnBytes  = getBytes(entry.getName().toString());
    buffer.appendBERLength(dnBytes.length);
    buffer.append(dnBytes);
    buffer.appendBytes(dnBytes);
    // Encode number of OCs and 0 terminated names.
@@ -161,15 +161,15 @@
    ByteStringBuilder bsb = new ByteStringBuilder();
    for (String ocName : entry.getObjectClasses().values())
    {
      bsb.append(ocName);
      bsb.appendUtf8(ocName);
      if(i < entry.getObjectClasses().values().size())
      {
        bsb.append((byte)0x00);
        bsb.appendByte(0x00);
      }
      i++;
    }
    buffer.appendBERLength(bsb.length());
    buffer.append(bsb);
    buffer.appendBytes(bsb);
    // Encode the user attributes in the appropriate manner.
@@ -219,7 +219,7 @@
         throws DirectoryException
  {
    // The version number will be one byte.
    buffer.append((byte)0x02);
    buffer.appendByte(0x02);
    // Get the encoded respresentation of the config.
    config.encode(buffer);
@@ -232,7 +232,7 @@
      // TODO: Can we encode the DN directly into buffer?
      byte[] dnBytes  = getBytes(entry.getName().toString());
      buffer.appendBERLength(dnBytes.length);
      buffer.append(dnBytes);
      buffer.appendBytes(dnBytes);
    }
@@ -249,15 +249,15 @@
      ByteStringBuilder bsb = new ByteStringBuilder();
      for (String ocName : entry.getObjectClasses().values())
      {
        bsb.append(ocName);
        bsb.appendUtf8(ocName);
        if(i < entry.getObjectClasses().values().size())
        {
          bsb.append((byte)0x00);
          bsb.appendByte(0x00);
        }
        i++;
      }
      buffer.appendBERLength(bsb.length());
      buffer.append(bsb);
      buffer.appendBytes(bsb);
    }
@@ -308,7 +308,7 @@
          ByteStringBuilder bsb = new ByteStringBuilder();
          config.getCompressedSchema().encodeAttribute(bsb, a);
          buffer.appendBERLength(bsb.length());
          buffer.append(bsb);
          buffer.appendBytes(bsb);
        }
      }
    }
@@ -335,14 +335,14 @@
      for (Attribute a : attrList)
      {
        byte[] nameBytes = getBytes(a.getNameWithOptions());
        buffer.append(nameBytes);
        buffer.append((byte)0x00);
        buffer.appendBytes(nameBytes);
        buffer.appendByte(0x00);
        buffer.appendBERLength(a.size());
        for (ByteString v : a)
        {
          buffer.appendBERLength(v.length());
          buffer.append(v);
          buffer.appendBytes(v);
        }
      }
    }
opendj-server-legacy/src/test/java/org/opends/server/extensions/PlainSASLMechanismHandlerTestCase.java
@@ -158,10 +158,10 @@
    ByteStringBuilder saslCredBytes = new ByteStringBuilder();
    saslCredBytes.append((byte)0);
    saslCredBytes.append("test.user");
    saslCredBytes.append((byte)0);
    saslCredBytes.append(password);
    saslCredBytes.appendByte(0);
    saslCredBytes.appendUtf8("test.user");
    saslCredBytes.appendByte(0);
    saslCredBytes.appendBytes(password);
    InternalClientConnection anonymousConn =
         new InternalClientConnection(new AuthenticationInfo());
    BindOperation bindOperation =
@@ -199,10 +199,10 @@
    ByteStringBuilder saslCredBytes = new ByteStringBuilder();
    saslCredBytes.append((byte)0);
    saslCredBytes.append("u:test.user");
    saslCredBytes.append((byte)0);
    saslCredBytes.append(password);
    saslCredBytes.appendByte(0);
    saslCredBytes.appendUtf8("u:test.user");
    saslCredBytes.appendByte(0);
    saslCredBytes.appendBytes(password);
    InternalClientConnection anonymousConn =
         new InternalClientConnection(new AuthenticationInfo());
    BindOperation bindOperation =
@@ -241,11 +241,11 @@
    ByteStringBuilder saslCredBytes = new ByteStringBuilder();
    saslCredBytes.append("u:test.user");
    saslCredBytes.append((byte)0);
    saslCredBytes.append("u:test.user");
    saslCredBytes.append((byte)0);
    saslCredBytes.append(password);
    saslCredBytes.appendUtf8("u:test.user");
    saslCredBytes.appendByte(0);
    saslCredBytes.appendUtf8("u:test.user");
    saslCredBytes.appendByte(0);
    saslCredBytes.appendBytes(password);
    InternalClientConnection anonymousConn =
         new InternalClientConnection(new AuthenticationInfo());
    BindOperation bindOperation =
@@ -283,11 +283,11 @@
    ByteStringBuilder saslCredBytes = new ByteStringBuilder();
    saslCredBytes.append((byte)0);
    saslCredBytes.append("dn:");
    saslCredBytes.append(e.getName().toString());
    saslCredBytes.append((byte)0);
    saslCredBytes.append(password);
    saslCredBytes.appendByte(0);
    saslCredBytes.appendUtf8("dn:");
    saslCredBytes.appendUtf8(e.getName().toString());
    saslCredBytes.appendByte(0);
    saslCredBytes.appendBytes(password);
    InternalClientConnection anonymousConn =
         new InternalClientConnection(new AuthenticationInfo());
    BindOperation bindOperation =
@@ -326,13 +326,13 @@
    ByteStringBuilder saslCredBytes = new ByteStringBuilder();
    saslCredBytes.append("dn:");
    saslCredBytes.append(e.getName().toString());
    saslCredBytes.append((byte)0);
    saslCredBytes.append("dn:");
    saslCredBytes.append(e.getName().toString());
    saslCredBytes.append((byte)0);
    saslCredBytes.append(password);
    saslCredBytes.appendUtf8("dn:");
    saslCredBytes.appendUtf8(e.getName().toString());
    saslCredBytes.appendByte(0);
    saslCredBytes.appendUtf8("dn:");
    saslCredBytes.appendUtf8(e.getName().toString());
    saslCredBytes.appendByte(0);
    saslCredBytes.appendBytes(password);
    InternalClientConnection anonymousConn =
         new InternalClientConnection(new AuthenticationInfo());
    BindOperation bindOperation =
opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/ASN1ReaderTestCase.java
@@ -489,9 +489,9 @@
      throws Exception
  {
    ByteStringBuilder bsb = new ByteStringBuilder();
    bsb.append(ASN1.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendByte(ASN1.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendBERLength(b.length);
    bsb.append(b);
    bsb.appendBytes(b);
    assertEquals(getReader(bsb.toByteArray(), 0).readOctetString(),
        ByteString.wrap(b));
@@ -510,9 +510,9 @@
      throws Exception
  {
    ByteStringBuilder bsb = new ByteStringBuilder();
    bsb.append(ASN1.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendByte(ASN1.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendBERLength(b.length);
    bsb.append(b);
    bsb.appendBytes(b);
    assertEquals(getReader(bsb.toByteArray(), 0).readOctetStringAsString(),
        new String(b, "UTF-8"));
@@ -531,9 +531,9 @@
      throws Exception
  {
    ByteStringBuilder bsb = new ByteStringBuilder();
    bsb.append(ASN1.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendByte(ASN1.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendBERLength(b.length);
    bsb.append(b);
    bsb.appendBytes(b);
    ByteStringBuilder bsb2 = new ByteStringBuilder();
    getReader(bsb.toByteArray(), 0).readOctetString(bsb2);
@@ -619,11 +619,11 @@
      throws Exception
  {
    ByteStringBuilder bsb = new ByteStringBuilder();
    bsb.append(ASN1.UNIVERSAL_SEQUENCE_TYPE);
    bsb.appendByte(ASN1.UNIVERSAL_SEQUENCE_TYPE);
    bsb.appendBERLength(encodedElements.length + 2);
    bsb.append(ASN1.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendByte(ASN1.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendBERLength(encodedElements.length);
    bsb.append(encodedElements);
    bsb.appendBytes(encodedElements);
    ASN1Reader reader = getReader(bsb.toByteArray(), 0);
    assertEquals(reader.peekLength(), encodedElements.length + 2);
opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/BlockLogReaderWriterTest.java
@@ -506,7 +506,7 @@
    @Override
    public ByteString encodeRecord(Record<Integer, Integer> record)
    {
      return new ByteStringBuilder().append((int) record.getKey()).append((int) record.getValue()).toByteString();
      return new ByteStringBuilder().appendInt(record.getKey()).appendInt(record.getValue()).toByteString();
    }
    @Override
opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/LogFileTest.java
@@ -57,6 +57,7 @@
  private static final File TEST_DIRECTORY = new File(TestCaseUtils.getUnitTestRootPath(), "changelog-unit");
  private static final File TEST_LOG_FILE = new File(TEST_DIRECTORY, Log.HEAD_LOG_FILE_NAME);
  static final StringRecordParser RECORD_PARSER = new StringRecordParser();
  private static final byte STRING_SEPARATOR = 0;
  @BeforeClass
  public void createTestDirectory()
@@ -225,17 +226,17 @@
    return new Object[][]
    {
      // write partial record size (should be 4 bytes)
      { 1, new ByteStringBuilder().append((byte) 0) },
      { 1, new ByteStringBuilder().appendByte(0) },
      // write partial record size (should be 4 bytes)
      { 2, new ByteStringBuilder().append((byte) 0).append((byte) 0).append((byte) 0) },
      { 2, new ByteStringBuilder().appendByte(0).appendByte(0).appendByte(0) },
      // write size only
      { 3, new ByteStringBuilder().append(10) },
      { 3, new ByteStringBuilder().appendInt(10) },
      // write size + key
      { 4, new ByteStringBuilder().append(100).append("key") },
      { 4, new ByteStringBuilder().appendInt(100).appendUtf8("key") },
      // write size + key + separator
      { 5, new ByteStringBuilder().append(100).append("key").append(StringRecordParser.STRING_SEPARATOR) },
      { 5, new ByteStringBuilder().appendInt(100).appendUtf8("key").appendByte(STRING_SEPARATOR) },
      // write size + key + separator + partial value
      { 6, new ByteStringBuilder().append(100).append("key").append(StringRecordParser.STRING_SEPARATOR).append("v") },
      { 6, new ByteStringBuilder().appendInt(100).appendUtf8("key").appendByte(STRING_SEPARATOR).appendUtf8("v") },
    };
  }
@@ -314,8 +315,6 @@
   */
  private static class StringRecordParser implements RecordParser<String, String>
  {
    private static final byte STRING_SEPARATOR = 0;
    @Override
    public Record<String, String> decodeRecord(final ByteString data) throws DecodingException
    {
@@ -341,8 +340,8 @@
    public ByteString encodeRecord(Record<String, String> record)
    {
      return new ByteStringBuilder()
        .append(record.getKey()).append(STRING_SEPARATOR)
        .append(record.getValue()).append(STRING_SEPARATOR).toByteString();
        .appendUtf8(record.getKey()).appendByte(STRING_SEPARATOR)
        .appendUtf8(record.getValue()).appendByte(STRING_SEPARATOR).toByteString();
    }
    @Override
opendj-server-legacy/src/test/java/org/opends/server/types/TestDN.java
@@ -356,8 +356,8 @@
    DN dn = DN.valueOf("dc=example,dc=com");
    assertEquals(dn.toNormalizedByteString(),
        new ByteStringBuilder().append("dc=com").append(DN.NORMALIZED_RDN_SEPARATOR)
                               .append("dc=example").toByteString());
        new ByteStringBuilder().appendUtf8("dc=com").appendByte(DN.NORMALIZED_RDN_SEPARATOR)
                               .appendUtf8("dc=example").toByteString());
    assertEquals(dn.toNormalizedUrlSafeString(), "dc=com,dc=example");
  }