directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1596697 - /directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DnUtils.java
Date Wed, 21 May 2014 21:26:11 GMT
Author: seelmann
Date: Wed May 21 21:26:10 2014
New Revision: 1596697

URL: http://svn.apache.org/r1596697
Log:
DIRSTUDIO-963 and DIRSTUDIO-938: Don't escape unicode characters in RDN value

Modified:
    directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DnUtils.java

Modified: directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DnUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DnUtils.java?rev=1596697&r1=1596696&r2=1596697&view=diff
==============================================================================
--- directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DnUtils.java
(original)
+++ directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DnUtils.java
Wed May 21 21:26:10 2014
@@ -23,6 +23,7 @@ package org.apache.directory.studio.conn
 import javax.naming.InvalidNameException;
 
 import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
+import org.apache.directory.api.ldap.model.name.Ava;
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.api.ldap.model.name.Rdn;
 
@@ -76,33 +77,20 @@ public class DnUtils
      */
     public static Rdn composeRdn( String[] rdnTypes, String[] rdnValues ) throws InvalidNameException
     {
-        StringBuffer sb = new StringBuffer();
-        for ( int i = 0; i < rdnTypes.length; i++ )
-        {
-            if ( i > 0 )
-            {
-                sb.append( '+' );
-            }
-
-            sb.append( rdnTypes[i] );
-            sb.append( '=' );
-            sb.append( Rdn.escapeValue( rdnValues[i] ) );
-        }
-
-        String s = sb.toString();
         try
         {
-            if ( Dn.isValid( s ) )
+            Ava[] avas = new Ava[rdnTypes.length];
+            for ( int i = 0; i < rdnTypes.length; i++ )
             {
-                Rdn rdn = new Rdn( sb.toString() );
-                return rdn;
+                avas[i] = new Ava( rdnTypes[i], rdnValues[i] );
             }
+            Rdn rdn = new Rdn( avas );
+            return rdn;
         }
-        catch ( Exception e )
+        catch ( LdapInvalidDnException e1 )
         {
+            throw new InvalidNameException( Messages.error__invalid_rdn );
         }
-
-        throw new InvalidNameException( Messages.error__invalid_rdn );
     }
 
 }



Mime
View raw message