Closed Bug 155207 Opened 23 years ago Closed 7 years ago

LDAPAttrubut(LDAPAttribute attr) throws null pointer

Categories

(Directory Graveyard :: LDAP Java SDK, defect)

defect
Not set
major

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.
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); }
Reassigned to Miodrag.
Assignee: mcs → miodrag
Spam for bug 129472
QA Contact: nobody → nobody
Reassign LDAP JDK bugs owned by Miodrag (miodrag@formerly-netscape.com.tld) to E-Y (erhyuan@pacbell.net)
Assignee: miodrag → erhyuan
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.