Program: 79232
Project: 79232
Buggy source:
/** 
 * Generates a clone copy of this element. When a report element is cloned, the basic principle is just copying the property value into the clone, the other things, like container references, child list references, listener references will not be cloned; that is, the clone is isolated from the design tree until it is added into a target design tree. <p> When inserting the cloned element into the design tree, user needs to care about the element name confliction; that is, the client needs to call the method <code>  {@link ReportDesignHandle#rename(DesignElementHandle)}</code> to change the element names.
 * @return Object the cloned design element.
 * @throws CloneNotSupportedException if clone is not supported.
 */
public Object clone() throws CloneNotSupportedException {
  DesignElement element=(DesignElement)super.clone();
  element.container=null;
  element.listeners=null;
  element.derived=null;
  element.extendsRef=null;
  element.cachedDefn=null;
  element.handle=null;
  Iterator it=propValues.keySet().iterator();
  element.propValues=new HashMap();
  while (it.hasNext()) {
    String key=(String)it.next();
    PropertyDefn propDefn=getPropertyDefn(key);
    if (propDefn.getTypeCode() == PropertyType.STRUCT_TYPE) {
      if (propDefn.isList()) {
        element.propValues.put(key,cloneStructList((ArrayList)propValues.get(key)));
      }
 else {
        element.propValues.put(key,((Structure)propValues.get(key)).copy());
      }
    }
 else     if (propDefn.getTypeCode() == PropertyType.ELEMENT_REF_TYPE) {
      ElementRefValue refValue=(ElementRefValue)propValues.get(key);
      ElementRefValue newRefValue=new ElementRefValue();
      newRefValue.unresolved(refValue.getName());
      element.propValues.put(key,newRefValue);
    }
 else     element.propValues.put(key,propValues.get(key));
  }
  if (userProperties != null) {
    element.userProperties=new HashMap();
    it=userProperties.keySet().iterator();
    while (it.hasNext()) {
      Object key=it.next();
      UserPropertyDefn uDefn=(UserPropertyDefn)userProperties.get(key);
      element.userProperties.put(key,uDefn.copy());
    }
  }
  return element;
}

Fixed version (ground truth):
/** 
 * Generates a clone copy of this element. When a report element is cloned, the basic principle is just copying the property value into the clone, the other things, like container references, child list references, listener references will not be cloned; that is, the clone is isolated from the design tree until it is added into a target design tree. <p> When inserting the cloned element into the design tree, user needs to care about the element name confliction; that is, the client needs to call the method <code>  {@link ReportDesignHandle#rename(DesignElementHandle)}</code> to change the element names.
 * @return Object the cloned design element.
 * @throws CloneNotSupportedException if clone is not supported.
 */
public Object clone() throws CloneNotSupportedException {
  DesignElement element=(DesignElement)super.clone();
  element.container=null;
  element.listeners=null;
  element.derived=null;
  element.extendsRef=null;
  element.cachedDefn=null;
  element.handle=null;
  element.id=0;
  Iterator it=propValues.keySet().iterator();
  element.propValues=new HashMap();
  while (it.hasNext()) {
    String key=(String)it.next();
    PropertyDefn propDefn=getPropertyDefn(key);
    if (propDefn.getTypeCode() == PropertyType.STRUCT_TYPE) {
      if (propDefn.isList()) {
        element.propValues.put(key,cloneStructList((ArrayList)propValues.get(key)));
      }
 else {
        element.propValues.put(key,((Structure)propValues.get(key)).copy());
      }
    }
 else     if (propDefn.getTypeCode() == PropertyType.ELEMENT_REF_TYPE) {
      ElementRefValue refValue=(ElementRefValue)propValues.get(key);
      ElementRefValue newRefValue=new ElementRefValue();
      newRefValue.unresolved(refValue.getName());
      element.propValues.put(key,newRefValue);
    }
 else     element.propValues.put(key,propValues.get(key));
  }
  if (userProperties != null) {
    element.userProperties=new HashMap();
    it=userProperties.keySet().iterator();
    while (it.hasNext()) {
      Object key=it.next();
      UserPropertyDefn uDefn=(UserPropertyDefn)userProperties.get(key);
      element.userProperties.put(key,uDefn.copy());
    }
  }
  return element;
}