directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r348433 - /directory/shared/ldap/trunk/apache2-provider/src/main/java/org/apache/asn1new/ldap/pojo/Control.java
Date Wed, 23 Nov 2005 13:22:50 GMT
Author: elecharny
Date: Wed Nov 23 05:22:46 2005
New Revision: 348433

URL: http://svn.apache.org/viewcvs?rev=348433&view=rev
Log:
- Changed the controlType from OID to LdapString, as suggested 
by Van Nhu
- fixed the toString() method, which now return a Value which is not a pointer

Modified:
    directory/shared/ldap/trunk/apache2-provider/src/main/java/org/apache/asn1new/ldap/pojo/Control.java

Modified: directory/shared/ldap/trunk/apache2-provider/src/main/java/org/apache/asn1new/ldap/pojo/Control.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/apache2-provider/src/main/java/org/apache/asn1new/ldap/pojo/Control.java?rev=348433&r1=348432&r2=348433&view=diff
==============================================================================
--- directory/shared/ldap/trunk/apache2-provider/src/main/java/org/apache/asn1new/ldap/pojo/Control.java
(original)
+++ directory/shared/ldap/trunk/apache2-provider/src/main/java/org/apache/asn1new/ldap/pojo/Control.java
Wed Nov 23 05:22:46 2005
@@ -24,7 +24,7 @@
 import org.apache.asn1new.ber.tlv.Length;
 import org.apache.asn1new.ber.tlv.UniversalTag;
 import org.apache.asn1new.ber.tlv.Value;
-import org.apache.asn1new.primitives.OID;
+import org.apache.asn1new.ldap.codec.primitives.LdapString;
 import org.apache.asn1.codec.util.StringUtils;
 
 
@@ -38,7 +38,7 @@
     //~ Instance fields ----------------------------------------------------------------------------
 
     /** The control type */
-    private OID controlType;
+    private LdapString controlType;
 
     /** The criticality (default value is false) */
     private boolean criticality = false;
@@ -68,7 +68,7 @@
      *
      * @param controlType An OID to store
      */
-    public void setControlType( OID controlType )
+    public void setControlType( LdapString controlType )
     {
         this.controlType = controlType;
     }
@@ -143,7 +143,7 @@
     public int computeLength()
     {
         // The controlType
-        int controlTypeLengh = controlType.getOIDLength();
+        int controlTypeLengh = controlType.getNbBytes();
         controlLength = 1 + Length.getNbBytes( controlTypeLengh ) + controlTypeLengh;  
         
         // The criticality, only if true
@@ -190,7 +190,7 @@
         }
             
         // The control type
-        Value.encode( buffer, controlType );
+        Value.encode( buffer, controlType.getBytes() );
 
         // The control criticality, if true
         if ( criticality == true )
@@ -220,7 +220,15 @@
         
         if ( controlValue != null ) 
         {
-            sb.append("        Control value : '").append(controlValue.toString()).append("'\n");
+        	if ( controlValue instanceof String )
+        	{
+                sb.append("        Control value : '").append( controlValue ).append("'\n");
+        	}
+        	else
+        	{
+                sb.append("        Control value : '").append( StringUtils.dumpBytes( (byte[])controlValue
) ).append("'\n");
+        	}
+        	
         }
         
         return sb.toString();



Mime
View raw message