Apache Directory Project - [Boolean Valued Attributes] Should Java's "true" work?

This is Interesting: Free IT Magazines  
Home > Archive > Apache Directory Project > June 2007 > [Boolean Valued Attributes] Should Java's "true" work?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author [Boolean Valued Attributes] Should Java's "true" work?
Ole Ersoy

2007-06-22, 7:11 pm

Hey Guys,

I tried to create an entry containing an attribute like this:

attributes.put("someBooleanTypeAttributeName", true);

And got an exception (Noted in most recent JIRA filed). Should that work?

Thanks,
- Ole



Emmanuel Lecharny

2007-06-22, 7:11 pm

No, it won't work, I guess.

You sould store an object into your attribute, like Boolean.TRUE.

Be aware that your attribute syntax must also allow you to use booleans val=
ues.

On 6/22/07, Ole Ersoy <ole.ersoy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hey Guys,
>
> I tried to create an entry containing an attribute like this:
>
> attributes.put("someBooleanTypeAttributeName", true);
>
> And got an exception (Noted in most recent JIRA filed). Should that work=

?
>
> Thanks,
> - Ole
>
>
>



--=20
Regards,
Cordialement,
Emmanuel L=E9charny
www.iktek.com

Ole Ersoy

2007-06-22, 7:11 pm

I did use the Boolean syntax for the entry and I just tried it with Boolean.TRUE as the value. I still get this exception:

javax.naming.NamingException: The value stored in an Human Readible attribute is not a String
at org.apache.directory.server.core.schema.SchemaService.assertHumanReadible(SchemaService.java:1965)

When I do this:
System.out.println(true); ... It prints "true", so I imagine that "true" is what is sent over the wire to ADS. Seems like this should be an OK value?

Thoughts?

Thanks,
- Ole


Emmanuel Lecharny wrote:
> No, it won't work, I guess.
>
> You sould store an object into your attribute, like Boolean.TRUE.
>
> Be aware that your attribute syntax must also allow you to use booleans
> values.
>
> On 6/22/07, Ole Ersoy <ole.ersoy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>


Emmanuel Lecharny

2007-06-22, 7:11 pm

System.out.println( true ) will *always print "true"/

Ok, which attributeType are you using ? It seems that it might be an
H/R attribute, so in tis case, you must do :
attributes.put( "yourHRattribute", Boolean.TRUE.toString() );

Btw, you might want to svn up : I have fixed the readible typo.

On 6/22/07, Ole Ersoy <ole.ersoy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> I did use the Boolean syntax for the entry and I just tried it with Boole=

an.TRUE as the value. I still get this exception:
>
> javax.naming.NamingException: The value stored in an Human Readible attri=

bute is not a String
> at org.apache.directory.server.core.schema.SchemaService.assertHu=

manReadible(SchemaService.java:1965)
>
> When I do this:
> System.out.println(true); ... It prints "true", so I imagine that "true"=

is what is sent over the wire to ADS. Seems like this should be an OK val=
ue?
>
> Thoughts?
>
> Thanks,
> - Ole
>
>
> Emmanuel Lecharny wrote:
>



--=20
Regards,
Cordialement,
Emmanuel L=E9charny
www.iktek.com

Ole Ersoy

2007-06-22, 7:11 pm



Emmanuel Lecharny wrote:
> System.out.println( true ) will *always print "true"/
>
> Ok, which attributeType are you using ? It seems that it might be an
> H/R attribute, so in tis case, you must do :
> attributes.put( "yourHRattribute", Boolean.TRUE.toString() );


Hmmm - now that you mention it, it's a custom attributeType entry. Maybe when adding AttributeType entries that have the Boolean syntax I should set human readable attribute to false. I'll give it a shot.

>
> Btw, you might want to svn up : I have fixed the readible typo.
>

Terrific - Thanks!
- Ole

SNIP

Martin Alderson

2007-06-22, 7:11 pm

Ole Ersoy wrote:
> Emmanuel Lecharny wrote:
>
> Hmmm - now that you mention it, it's a custom attributeType entry.
> Maybe when adding AttributeType entries that have the Boolean syntax I
> should set human readable attribute to false. I'll give it a shot.


I think that would have to be attributes.put( "yourHRattribute",
Boolean.TRUE.toString().toUpperCase() ); too.

Martin

Emmanuel Lecharny

2007-06-22, 7:11 pm

Oh, very TRUE, Martin.

The syntax checker will throw an exception if you inject 'true' or 'false'.

This is compliant with the RFC...

Thanks Martin !

On 6/23/07, Martin Alderson <martin.alderson-OEzMonE/5tgd9SLi6J12Iip2UmYkHbXO@public.gmane.org> wrote:
> Ole Ersoy wrote:
>
> I think that would have to be attributes.put( "yourHRattribute",
> Boolean.TRUE.toString().toUpperCase() ); too.
>
> Martin
>



--=20
Regards,
Cordialement,
Emmanuel L=E9charny
www.iktek.com

Ole Ersoy

2007-06-22, 7:11 pm

Super - Thanks Martin and Emmanuel! Have a terrific weekend,
- Ole



Emmanuel Lecharny wrote:
> Oh, very TRUE, Martin.
>
> The syntax checker will throw an exception if you inject 'true' or 'false'.
>
> This is compliant with the RFC...
>
> Thanks Martin !
>
> On 6/23/07, Martin Alderson <martin.alderson-OEzMonE/5tgd9SLi6J12Iip2UmYkHbXO@public.gmane.org> wrote:
>
>


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com