Program: 64036
Project: 64036
Buggy source:
/** 
 * INTERNAL: Initialize the members of this ManagedType based on the mappings defined on the descriptor. We process the appropriate Map, List, Set, Collection or Object/primitive types.<p> Initialization should occur after all types in the metamodel have been created already.
 */
protected void initialize(){
  this.members=new HashMap<String,Attribute<X,?>>();
  for (  DatabaseMapping mapping : getDescriptor().getMappings()) {
    AttributeImpl<X,?> member=null;
    if (mapping instanceof CollectionMapping) {
      CollectionMapping colMapping=(CollectionMapping)mapping;
      ContainerPolicy collectionContainerPolicy=colMapping.getContainerPolicy();
      if (collectionContainerPolicy.isMapPolicy()) {
        member=new MapAttributeImpl(this,colMapping,true);
      }
 else       if (collectionContainerPolicy.isListPolicy()) {
        Class aType=null;
        if (colMapping.getAttributeAccessor() instanceof ValuesAccessor) {
          member=new ListAttributeImpl(this,colMapping);
        }
 else         if (colMapping.getAttributeAccessor() instanceof InstanceVariableAttributeAccessor) {
          Field aField=((InstanceVariableAttributeAccessor)colMapping.getAttributeAccessor()).getAttributeField();
          if (null == aField) {
            if (this.isMappedSuperclass()) {
              MappedSuperclassTypeImpl aMappedSuperclass=((MappedSuperclassTypeImpl)this);
              AttributeImpl inheritingTypeMember=aMappedSuperclass.getMemberFromInheritingType(colMapping.getAttributeName());
              if (null != inheritingTypeMember) {
                aField=((InstanceVariableAttributeAccessor)inheritingTypeMember.getMapping().getAttributeAccessor()).getAttributeField();
              }
            }
          }
          if (null == aField) {
            aType=this.getTypeClassFromAttributeOrMethodLevelAccessor(mapping);
          }
 else {
            aType=aField.getType();
          }
          if ((aType != null) && List.class.isAssignableFrom(aType)) {
            member=new ListAttributeImpl(this,colMapping,true);
          }
 else           if ((aType != null) && Collection.class.isAssignableFrom(aType)) {
            member=new CollectionAttributeImpl(this,colMapping,true);
          }
 else {
            member=initializePluralAttributeTypeNotFound(this,colMapping,true);
          }
        }
 else {
          if (colMapping.getAttributeAccessor() instanceof MethodAttributeAccessor) {
            aType=((MethodAttributeAccessor)colMapping.getAttributeAccessor()).getAttributeClass();
            if ((aType != null) && List.class.isAssignableFrom(aType)) {
              member=new ListAttributeImpl(this,colMapping,true);
            }
 else             if ((aType != null) && Collection.class.isAssignableFrom(aType)) {
              member=new CollectionAttributeImpl(this,colMapping,true);
            }
 else {
              String getMethodName=((MethodAttributeAccessor)colMapping.getAttributeAccessor()).getGetMethodName();
              if (null == getMethodName) {
                try {
                  Field field=null;
                  if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
                    try {
                      field=(Field)AccessController.doPrivileged(new PrivilegedGetDeclaredField(this.getJavaType(),colMapping.getAttributeName(),false));
                    }
 catch (                    PrivilegedActionException exception) {
                      member=initializePluralAttributeTypeNotFound(this,colMapping,true);
                    }
                  }
 else {
                    field=PrivilegedAccessHelper.getDeclaredField(this.getJavaType(),colMapping.getAttributeName(),false);
                  }
                  if (null == field) {
                    member=initializePluralAttributeTypeNotFound(this,colMapping,true);
                  }
 else {
                    aType=field.getType();
                    if ((aType != null) && List.class.isAssignableFrom(aType)) {
                      member=new ListAttributeImpl(this,colMapping,true);
                    }
 else                     if ((aType != null) && Collection.class.isAssignableFrom(aType)) {
                      member=new CollectionAttributeImpl(this,colMapping,true);
                    }
 else {
                      member=initializePluralAttributeTypeNotFound(this,colMapping,true);
                    }
                  }
                }
 catch (                Exception e) {
                  member=initializePluralAttributeTypeNotFound(this,colMapping,true);
                }
              }
 else {
                try {
                  Method aMethod=null;
                  if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
                    aMethod=(Method)AccessController.doPrivileged(new PrivilegedGetDeclaredMethod(this.getJavaType(),getMethodName,null));
                  }
 else {
                    aMethod=PrivilegedAccessHelper.getDeclaredMethod(this.getJavaType(),getMethodName,null);
                  }
                  if (null == aMethod) {
                    member=initializePluralAttributeTypeNotFound(this,colMapping,true);
                  }
 else {
                    aType=aMethod.getReturnType();
                    if ((aType != null) && List.class.isAssignableFrom(aType)) {
                      member=new ListAttributeImpl(this,colMapping,true);
                    }
 else                     if ((aType != null) && Collection.class.isAssignableFrom(aType)) {
                      member=new CollectionAttributeImpl(this,colMapping,true);
                    }
 else {
                      member=initializePluralAttributeTypeNotFound(this,colMapping,true);
                    }
                  }
                }
 catch (                Exception e) {
                  member=initializePluralAttributeTypeNotFound(this,colMapping,true);
                }
              }
            }
          }
        }
      }
 else {
        if ((collectionContainerPolicy.getContainerClass() != null) && Set.class.isAssignableFrom(collectionContainerPolicy.getContainerClass())) {
          member=new SetAttributeImpl(this,colMapping,true);
        }
 else {
          if (collectionContainerPolicy.isCollectionPolicy()) {
            member=new CollectionAttributeImpl(this,colMapping,true);
          }
 else {
            member=new CollectionAttributeImpl(this,colMapping);
          }
        }
      }
    }
 else {
      member=new SingularAttributeImpl(this,mapping,true);
    }
    if (null == member) {
      AbstractSessionLog.getLog().log(SessionLog.FINEST,"String_Node_Str",mapping.getAttributeName(),this,descriptor);
    }
    this.members.put(mapping.getAttributeName(),member);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Initialize the members of this ManagedType based on the mappings defined on the descriptor. We process the appropriate Map, List, Set, Collection or Object/primitive types.<p> Initialization should occur after all types in the metamodel have been created already.
 */
protected void initialize(){
  if (null != this.members) {
    return;
  }
  this.members=new HashMap<String,Attribute<X,?>>();
  for (  DatabaseMapping mapping : getDescriptor().getMappings()) {
    AttributeImpl<X,?> member=null;
    if (mapping instanceof CollectionMapping) {
      CollectionMapping colMapping=(CollectionMapping)mapping;
      ContainerPolicy collectionContainerPolicy=colMapping.getContainerPolicy();
      if (collectionContainerPolicy.isMapPolicy()) {
        member=new MapAttributeImpl(this,colMapping,true);
      }
 else       if (collectionContainerPolicy.isListPolicy()) {
        Class aType=null;
        if (colMapping.getAttributeAccessor() instanceof ValuesAccessor) {
          member=new ListAttributeImpl(this,colMapping);
        }
 else         if (colMapping.getAttributeAccessor() instanceof InstanceVariableAttributeAccessor) {
          Field aField=((InstanceVariableAttributeAccessor)colMapping.getAttributeAccessor()).getAttributeField();
          if (null == aField) {
            if (this.isMappedSuperclass()) {
              MappedSuperclassTypeImpl aMappedSuperclass=((MappedSuperclassTypeImpl)this);
              AttributeImpl inheritingTypeMember=aMappedSuperclass.getMemberFromInheritingType(colMapping.getAttributeName());
              if (null != inheritingTypeMember) {
                aField=((InstanceVariableAttributeAccessor)inheritingTypeMember.getMapping().getAttributeAccessor()).getAttributeField();
              }
            }
          }
          if (null == aField) {
            aType=this.getTypeClassFromAttributeOrMethodLevelAccessor(mapping);
          }
 else {
            aType=aField.getType();
          }
          if ((aType != null) && List.class.isAssignableFrom(aType)) {
            member=new ListAttributeImpl(this,colMapping,true);
          }
 else           if ((aType != null) && Collection.class.isAssignableFrom(aType)) {
            member=new CollectionAttributeImpl(this,colMapping,true);
          }
 else {
            member=initializePluralAttributeTypeNotFound(this,colMapping,true);
          }
        }
 else {
          if (colMapping.getAttributeAccessor() instanceof MethodAttributeAccessor) {
            aType=((MethodAttributeAccessor)colMapping.getAttributeAccessor()).getAttributeClass();
            if ((aType != null) && List.class.isAssignableFrom(aType)) {
              member=new ListAttributeImpl(this,colMapping,true);
            }
 else             if ((aType != null) && Collection.class.isAssignableFrom(aType)) {
              member=new CollectionAttributeImpl(this,colMapping,true);
            }
 else {
              String getMethodName=((MethodAttributeAccessor)colMapping.getAttributeAccessor()).getGetMethodName();
              if (null == getMethodName) {
                try {
                  Field field=null;
                  if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
                    try {
                      field=(Field)AccessController.doPrivileged(new PrivilegedGetDeclaredField(this.getJavaType(),colMapping.getAttributeName(),false));
                    }
 catch (                    PrivilegedActionException exception) {
                      member=initializePluralAttributeTypeNotFound(this,colMapping,true);
                    }
                  }
 else {
                    field=PrivilegedAccessHelper.getDeclaredField(this.getJavaType(),colMapping.getAttributeName(),false);
                  }
                  if (null == field) {
                    member=initializePluralAttributeTypeNotFound(this,colMapping,true);
                  }
 else {
                    aType=field.getType();
                    if ((aType != null) && List.class.isAssignableFrom(aType)) {
                      member=new ListAttributeImpl(this,colMapping,true);
                    }
 else                     if ((aType != null) && Collection.class.isAssignableFrom(aType)) {
                      member=new CollectionAttributeImpl(this,colMapping,true);
                    }
 else {
                      member=initializePluralAttributeTypeNotFound(this,colMapping,true);
                    }
                  }
                }
 catch (                Exception e) {
                  member=initializePluralAttributeTypeNotFound(this,colMapping,true);
                }
              }
 else {
                try {
                  Method aMethod=null;
                  if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
                    aMethod=(Method)AccessController.doPrivileged(new PrivilegedGetDeclaredMethod(this.getJavaType(),getMethodName,null));
                  }
 else {
                    aMethod=PrivilegedAccessHelper.getDeclaredMethod(this.getJavaType(),getMethodName,null);
                  }
                  if (null == aMethod) {
                    member=initializePluralAttributeTypeNotFound(this,colMapping,true);
                  }
 else {
                    aType=aMethod.getReturnType();
                    if ((aType != null) && List.class.isAssignableFrom(aType)) {
                      member=new ListAttributeImpl(this,colMapping,true);
                    }
 else                     if ((aType != null) && Collection.class.isAssignableFrom(aType)) {
                      member=new CollectionAttributeImpl(this,colMapping,true);
                    }
 else {
                      member=initializePluralAttributeTypeNotFound(this,colMapping,true);
                    }
                  }
                }
 catch (                Exception e) {
                  member=initializePluralAttributeTypeNotFound(this,colMapping,true);
                }
              }
            }
          }
        }
      }
 else {
        if ((collectionContainerPolicy.getContainerClass() != null) && Set.class.isAssignableFrom(collectionContainerPolicy.getContainerClass())) {
          member=new SetAttributeImpl(this,colMapping,true);
        }
 else {
          if (collectionContainerPolicy.isCollectionPolicy()) {
            member=new CollectionAttributeImpl(this,colMapping,true);
          }
 else {
            member=new CollectionAttributeImpl(this,colMapping);
          }
        }
      }
    }
 else {
      member=new SingularAttributeImpl(this,mapping,true);
    }
    if (null == member) {
      AbstractSessionLog.getLog().log(SessionLog.FINEST,"String_Node_Str",mapping.getAttributeName(),this,descriptor);
    }
    this.members.put(mapping.getAttributeName(),member);
  }
}