directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r895633 - /directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
Date Mon, 04 Jan 2010 14:20:25 GMT
Author: seelmann
Date: Mon Jan  4 14:20:24 2010
New Revision: 895633

URL: http://svn.apache.org/viewvc?rev=895633&view=rev
Log:
Fixed the rename operation, Values in DN are already unescaped

Modified:
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java?rev=895633&r1=895632&r2=895633&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
Mon Jan  4 14:20:24 2010
@@ -45,6 +45,7 @@
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.partition.DefaultPartitionNexus;
 import org.apache.directory.shared.ldap.cursor.EmptyCursor;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.name.AVA;
@@ -358,8 +359,8 @@
         // Loop on all the AVAs
         for ( AVA ava : rdn )
         {
-            String value = ava.getNormValue().getString();
-            String upValue = ava.getUpValue().getString();
+            Value<?> value = ava.getNormValue();
+            Value<?> upValue = ava.getUpValue();
             String upId = ava.getUpType();
 
             // Check that the entry contains this AVA
@@ -373,7 +374,7 @@
                 // 1) The attribute does not exist
                 if ( !entry.containsAttribute( upId ) )
                 {
-                    addUnescapedUpValue( entry, upId, upValue );
+                    entry.add( upId, upValue );
                 }
                 // 2) The attribute exists
                 else
@@ -384,39 +385,16 @@
                     if ( at.isSingleValued() )
                     {
                         entry.removeAttributes( upId );
-                        addUnescapedUpValue( entry, upId, upValue );
+                        entry.add( upId, upValue );
                     }
                     // 2.2 the attribute is multi-valued : add the missing value
                     else
                     {
-                        addUnescapedUpValue( entry, upId, upValue );
+                        entry.add( upId, upValue );
                     }
                 }
             }
         }
     }
 
-
-    /**
-     * Adds the user provided value to the given entry.
-     * If the user provided value is string value it is unescaped first. 
-     * If the user provided value is a hex string the value is added as byte[].
-     *
-     * @param entry the entry
-     * @param upId the user provided attribute type to add
-     * @param upValue the user provided value to add
-     */
-    private void addUnescapedUpValue( ServerEntry entry, String upId, String upValue ) throws
Exception
-    {
-        Object unescapedUpValue = Rdn.unescapeValue( upValue );
-
-        if ( unescapedUpValue instanceof String )
-        {
-            entry.add( upId, ( String ) unescapedUpValue );
-        }
-        else
-        {
-            entry.add( upId, ( byte[] ) unescapedUpValue );
-        }
-    }
 }



Mime
View raw message