Program: 64922
Project: 64922
Buggy source:
public XMLCompositeDirectCollectionMapping generateDirectCollectionMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  XMLCompositeDirectCollectionMapping mapping=new XMLCompositeDirectCollectionMapping();
  mapping.setAttributeName(property.getPropertyName());
  initializeXMLContainerMapping(mapping);
  if (property.isSetReadOnly()) {
    mapping.setIsReadOnly(property.isReadOnly());
  }
  if (property.isSetWriteOnly()) {
    mapping.setIsWriteOnly(property.isWriteOnly());
  }
  if (property.isMethodProperty()) {
    if (property.getGetMethodName() == null) {
      String paramTypeAsString=property.getType().getName();
      mapping.setAttributeAccessor(new JAXBSetMethodAttributeAccessor(paramTypeAsString,helper.getClassLoader()));
      mapping.setIsReadOnly(true);
      mapping.setSetMethodName(property.getSetMethodName());
    }
 else     if (property.getSetMethodName() == null) {
      mapping.setGetMethodName(property.getGetMethodName());
      mapping.setIsWriteOnly(true);
    }
 else {
      mapping.setSetMethodName(property.getSetMethodName());
      mapping.setGetMethodName(property.getGetMethodName());
    }
  }
  JavaClass collectionType=property.getType();
  if (collectionType.isArray()) {
    JAXBArrayAttributeAccessor accessor=new JAXBArrayAttributeAccessor(mapping.getAttributeAccessor(),mapping.getContainerPolicy(),helper.getClassLoader());
    String componentClassName=collectionType.getComponentType().getQualifiedName();
    if (collectionType.getComponentType().isPrimitive()) {
      Class primitiveClass=XMLConversionManager.getDefaultManager().convertClassNameToClass(componentClassName);
      accessor.setComponentClass(primitiveClass);
      mapping.setAttributeAccessor(accessor);
      Class declaredClass=XMLConversionManager.getDefaultManager().getObjectClass(primitiveClass);
      mapping.setAttributeElementClass(declaredClass);
    }
 else {
      accessor.setComponentClassName(componentClassName);
      mapping.setAttributeAccessor(accessor);
      JavaClass componentType=collectionType.getComponentType();
      try {
        Class declaredClass=PrivilegedAccessHelper.getClassForName(componentType.getRawName(),false,helper.getClassLoader());
        mapping.setAttributeElementClass(declaredClass);
      }
 catch (      Exception e) {
      }
    }
  }
 else   if (isCollectionType(collectionType)) {
    if (collectionType.hasActualTypeArguments()) {
      JavaClass itemType=(JavaClass)collectionType.getActualTypeArguments().toArray()[0];
      try {
        Class declaredClass=PrivilegedAccessHelper.getClassForName(itemType.getRawName(),false,helper.getClassLoader());
        mapping.setAttributeElementClass(declaredClass);
      }
 catch (      Exception e) {
      }
    }
  }
  collectionType=containerClassImpl(collectionType);
  mapping.useCollectionClassName(collectionType.getRawName());
  XMLField xmlField=getXPathForField(property,namespaceInfo,true);
  mapping.setField(xmlField);
  if (helper.isAnnotationPresent(property.getElement(),XmlMixed.class)) {
    xmlField.setXPath("String_Node_Str");
  }
  if (XMLConstants.QNAME_QNAME.equals(property.getSchemaType())) {
    ((XMLField)mapping.getField()).setSchemaType(XMLConstants.QNAME_QNAME);
  }
  if (property.isSetNullPolicy()) {
    mapping.setNullPolicy(getNullPolicyFromProperty(property,namespaceInfo.getNamespaceResolverForDescriptor()));
  }
 else   if (property.isNillable()) {
    mapping.getNullPolicy().setNullRepresentedByXsiNil(true);
    mapping.getNullPolicy().setMarshalNullRepresentation(XMLNullRepresentationType.XSI_NIL);
  }
  mapping.getNullPolicy().setNullRepresentedByEmptyNode(false);
  if (property.isSetXmlElementWrapper()) {
    mapping.setWrapperNullPolicy(getWrapperNullPolicyFromProperty(property));
  }
  if (property.isRequired()) {
    ((XMLField)mapping.getField()).setRequired(true);
  }
  if (property.isXmlElementType() && property.getGenericType() != null) {
    Class theClass=helper.getClassForJavaClass(property.getGenericType());
    mapping.setAttributeElementClass(theClass);
  }
  if (xmlField.getXPathFragment().isAttribute() || property.isXmlList() || xmlField.getXPathFragment().nameIsText()) {
    mapping.setUsesSingleNode(true);
  }
  if (property.isSetCdata()) {
    mapping.setIsCDATA(property.isCdata());
  }
  return mapping;
}

Fixed version (ground truth):
public XMLCompositeDirectCollectionMapping generateDirectCollectionMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  XMLCompositeDirectCollectionMapping mapping=new XMLCompositeDirectCollectionMapping();
  mapping.setAttributeName(property.getPropertyName());
  initializeXMLContainerMapping(mapping);
  if (property.isSetReadOnly()) {
    mapping.setIsReadOnly(property.isReadOnly());
  }
  if (property.isSetWriteOnly()) {
    mapping.setIsWriteOnly(property.isWriteOnly());
  }
  if (property.isMethodProperty()) {
    if (property.getGetMethodName() == null) {
      String paramTypeAsString=property.getType().getName();
      mapping.setAttributeAccessor(new JAXBSetMethodAttributeAccessor(paramTypeAsString,helper.getClassLoader()));
      mapping.setIsReadOnly(true);
      mapping.setSetMethodName(property.getSetMethodName());
    }
 else     if (property.getSetMethodName() == null) {
      mapping.setGetMethodName(property.getGetMethodName());
      mapping.setIsWriteOnly(true);
    }
 else {
      mapping.setSetMethodName(property.getSetMethodName());
      mapping.setGetMethodName(property.getGetMethodName());
    }
  }
  JavaClass collectionType=property.getType();
  if (collectionType.isArray()) {
    JAXBArrayAttributeAccessor accessor=new JAXBArrayAttributeAccessor(mapping.getAttributeAccessor(),mapping.getContainerPolicy(),helper.getClassLoader());
    String componentClassName=collectionType.getComponentType().getQualifiedName();
    if (collectionType.getComponentType().isPrimitive()) {
      Class primitiveClass=XMLConversionManager.getDefaultManager().convertClassNameToClass(componentClassName);
      accessor.setComponentClass(primitiveClass);
      mapping.setAttributeAccessor(accessor);
      Class declaredClass=XMLConversionManager.getDefaultManager().getObjectClass(primitiveClass);
      mapping.setAttributeElementClass(declaredClass);
    }
 else {
      accessor.setComponentClassName(componentClassName);
      mapping.setAttributeAccessor(accessor);
      JavaClass componentType=collectionType.getComponentType();
      try {
        Class declaredClass=PrivilegedAccessHelper.getClassForName(componentType.getRawName(),false,helper.getClassLoader());
        mapping.setAttributeElementClass(declaredClass);
      }
 catch (      Exception e) {
      }
    }
  }
 else   if (isCollectionType(collectionType)) {
    if (collectionType.hasActualTypeArguments()) {
      JavaClass itemType=(JavaClass)collectionType.getActualTypeArguments().toArray()[0];
      try {
        Class declaredClass=PrivilegedAccessHelper.getClassForName(itemType.getRawName(),false,helper.getClassLoader());
        if (declaredClass != String.class) {
          mapping.setAttributeElementClass(declaredClass);
        }
      }
 catch (      Exception e) {
      }
    }
  }
  collectionType=containerClassImpl(collectionType);
  mapping.useCollectionClassName(collectionType.getRawName());
  XMLField xmlField=getXPathForField(property,namespaceInfo,true);
  mapping.setField(xmlField);
  if (helper.isAnnotationPresent(property.getElement(),XmlMixed.class)) {
    xmlField.setXPath("String_Node_Str");
  }
  if (XMLConstants.QNAME_QNAME.equals(property.getSchemaType())) {
    ((XMLField)mapping.getField()).setSchemaType(XMLConstants.QNAME_QNAME);
  }
  if (property.isSetNullPolicy()) {
    mapping.setNullPolicy(getNullPolicyFromProperty(property,namespaceInfo.getNamespaceResolverForDescriptor()));
  }
 else   if (property.isNillable()) {
    mapping.getNullPolicy().setNullRepresentedByXsiNil(true);
    mapping.getNullPolicy().setMarshalNullRepresentation(XMLNullRepresentationType.XSI_NIL);
  }
  mapping.getNullPolicy().setNullRepresentedByEmptyNode(false);
  if (property.isSetXmlElementWrapper()) {
    mapping.setWrapperNullPolicy(getWrapperNullPolicyFromProperty(property));
  }
  if (property.isRequired()) {
    ((XMLField)mapping.getField()).setRequired(true);
  }
  if (property.isXmlElementType() && property.getGenericType() != null) {
    Class theClass=helper.getClassForJavaClass(property.getGenericType());
    mapping.setAttributeElementClass(theClass);
  }
  if (xmlField.getXPathFragment().isAttribute() || property.isXmlList() || xmlField.getXPathFragment().nameIsText()) {
    mapping.setUsesSingleNode(true);
  }
  if (property.isSetCdata()) {
    mapping.setIsCDATA(property.isCdata());
  }
  return mapping;
}