From 0e52d359d661d2fd95fa5c28058353f5d121173c Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Thu, 20 Sep 2012 22:32:04 +0000
Subject: [PATCH] Fix OPENDJ-597: Remove superfluous ByteString based constructors

---
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/Requests.java |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/Requests.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/Requests.java
index 6d8aa97..605b1fa 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/Requests.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/Requests.java
@@ -209,6 +209,9 @@
     /**
      * Creates a new compare request using the provided distinguished name,
      * 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.
      *
      * @param name
      *            The distinguished name of the entry to be compared.
@@ -222,9 +225,10 @@
      *             {@code assertionValue} was {@code null}.
      */
     public static CompareRequest newCompareRequest(final DN name,
-            final AttributeDescription attributeDescription, final ByteString assertionValue) {
+            final AttributeDescription attributeDescription, final Object assertionValue) {
         Validator.ensureNotNull(name, attributeDescription, assertionValue);
-        return new CompareRequestImpl(name, attributeDescription, assertionValue);
+        return new CompareRequestImpl(name, attributeDescription, ByteString
+                .valueOf(assertionValue));
     }
 
     /**
@@ -443,12 +447,15 @@
      */
     public static GenericExtendedRequest newGenericExtendedRequest(final String requestName) {
         Validator.ensureNotNull(requestName);
-        return new GenericExtendedRequestImpl(requestName, null);
+        return new GenericExtendedRequestImpl(requestName);
     }
 
     /**
      * Creates a new generic extended request using the provided name and
      * 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.
      *
      * @param requestName
      *            The dotted-decimal representation of the unique OID
@@ -462,9 +469,9 @@
      *             If {@code requestName} was {@code null}.
      */
     public static GenericExtendedRequest newGenericExtendedRequest(final String requestName,
-            final ByteString requestValue) {
+            final Object requestValue) {
         Validator.ensureNotNull(requestName);
-        return new GenericExtendedRequestImpl(requestName, requestValue);
+        return new GenericExtendedRequestImpl(requestName).setValue(requestValue);
     }
 
     /**

--
Gitblit v1.10.0