From 6b7839d9d70958b85da5c9340a53d1f21bd12c31 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 21 Sep 2011 16:06:11 +0000
Subject: [PATCH] Fix OPENDJ-291: Do not use String representation of byte[] when constructing attribute values and byte strings.

---
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ByteStringBuilderTestCase.java |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ByteStringBuilderTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ByteStringBuilderTestCase.java
index 9d1319f..8287ed9 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ByteStringBuilderTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ByteStringBuilderTestCase.java
@@ -23,6 +23,7 @@
  *
  *
  *      Copyright 2010 Sun Microsystems, Inc.
+ *      Portions copyright 2011 ForgeRock AS
  */
 
 package org.forgerock.opendj.ldap;
@@ -258,6 +259,23 @@
         { new ByteStringBuilder(11).append("this is a").append(" test"),
             "this is a test".getBytes("UTF-8") },
         {
+            new ByteStringBuilder().append((Object) "this is a").append(
+                (Object) " test"), "this is a test".getBytes("UTF-8") },
+        {
+            new ByteStringBuilder().append("this is a".toCharArray()).append(
+                " test".toCharArray()), "this is a test".getBytes("UTF-8") },
+        {
+            new ByteStringBuilder().append((Object) "this is a".toCharArray())
+                .append((Object) " test".toCharArray()),
+            "this is a test".getBytes("UTF-8") },
+        {
+            new ByteStringBuilder().append((Object) eightBytes).append(
+                (Object) eightBytes),
+            new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
+                (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08,
+                (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
+                (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08 } },
+        {
             new ByteStringBuilder().appendBERLength(0x00000000)
                 .appendBERLength(0x00000001).appendBERLength(0x0000000F)
                 .appendBERLength(0x00000010).appendBERLength(0x0000007F).

--
Gitblit v1.10.0