directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Norval Hope" <>
Subject Current Rdn/LdapDN behaviour
Date Tue, 12 Dec 2006 23:29:44 GMT
Firstly let me apologise for going silent of late: combination of
having to support an alpha release and some personal tragedies. I
still intend to write the VD schema related blurb I promised in the
next couple of weeks...

I have a question regarding what to me seems to be a problem with
Rdn.tostring() and LdapDN.toString(), in that when quoted text is
passed in they return text which is no longer quoted. This is
problematic for me as there are cases in my code where I'm dealing
with either a Sun LdapName or an LdapDN and I expect just to be able
to do a toString() and end up with a valid DN.

Here is an example of what I mean:



import javax.naming.ldap.LdapName;
import javax.naming.InvalidNameException;

public class LdapNameTest
    public static void main(String[] args)
            LdapName        name = new LdapName("ou=a\\,comma,o=acme");
            LdapDN          dn = new LdapDN("oU=a\\,comma,O=acme");

            System.out.println("name='" + name.toString() + '\'');
            System.out.println("dn='" + dn.toString() + '\'');
            System.out.println("dn(up)='" + dn.getUpName() + '\'');
        catch (InvalidNameException e)
which produces this output


Now, I would have expected that LdapDN.toString() would have
guaranteed that code like this would work (even though some
information about the exact case of some characters in the original DN
would be lost):

   LdapDN mydn = new LdapDN(new LdapDN("oU=a\\,comma,O=acme").toString());

but as things stand this code would fail with a parsing exception
because the '\' has been thrown away. Hence only the .getUpName() call
returns a valid DN string.
I would have expected dn= to be as follows above:


where the attribute names have been normalized but we still have a
valid DN string.

Am I missing something here, or should I open a JIRA about this?


View raw message