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?"

I do think that the answer is : empty String (or zero length String, as specified in the RFC).

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
- "" if the DN does not hold any value.

Is it better ?

--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org


Reply via email to