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/01/03 02:41:48 UTC

svn commit: r365512 - in /directory/trunk/ldap-common/src/main/java/org/apache/asn1new/ldap: codec/grammar/ModifyRequestGrammar.java pojo/ModifyRequest.java

Author: elecharny
Date: Mon Jan  2 17:41:43 2006
New Revision: 365512

URL: http://svn.apache.org/viewcvs?rev=365512&view=rev
Log:
Attribute Values are now tested for thier 'binary' property
before being stored in the ModifcationItems.

Modified:
    directory/trunk/ldap-common/src/main/java/org/apache/asn1new/ldap/codec/grammar/ModifyRequestGrammar.java
    directory/trunk/ldap-common/src/main/java/org/apache/asn1new/ldap/pojo/ModifyRequest.java

Modified: directory/trunk/ldap-common/src/main/java/org/apache/asn1new/ldap/codec/grammar/ModifyRequestGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunk/ldap-common/src/main/java/org/apache/asn1new/ldap/codec/grammar/ModifyRequestGrammar.java?rev=365512&r1=365511&r2=365512&view=diff
==============================================================================
--- directory/trunk/ldap-common/src/main/java/org/apache/asn1new/ldap/codec/grammar/ModifyRequestGrammar.java (original)
+++ directory/trunk/ldap-common/src/main/java/org/apache/asn1new/ldap/codec/grammar/ModifyRequestGrammar.java Mon Jan  2 17:41:43 2006
@@ -451,12 +451,20 @@
                         
                         if ( tlv.getLength().getLength() == 0 )
                         {
-                            modifyRequest.addAttributeValue( value );
+                            modifyRequest.addAttributeValue( "" );
                         }
                         else
                         {
                             value = tlv.getValue().getData();
-                            modifyRequest.addAttributeValue( value );
+                            
+                            if ( ldapMessageContainer.isBinary( modifyRequest.getCurrentAttributeType() ) )
+                            {
+	                            modifyRequest.addAttributeValue( value );
+                            }
+					        else
+					        {
+                                modifyRequest.addAttributeValue( StringTools.utf8ToString( (byte[])value ) );
+					        }
                         }
                         
                         if ( log.isDebugEnabled() )

Modified: directory/trunk/ldap-common/src/main/java/org/apache/asn1new/ldap/pojo/ModifyRequest.java
URL: http://svn.apache.org/viewcvs/directory/trunk/ldap-common/src/main/java/org/apache/asn1new/ldap/pojo/ModifyRequest.java?rev=365512&r1=365511&r2=365512&view=diff
==============================================================================
--- directory/trunk/ldap-common/src/main/java/org/apache/asn1new/ldap/pojo/ModifyRequest.java (original)
+++ directory/trunk/ldap-common/src/main/java/org/apache/asn1new/ldap/pojo/ModifyRequest.java Mon Jan  2 17:41:43 2006
@@ -194,6 +194,16 @@
     }
 
     /**
+     * Return the current attribute's type
+     * 
+     * @param value The current attribute's type
+     */
+    public String getCurrentAttributeType()
+    {
+        return currentAttribute.getID();
+    }
+
+    /**
      * Get the modification's DN
      * 
      * @return Returns the object.
@@ -550,11 +560,11 @@
                         
                         if ( attributeValue instanceof String )
                         {
-                            sb.append( StringTools.utf8ToString( (byte[])attributeValue ) ).append( "' \n" );
+                            sb.append( attributeValue ).append( "' \n" );
                         }
                         else
                         {
-                            sb.append( attributeValue ).append( "' \n" );
+                            sb.append( StringTools.utf8ToString( (byte[])attributeValue ) ).append( "' \n" );
                         }
                     }
                 }