You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2005/09/10 00:27:40 UTC

svn commit: r279898 - /directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/message/CompareRequestImpl.java

Author: elecharny
Date: Fri Sep  9 15:27:35 2005
New Revision: 279898

URL: http://svn.apache.org/viewcvs?rev=279898&view=rev
Log:
- The attrVal is now stored as a byte[].
- added a get and set method to deal with this byte[]. The previous member (using a String) are still there.

Modified:
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/message/CompareRequestImpl.java

Modified: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/message/CompareRequestImpl.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/message/CompareRequestImpl.java?rev=279898&r1=279897&r2=279898&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/message/CompareRequestImpl.java (original)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/message/CompareRequestImpl.java Fri Sep  9 15:27:35 2005
@@ -16,6 +16,8 @@
  */
 package org.apache.ldap.common.message;
 
+import java.io.UnsupportedEncodingException;
+
 
 /**
  * Lockable comparison request implementation.
@@ -33,7 +35,7 @@
     /** The id of the attribute used in the comparison */
     private String attrId;
     /** The value of the attribute used in the comparison */
-    private String attrVal;
+    private byte[] attrVal;
 
 
     // ------------------------------------------------------------------------
@@ -88,11 +90,27 @@
      *
      * @return the attribute value to used in comparison.
      */
-    public String getAssertionValue()
+    public byte[] getAssertionValueValue()
     {
         return attrVal;
     }
 
+    /**
+     * Gets the attribute value to use in making the comparison.
+     *
+     * @return the attribute value to used in comparison.
+     */
+    public String getAssertionValue()
+    {
+        try 
+        {
+            return new String( attrVal, "UTF-8" );
+        }
+        catch (UnsupportedEncodingException uee)
+        {
+            return "";
+        }
+    }
 
     /**
      * Sets the attribute value to use in the comparison.
@@ -103,9 +121,28 @@
     {
         super.lockCheck(
             "Attempt to alter attribute value of locked CompareRequest" );
-        this.attrVal = attrVal;
+
+        try 
+        {
+            this.attrVal = attrVal.getBytes( "UTF-8" );
+        }
+        catch (UnsupportedEncodingException uee)
+        {
+            this.attrVal = new byte[]{};
+        }
     }
 
+    /**
+     * Sets the attribute value to use in the comparison.
+     *
+     * @param attrVal the attribute value used in comparison.
+     */
+    public void setAssertionValue( byte[] attrVal )
+    {
+        super.lockCheck(
+            "Attempt to alter attribute value of locked CompareRequest" );
+        this.attrVal = attrVal;
+    }
 
     /**
      * Gets the attribute id use in making the comparison.