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

Re: LDAPAttributeSet.iterator() returns iterator of com.novell.ldap.LDAPAttribute, not org.ietf.ldap.LDA (ITS#2690)

  Thanks for bringing this to our attention.The bug is fixed now and 
is checked in . Can you colse the ITS please.


>>> <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) (

The org.ietf.ldap.LDAPAttributeSet class includes the following code:

     * Returns an iterator over the elements of this set.
     * @see <a
    public Iterator iterator()
        return attrSet.iterator( );

This will return an iteration of com.novell.ldap.LDAPAttribute
However, it should return an iteration of org.ietf.ldap.LDAPAttribute

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);