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 2006/09/09 02:59:23 UTC

svn commit: r441714 - /directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/ConcreteControl.java

Author: elecharny
Date: Fri Sep  8 17:59:22 2006
New Revision: 441714

URL: http://svn.apache.org/viewvc?view=rev&rev=441714
Log:
The encodedValue is now a byte[], nothing else.

Modified:
    directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/ConcreteControl.java

Modified: directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/ConcreteControl.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/ConcreteControl.java?view=diff&rev=441714&r1=441713&r2=441714
==============================================================================
--- directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/ConcreteControl.java (original)
+++ directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/ConcreteControl.java Fri Sep  8 17:59:22 2006
@@ -48,13 +48,7 @@
     private boolean criticality = false;
 
     /** Optionnal control value */
-    private Object controlValue;
-
-    /** Optionnal control value in encoded form */
-    private byte[] encodedValue;
-
-    // ~ Methods
-    // ------------------------------------------------------------------------------------
+    private byte[] controlValue;
 
     /**
      * Get the control type
@@ -70,8 +64,7 @@
     /**
      * Set the control type
      * 
-     * @param controlType
-     *            An OID to store
+     * @param controlType An OID to store
      */
     public void setControlType( String controlType )
     {
@@ -84,58 +77,40 @@
      * 
      * @return The control value
      */
-    public byte[] getControlValue()
+    public byte[] getEncodedValue()
     {
         if ( controlValue == null )
         {
-            return StringTools.EMPTY_BYTES;
+            return null;
         }
-        else if ( controlValue instanceof String )
-        {
-            return StringTools.getBytesUtf8( ( String ) controlValue );
-        }
-        else
-        {
+        else {
             return (byte[])controlValue;
         }
     }
 
-
     /**
-     * Set the encoded control value
-     * 
-     * @param encodedValue
-     *            The encoded control value to store
-     */
-    public void setEncodedValue( byte[] encodedValue )
-    {
-        this.encodedValue = encodedValue;
-    }
-
-
-    /**
-     * Get the raw control encoded bytes
+     * Get the control value
      * 
-     * @return the encoded bytes for the control
+     * @return The control value
      */
-    public byte[] getEncodedValue()
+    public byte[] getControlValue()
     {
-        if ( encodedValue == null )
+        if ( controlValue == null )
         {
-            return StringTools.EMPTY_BYTES;
+            return null;
+        }
+        else {
+            return (byte[])controlValue;
         }
-
-        return encodedValue;
     }
 
-
     /**
      * Set the control value
      * 
      * @param controlValue
      *            The control value to store
      */
-    public void setControlValue( Object controlValue )
+    public void setControlValue( byte[] controlValue )
     {
         this.controlValue = controlValue;
     }
@@ -170,8 +145,8 @@
     {
         StringBuffer sb = new StringBuffer();
 
-        sb.append( "    ConcreteControl\n" );
-        sb.append( "        ConcreteControl type : '" ).append( controlType != null ? controlType.toString() : "null" ).append(
+        sb.append( "    Control\n" );
+        sb.append( "        Control type : '" ).append( controlType != null ? controlType.toString() : "null" ).append(
             "'\n" );
         sb.append( "        Criticality : '" ).append( criticality ).append( "'\n" );
 
@@ -179,16 +154,15 @@
         {
             if ( controlValue instanceof byte[] )
             {
-                sb.append( "        ConcreteControl value : '" ).append( StringTools.dumpBytes( ( byte[] ) controlValue ) )
+                sb.append( "        Control value : '" ).append( StringTools.dumpBytes( ( byte[] ) controlValue ) )
                     .append( "'\n" );
             }
             else
             {
-                sb.append( "        ConcreteControl value : '" ).append( controlValue ).append( "'\n" );
+                sb.append( "        Control value : '" ).append( controlValue ).append( "'\n" );
             }
         }
 
         return sb.toString();
     }
-
 }