[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: JLDAP Bug n fixes (ITS#1512)



This message is a follow up to my previous message because I forgot to
comment on :
>At 01:01 PM 2002-01-07, vtag@novell.com wrote:
>It certainly doesn't make sense to do something like
>  LDAPAttribute("name", new String[]  {"a", "b", null, "c"});
>This case should probably throw an exception.

> Kurt wrote:
>I would have to agree.  But,

>LDAPAttribute("mail", new String[]  {"a", "b", "", "c"});

>would be valid (IA5 strings allow empty values), null != empty.


LDAPAttribute( "name", new String[]{ "a", "b", null, "c"} );
I don't think it should throw an Exception for two reasons:
1 - It does not throw an Exception if you do (assume att was already
instantiated): att.setValue( null )//cast as a byte[] or String.

2 - It could potentially introduce a really hard to find bug in people's
code that uses the API (e.g.,migration scripts, automated scripts).

A think the solution should be to ignore null.  As far as the constructor in
the above is concerned this is what the user is saying:
new LDAPAttribute( "name", new String[]{ "a", "b", "c" } );  Additionally, I
think we should highlight this behavior in the API docs and any other
documentation regarding the use of the API this way the user knows what to
expect.

Finally I would like to make a comment about your comment on byte[][]
instead of Object[].  I used Object[] instead of byte[][] simply because I
thing Object[] is easier to read.  I remember I had a hell of a time when I
first came to Java from C/C++, trying to wrap my mind around the fact that
Java doesn't support multi-dimensional arrays and that Object[][] is an
array of data-type array (I'm cured now;).

Dane Foster
http://www.equitytg.com
954.360.9800