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

(ITS#4335) LDAPAttributeSet.clone is not complete

Full_Name: Willem Jan
Version: JLDAP 1.47
OS: Windows XP
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (

I just found a problem in the cloning of an LDAPAttributeSet object.

the clone method does not clone the Map in which the attributes are stored. So
when the cloned attributes are stored, they are stored in a shared Map!

     * Returns a deep copy of this attribute set.
     * @return A deep copy of this attribute set.
    public Object clone()
        try {
            Object newObj = super.clone();
--- this line is missing ---> newObj.map = new HashMap();
            Iterator i = this.iterator();
            while (i.hasNext()){
            return newObj;
        } catch( CloneNotSupportedException ce) {
            throw new RuntimeException("Internal error, cannot create clone");