Subject: byte[] v String and related comments (WG last call on the Java API)

From: "Kurt D. Zeilenga" <[email-masked]>
Date: Sat, 10 Mar 2001 19:04:58 -0800

The API appears to provide similiar methods for both
String and byte[] arguments, depending on if the
caller knows the returned value is UTF-8, hence
convertible to UCS-2 String, or rather just deal
with raw octetStrings.  However, I note that there
are cases where there methods supporting String[]
arguments, but not byte[][] arguments.

For example, there are:
  public LDAPAttribute(String attrName, byte[] attrBytes)
  public LDAPAttribute(String attrName, String attrString)
  public LDAPAttribute(String attrName, String[] attrStrings)

but there is no method support byte[][].

Also, I believe LDAPAttribute(String attrName) description
should contain a comment that an attribute with no value
can not be transferred by the protocol and any attempt to
do so should cause an API error.]

Kurt

---

From: Rob Weltman <[email-masked]>
Date: Mon, 12 Mar 2001 21:25:11 -0800

> but there is no method support byte[][].

  It's a little awkward dealing with byte[] in arrays in Java because they are not objects (don't extend Object) as String and Java objects do. Leaving out byte[][] methods was a reflection on usefulness. Is there a reason other than symmetry to include them?

> do so should cause an API error.]

  Is it not legal to pass an attribute with no value in a modification (to remove all values of the attribute)?

Rob

---

From: "Kurt D. Zeilenga" <[email-masked]>
Date: Mon, 12 Mar 2001 22:32:11 -0800

>  It's a little awkward dealing with byte[] in arrays in Java because they are not objects (don't extend Object) as String and Java objects do. Leaving out byte[][] methods was a reflection on usefu…

Not that I have.  You're rational for not providing them seems
reasonable.

>  Is it not legal to pass an attribute with no value in a modification (to remove all values of the attribute)?

If you use Modify/Replace, yes, there may be no values.
I was thinking in terms of Modify/Add which require
that there be at least one value.  Restated, my concern
is that API implementations could knowingly send invalid
PDUs and this seems inappropriate.

Kurt

---

From: "Kurt D. Zeilenga" <[email-masked]>
Date: Thu, 15 Mar 2001 15:26:01 -0800

The 9.1 example code seems to use getStringValues() without
a care in world to whether or not the values are compatible
with this method.  I think a statement of the limited
applicability of this and other String-typed value access
methods should made, something like:
	Applications should not use methods returning values
	in String form unless those values are known restricted
       to UTF-8.  Applications should not assume an attribute,
	regardless of its syntax, is returned in string form
	as the server is free to return any attribute using
       ;binary transfer.

BTW, what's the behavior of getStringValues() if the character
is not UTF-8?