Program: 66806
Project: 66806
Buggy source:
/** 
 * INTERNAL: Store a set of attribute mappings on the given ClassDetails that correspont to the given class. Return the list of mappings that is not specifically found on the given class.  These attributes will  be found on MappedSuperclasses.
 */
protected List storeAttributeMappings(MetadataClass metadataClass,ClassDetails classDetails,List mappings,boolean weaveValueHolders){
  List unMappedAttributes=new ArrayList();
  Map<String,AttributeDetails> attributesMap=new HashMap<String,AttributeDetails>();
  Map<String,AttributeDetails> settersMap=new HashMap<String,AttributeDetails>();
  Map<String,AttributeDetails> gettersMap=new HashMap<String,AttributeDetails>();
  List lazyMappings=new ArrayList();
  for (Iterator iterator=mappings.iterator(); iterator.hasNext(); ) {
    DatabaseMapping mapping=(DatabaseMapping)iterator.next();
    String attribute=mapping.getAttributeName();
    AttributeDetails attributeDetails=new AttributeDetails(attribute,mapping);
    MetadataClass typeClass=getAttributeTypeFromClass(metadataClass,attribute,mapping,false);
    if (typeClass == null) {
      attributeDetails.setAttributeOnSuperClass(true);
      unMappedAttributes.add(mapping);
    }
    if (mapping.getGetMethodName() != null) {
      gettersMap.put(mapping.getGetMethodName(),attributeDetails);
      attributeDetails.setGetterMethodName(mapping.getGetMethodName());
      if (mapping.getSetMethodName() != null) {
        settersMap.put(mapping.getSetMethodName(),attributeDetails);
        attributeDetails.setSetterMethodName(mapping.getSetMethodName());
      }
      if (mapping.isForeignReferenceMapping() && ((ForeignReferenceMapping)mapping).requiresTransientWeavedFields()) {
        attributeDetails.setWeaveTransientFieldValueHolders();
      }
      if (this.weaveInternal) {
        attributeDetails.setHasField(hasFieldInClass(metadataClass,attribute));
      }
    }
 else {
      attributeDetails.setHasField(true);
    }
    if (attributeDetails.hasField()) {
      attributeDetails.setDeclaringType(Type.getType(getAttributeDeclaringClass(metadataClass,attribute).getTypeName()));
    }
    if (mapping.isForeignReferenceMapping()) {
      ForeignReferenceMapping foreignReferenceMapping=(ForeignReferenceMapping)mapping;
      attributeDetails.setReferenceClassName(foreignReferenceMapping.getReferenceClassName());
      if (attributeDetails.getReferenceClassName() != null) {
        MetadataClass referenceClass=metadataClass.getMetadataFactory().getMetadataClass(attributeDetails.getReferenceClassName());
        attributeDetails.setReferenceClassType(Type.getType(referenceClass.getTypeName()));
      }
      if (typeClass == null) {
        typeClass=getAttributeTypeFromClass(metadataClass,attribute,foreignReferenceMapping,true);
      }
      if (weaveValueHolders && (foreignReferenceMapping.getIndirectionPolicy() instanceof BasicIndirectionPolicy) && (typeClass != null)&& (!typeClass.extendsInterface(ValueHolderInterface.class))) {
        lazyMappings.add(foreignReferenceMapping);
        attributeDetails.weaveVH(weaveValueHolders,foreignReferenceMapping);
      }
    }
    if (attributeDetails.getReferenceClassType() == null) {
      if (typeClass == null) {
        typeClass=getAttributeTypeFromClass(metadataClass,attribute,mapping,true);
      }
    }
    if (typeClass != null) {
      attributeDetails.setReferenceClassName(typeClass.getName());
      attributeDetails.setReferenceClassType(Type.getType(typeClass.getTypeName()));
    }
    attributesMap.put(attribute,attributeDetails);
  }
  classDetails.setAttributesMap(attributesMap);
  classDetails.setGetterMethodToAttributeDetails(gettersMap);
  classDetails.setSetterMethodToAttributeDetails(settersMap);
  classDetails.setLazyMappings(lazyMappings);
  return unMappedAttributes;
}

Fixed version (ground truth):
/** 
 * INTERNAL: Store a set of attribute mappings on the given ClassDetails that correspond to the given class. Return the list of mappings that is not specifically found on the given class.  These attributes will  be found on MappedSuperclasses.
 */
protected List storeAttributeMappings(MetadataClass metadataClass,ClassDetails classDetails,List mappings,boolean weaveValueHolders){
  List unMappedAttributes=new ArrayList();
  Map<String,AttributeDetails> attributesMap=new HashMap<String,AttributeDetails>();
  Map<String,AttributeDetails> settersMap=new HashMap<String,AttributeDetails>();
  Map<String,AttributeDetails> gettersMap=new HashMap<String,AttributeDetails>();
  List lazyMappings=new ArrayList();
  for (Iterator iterator=mappings.iterator(); iterator.hasNext(); ) {
    DatabaseMapping mapping=(DatabaseMapping)iterator.next();
    String attribute=mapping.getAttributeName();
    AttributeDetails attributeDetails=new AttributeDetails(attribute,mapping);
    MetadataClass typeClass=getAttributeTypeFromClass(metadataClass,attribute,mapping,false);
    if (typeClass == null) {
      attributeDetails.setAttributeOnSuperClass(true);
      unMappedAttributes.add(mapping);
    }
    if (mapping.getGetMethodName() != null) {
      gettersMap.put(mapping.getGetMethodName(),attributeDetails);
      attributeDetails.setGetterMethodName(mapping.getGetMethodName());
      if (mapping.getSetMethodName() != null) {
        settersMap.put(mapping.getSetMethodName(),attributeDetails);
        attributeDetails.setSetterMethodName(mapping.getSetMethodName());
      }
      if (mapping.isForeignReferenceMapping() && ((ForeignReferenceMapping)mapping).requiresTransientWeavedFields()) {
        attributeDetails.setWeaveTransientFieldValueHolders();
      }
      if (this.weaveInternal) {
        attributeDetails.setHasField(hasFieldInClass(metadataClass,attribute));
      }
    }
 else {
      attributeDetails.setHasField(true);
    }
    if (attributeDetails.hasField()) {
      attributeDetails.setDeclaringType(Type.getType(getAttributeDeclaringClass(metadataClass,attribute).getTypeName()));
    }
    if (mapping.isForeignReferenceMapping()) {
      ForeignReferenceMapping foreignReferenceMapping=(ForeignReferenceMapping)mapping;
      attributeDetails.setReferenceClassName(foreignReferenceMapping.getReferenceClassName());
      if (attributeDetails.getReferenceClassName() != null) {
        MetadataClass referenceClass=metadataClass.getMetadataFactory().getMetadataClass(attributeDetails.getReferenceClassName());
        attributeDetails.setReferenceClassType(Type.getType(referenceClass.getTypeName()));
      }
      if (typeClass == null) {
        typeClass=getAttributeTypeFromClass(metadataClass,attribute,foreignReferenceMapping,true);
      }
      if (weaveValueHolders && (foreignReferenceMapping.getIndirectionPolicy() instanceof BasicIndirectionPolicy) && (typeClass != null)&& (!typeClass.extendsInterface(ValueHolderInterface.class))) {
        lazyMappings.add(foreignReferenceMapping);
        attributeDetails.weaveVH(weaveValueHolders,foreignReferenceMapping);
      }
    }
    if (attributeDetails.getReferenceClassType() == null) {
      if (typeClass == null) {
        typeClass=getAttributeTypeFromClass(metadataClass,attribute,mapping,true);
      }
    }
    if (typeClass != null) {
      attributeDetails.setReferenceClassName(typeClass.getName());
      attributeDetails.setReferenceClassType(Type.getType(typeClass.getTypeName()));
    }
    attributesMap.put(attribute,attributeDetails);
  }
  classDetails.setAttributesMap(attributesMap);
  classDetails.setGetterMethodToAttributeDetails(gettersMap);
  classDetails.setSetterMethodToAttributeDetails(settersMap);
  classDetails.setLazyMappings(lazyMappings);
  return unMappedAttributes;
}