[Date Prev][Date Next]
Re: Empty DN ("") String Value?
Emmanuel Lecharny wrote:
> Hallvard B Furuseth wrote:
>> Michael Ströder writes:
>>> It really depends on what you want to express. Note that "" represents
>>> the rootDSE or root naming context. So "" would reference something
>>> existing or well-defined. IMHO NULL (or None in Python) would better
>>> signal something undefined or none-existing.
>> Yes. There is one case in the LDAP ASN.1 grammar (in rfc 4511) where
>> you need to distinguish between an absent DN and an empty DN: The LDAPDN
>> field ModifyDNRequest.newSuperior, which is 'OPTIONAL'. There may be
>> others in LDAP extensions defined elsewhere.
> This is starting to be confusing. The initial question was :
> "Should the toString() method of a class that represents a DN return
> null or an empty string?"
This can't be answered consistently without knowing what this returned
value is used for. But I'll try: If you just created an object instance
of the DN class without assigning any real DN to it method toString()
should return NULL instead of "".
> But if the question is :
> "How do I represent a DN in a structure when I do a toString() on this
> structure", then the answer would be :
> - null if the DN member is null
I guess with "DN member" you're referring to the class' attribute for
storing the DN. So I guess this is the case I described above.
> - "" if the DN does not hold any value.
I doubt that this is right or maybe I misunderstood "does not hold any
Again: "" refers to the rootDSE or is the root naming context in search
requests with scope!=base. If you pass "" to any other method (e.g. for
a modify request) then it has a specific meaning (e.g. modifying the
Well, not being a Java programmer I will stay out of further discussion
because I don't know what's common in the Java world.