You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Emmanuel Lecharny <el...@gmail.com> on 2008/10/02 15:32:41 UTC

Ldap.toString() returning a Normalized DN is an error...

Hi guys,

I'm realizing that the LdapDN.toString() method returning a normalized 
DN was a truly bad idea. It's used all over the code, for instance to 
generate error messages, and this is obfuscating them.

It would be way better if the toString() method returns the user 
provided DN so that the semantic of this method is kept. All in all, the 
toString() method is supposed to return something whichj is readable by 
human beings, when 1.3.6.1.4.1.18060.0.4.0.2.1=test is not :)

So what about replacing the current implementation to return the UP name 
instead of the Normname ?

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



Re: Ldap.toString() returning a Normalized DN is an error...

Posted by Norval Hope <nr...@gmail.com>.
Thanks, raised DIRSERVER-1274.

On Fri, Oct 3, 2008 at 6:39 PM, Emmanuel Lecharny <el...@gmail.com> wrote:
> Norval Hope wrote:
>>
>> Hi Emmanuel,
>>
>> 1++
>>
>> This was definitely a pain in some of my code that needed to deal with
>> both JNDI Names and LdapDN's but couldn't deal with them
>> interchangeably, as in the LdapDN case the toString() result was, as
>> you say, pretty useless from most purposes.
>>
>
> Yeah, I don't understand why I implemented the toString() methiod this way,
> and stick with it for 2 years ... Sometime you have to step back and look at
> the code from some distance to understand that something is wrong...
>>
>> As it happens Pierre-Arnaud and I exchanged an email about whether
>> this behaviour was still the case inf 1.5.4 a few weeks back. I have
>> some really dim-distant memory of discussing this with you a long time
>> ago too - am I mistaken, or did you start a round of tidying this up
>> once before?
>>
>
> Not exactly. I initially started to implement the Paged Search Control,
> needed to fix some code in the LdapProtocolHandlers to inject this control,
> discussed about the way Referrals where handled and how we should change it
> to make it easier to implement the control, and then found that dealing with
> LdapURL where some DN with spaces are not exactly handled the best way
> because we are using the toString() method made me thing that the toString()
> method has to be changed.
>
> Sometime you better not pull some strings :)
>
> (btw, I still have to fix the typo you mailed me, but you'd better create a
> JIRA, because it's buried in my mail stack ...)
>
> --
> --
> cordialement, regards,
> Emmanuel Lécharny
> www.iktek.com
> directory.apache.org
>
>
>

Re: Ldap.toString() returning a Normalized DN is an error...

Posted by Emmanuel Lecharny <el...@gmail.com>.
Norval Hope wrote:
> Hi Emmanuel,
>
> 1++
>
> This was definitely a pain in some of my code that needed to deal with
> both JNDI Names and LdapDN's but couldn't deal with them
> interchangeably, as in the LdapDN case the toString() result was, as
> you say, pretty useless from most purposes.
>   
Yeah, I don't understand why I implemented the toString() methiod this 
way, and stick with it for 2 years ... Sometime you have to step back 
and look at the code from some distance to understand that something is 
wrong...
> As it happens Pierre-Arnaud and I exchanged an email about whether
> this behaviour was still the case inf 1.5.4 a few weeks back. I have
> some really dim-distant memory of discussing this with you a long time
> ago too - am I mistaken, or did you start a round of tidying this up
> once before?
>   
Not exactly. I initially started to implement the Paged Search Control, 
needed to fix some code in the LdapProtocolHandlers to inject this 
control, discussed about the way Referrals where handled and how we 
should change it to make it easier to implement the control, and then 
found that dealing with LdapURL where some DN with spaces are not 
exactly handled the best way because we are using the toString() method 
made me thing that the toString() method has to be changed.

Sometime you better not pull some strings :)

(btw, I still have to fix the typo you mailed me, but you'd better 
create a JIRA, because it's buried in my mail stack ...)

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



Re: Ldap.toString() returning a Normalized DN is an error...

Posted by Norval Hope <nr...@gmail.com>.
Hi Emmanuel,

1++

This was definitely a pain in some of my code that needed to deal with
both JNDI Names and LdapDN's but couldn't deal with them
interchangeably, as in the LdapDN case the toString() result was, as
you say, pretty useless from most purposes.

As it happens Pierre-Arnaud and I exchanged an email about whether
this behaviour was still the case inf 1.5.4 a few weeks back. I have
some really dim-distant memory of discussing this with you a long time
ago too - am I mistaken, or did you start a round of tidying this up
once before?

Thanks!

On Thu, Oct 2, 2008 at 11:32 PM, Emmanuel Lecharny <el...@gmail.com> wrote:
> Hi guys,
>
> I'm realizing that the LdapDN.toString() method returning a normalized DN
> was a truly bad idea. It's used all over the code, for instance to generate
> error messages, and this is obfuscating them.
>
> It would be way better if the toString() method returns the user provided DN
> so that the semantic of this method is kept. All in all, the toString()
> method is supposed to return something whichj is readable by human beings,
> when 1.3.6.1.4.1.18060.0.4.0.2.1=test is not :)
>
> So what about replacing the current implementation to return the UP name
> instead of the Normname ?
>
> --
> --
> cordialement, regards,
> Emmanuel Lécharny
> www.iktek.com
> directory.apache.org
>
>
>

Re: Ldap.toString() returning a Normalized DN is an error...

Posted by Alex Karasulu <ak...@apache.org>.
+1

Yep sounds better.  I never used toString() to get the NDN; I preferred
using the explicit accessor getNormName().

Alex

On Thu, Oct 2, 2008 at 9:37 AM, Pierre-Arnaud Marcelot <pa...@marcelot.net>wrote:

> Hi Emmanuel,
>
> On Thu, Oct 2, 2008 at 3:32 PM, Emmanuel Lecharny <el...@gmail.com>wrote:
>
>> Hi guys,
>>
>> I'm realizing that the LdapDN.toString() method returning a normalized DN
>> was a truly bad idea. It's used all over the code, for instance to generate
>> error messages, and this is obfuscating them.
>>
>> It would be way better if the toString() method returns the user provided
>> DN so that the semantic of this method is kept. All in all, the toString()
>> method is supposed to return something whichj is readable by human beings,
>> when 1.3.6.1.4.1.18060.0.4.0.2.1=test is not :)
>>
>> So what about replacing the current implementation to return the UP name
>> instead of the Normname ?
>
>
> I think it makes sense.
> +1
>
> Regards,
> Pierre-Arnaud
>
>

Re: Ldap.toString() returning a Normalized DN is an error...

Posted by Pierre-Arnaud Marcelot <pa...@marcelot.net>.
Hi Emmanuel,

On Thu, Oct 2, 2008 at 3:32 PM, Emmanuel Lecharny <el...@gmail.com>wrote:

> Hi guys,
>
> I'm realizing that the LdapDN.toString() method returning a normalized DN
> was a truly bad idea. It's used all over the code, for instance to generate
> error messages, and this is obfuscating them.
>
> It would be way better if the toString() method returns the user provided
> DN so that the semantic of this method is kept. All in all, the toString()
> method is supposed to return something whichj is readable by human beings,
> when 1.3.6.1.4.1.18060.0.4.0.2.1=test is not :)
>
> So what about replacing the current implementation to return the UP name
> instead of the Normname ?


I think it makes sense.
+1

Regards,
Pierre-Arnaud