Closed
Bug 155207
Opened 23 years ago
Closed 7 years ago
LDAPAttrubut(LDAPAttribute attr) throws null pointer
Categories
(Directory Graveyard :: LDAP Java SDK, defect)
Directory Graveyard
LDAP Java SDK
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: hattons, Assigned: erhyuan)
Details
When an attribute exists on the sever but is empty, it causes the LDAPAttribute
valuses[] to contain a null byte[]. When such an LDAPAttribute is then passed
to the LDAPAttribute(LDAPAttribute attr) constructor it causes a null pointer
exception to be thrown.
| Reporter | ||
Comment 1•23 years ago
|
||
This seems to the the offending block of code:
public LDAPAttribute( LDAPAttribute attr ) {
name = attr.name;
nameBuf = attr.nameBuf;
values = new Object[attr.values.length];
for (int i = 0; i < attr.values.length; i++) {
// NOTICE: the attr.vlaues[i] != null is never tested before the .length is.
values[i] = new byte[((byte[])attr.values[i]).length];
System.arraycopy((byte[])attr.values[i], 0, (byte[])values[i], 0,
((byte[])attr.values[i]).length);
}
}
// this seems to be the source of the problem. We (Michael Jiang and I)
// believe the attrValues[i].getBytes("UTF8"); is returning null when the
// attribute is empty on the server.
protected void setValues( String[] attrValues ) {
Object[] vals;
if (attrValues != null) {
vals = new Object[attrValues.length];
for (int i = 0; i < vals.length; i++) {
try {
vals[i] = attrValues[i].getBytes("UTF8");
} catch(Throwable x)
{ vals[i] = new byte[0]; }
}
} else {
vals = new Object[0];
}
setValues(vals);
}
Comment 4•21 years ago
|
||
Reassign LDAP JDK bugs owned by Miodrag (miodrag@formerly-netscape.com.tld) to
E-Y (erhyuan@pacbell.net)
Assignee: miodrag → erhyuan
Comment 5•7 years ago
|
||
Not activity for at least 6 years, closing.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•