From 07e7cb84f497a907074b5ca46f3147f65488d6ed Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 05 Nov 2015 12:25:28 +0000
Subject: [PATCH] OPENDJ-1802 Make ByteStringBuilder methods more intentional

---
 opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ByteArrayBuilder.java |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ByteArrayBuilder.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ByteArrayBuilder.java
index 11e643d..91274a2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ByteArrayBuilder.java
+++ b/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;
   }
 

--
Gitblit v1.10.0