Program: 68223
Project: 68223
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(Class clz,ClassDetails classDetails,List mappings,boolean weaveValueHolders){
  List unMappedAttributes=new ArrayList();
  Map attributesMap=new HashMap();
  Map settersMap=new HashMap();
  Map gettersMap=new HashMap();
  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);
    Class typeClass=getAttributeTypeFromClass(clz,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 (this.weaveInternal) {
        attributeDetails.setHasField(hasFieldInClass(clz,attribute));
      }
    }
 else {
      attributeDetails.setHasField(true);
    }
    if (attributeDetails.hasField()) {
      attributeDetails.setDeclaringType(Type.getType(getAttributeDeclaringClass(clz,attribute)));
    }
    if (mapping.isForeignReferenceMapping()) {
      ForeignReferenceMapping foreignReferenceMapping=(ForeignReferenceMapping)mapping;
      attributeDetails.setReferenceClassName(foreignReferenceMapping.getReferenceClassName());
      Class referenceClass=null;
      if (attributeDetails.getReferenceClassName() != null) {
        try {
          if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
            try {
              referenceClass=(Class)AccessController.doPrivileged(new PrivilegedClassForName(attributeDetails.getReferenceClassName(),true,classLoader));
            }
 catch (            PrivilegedActionException exception) {
            }
          }
 else {
            referenceClass=PrivilegedAccessHelper.getClassForName(attributeDetails.getReferenceClassName(),true,classLoader);
          }
        }
 catch (        ClassNotFoundException exception) {
        }
        attributeDetails.setReferenceClassType(Type.getType(referenceClass));
      }
      if (typeClass == null) {
        typeClass=getAttributeTypeFromClass(clz,attribute,foreignReferenceMapping,true);
      }
      if (weaveValueHolders && (foreignReferenceMapping.getIndirectionPolicy() instanceof BasicIndirectionPolicy) && (typeClass != null)&& (!ValueHolderInterface.class.isAssignableFrom(typeClass))) {
        lazyMappings.add(foreignReferenceMapping);
        attributeDetails.weaveVH(weaveValueHolders,foreignReferenceMapping);
      }
    }
    if (attributeDetails.getReferenceClassType() == null) {
      if (typeClass == null) {
        typeClass=getAttributeTypeFromClass(clz,attribute,mapping,true);
      }
    }
    if (typeClass != null) {
      attributeDetails.setReferenceClassName(typeClass.getName());
      attributeDetails.setReferenceClassType(Type.getType(typeClass));
    }
    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 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(Class clz,ClassDetails classDetails,List mappings,boolean weaveValueHolders){
  List unMappedAttributes=new ArrayList();
  Map attributesMap=new HashMap();
  Map settersMap=new HashMap();
  Map gettersMap=new HashMap();
  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);
    Class typeClass=getAttributeTypeFromClass(clz,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(clz,attribute));
      }
    }
 else {
      attributeDetails.setHasField(true);
    }
    if (attributeDetails.hasField()) {
      attributeDetails.setDeclaringType(Type.getType(getAttributeDeclaringClass(clz,attribute)));
    }
    if (mapping.isForeignReferenceMapping()) {
      ForeignReferenceMapping foreignReferenceMapping=(ForeignReferenceMapping)mapping;
      attributeDetails.setReferenceClassName(foreignReferenceMapping.getReferenceClassName());
      Class referenceClass=null;
      if (attributeDetails.getReferenceClassName() != null) {
        try {
          if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
            try {
              referenceClass=(Class)AccessController.doPrivileged(new PrivilegedClassForName(attributeDetails.getReferenceClassName(),true,classLoader));
            }
 catch (            PrivilegedActionException exception) {
            }
          }
 else {
            referenceClass=PrivilegedAccessHelper.getClassForName(attributeDetails.getReferenceClassName(),true,classLoader);
          }
        }
 catch (        ClassNotFoundException exception) {
        }
        attributeDetails.setReferenceClassType(Type.getType(referenceClass));
      }
      if (typeClass == null) {
        typeClass=getAttributeTypeFromClass(clz,attribute,foreignReferenceMapping,true);
      }
      if (weaveValueHolders && (foreignReferenceMapping.getIndirectionPolicy() instanceof BasicIndirectionPolicy) && (typeClass != null)&& (!ValueHolderInterface.class.isAssignableFrom(typeClass))) {
        lazyMappings.add(foreignReferenceMapping);
        attributeDetails.weaveVH(weaveValueHolders,foreignReferenceMapping);
      }
    }
    if (attributeDetails.getReferenceClassType() == null) {
      if (typeClass == null) {
        typeClass=getAttributeTypeFromClass(clz,attribute,mapping,true);
      }
    }
    if (typeClass != null) {
      attributeDetails.setReferenceClassName(typeClass.getName());
      attributeDetails.setReferenceClassType(Type.getType(typeClass));
    }
    attributesMap.put(attribute,attributeDetails);
  }
  classDetails.setAttributesMap(attributesMap);
  classDetails.setGetterMethodToAttributeDetails(gettersMap);
  classDetails.setSetterMethodToAttributeDetails(settersMap);
  classDetails.setLazyMappings(lazyMappings);
  return unMappedAttributes;
}