[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: LDAPAttributeSet.iterator() returns iterator of com.novell.ldap.LDAPAttribute, not org.ietf.ldap.LDA (ITS#2690)
- To: openldap-its@OpenLDAP.org
- Subject: Re: LDAPAttributeSet.iterator() returns iterator of com.novell.ldap.LDAPAttribute, not org.ietf.ldap.LDA (ITS#2690)
- From: Sunilk@novell.com
- Date: Thu, 21 Aug 2003 03:19:15 GMT
Hi,
Thanks for bringing this to our attention.The bug is fixed now and
is checked in . Can you colse the ITS please.
-Sunil
>>> <gelgey@wedgetail.com> 8/5/2003 6:54:21 AM >>>
Full_Name: Geoffrey Elgey
Version: JLDAP
OS: Linux
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (202.83.95.124)
The org.ietf.ldap.LDAPAttributeSet class includes the following code:
/**
* Returns an iterator over the elements of this set.
*
* @see <a
href="../../../../doc/com/novell/ldap/LDAPAttributeSet.html
#iterator()">
com.novell.ldap.LDAPAttributeSet.iterator()</a>
*/
public Iterator iterator()
{
return attrSet.iterator( );
}
This will return an iteration of com.novell.ldap.LDAPAttribute
instances.
However, it should return an iteration of org.ietf.ldap.LDAPAttribute
instances.
One solution is as follows:
public Iterator iterator() {
return new WrappedIterator(this.attrSet.iterator());
}
/**
* An iterator that creates org.ietf.ldap.LDAPAttribute instances
* from an iterator of com.novell.ldap.LDAPAttribute instances.
*/
private static final class WrappedIterator implements Iterator {
// Iterator containing com.novell.ldap.LDAPAttribute instances.
private final Iterator iterator;
WrappedIterator(final Iterator iterator) {
this.iterator = iterator;
}
public boolean hasNext() {
return this.iterator.hasNext();
}
public Object next() {
com.novell.ldap.LDAPAttribute attr =
(com.novell.ldap.LDAPAttribute) this.iterator.next();
return new LDAPAttribute(attr);
}
};