Program: 65697
Project: 65697
Buggy source:
public XMLCompositeDirectCollectionMapping generateDirectCollectionMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  XMLCompositeDirectCollectionMapping mapping=new XMLCompositeDirectCollectionMapping();
  mapping.setAttributeName(property.getPropertyName());
  mapping.setReuseContainer(true);
  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().getRawName();
    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) {
      }
    }
    collectionType=jotArrayList;
  }
 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) {
      }
    }
  }
  if (areEquals(collectionType,Collection.class) || areEquals(collectionType,List.class)) {
    collectionType=jotArrayList;
  }
 else   if (areEquals(collectionType,Set.class)) {
    collectionType=jotHashSet;
  }
  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.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()) {
    mapping.setUsesSingleNode(true);
  }
  if (property.isXmlList()) {
    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());
  mapping.setReuseContainer(true);
  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().getRawName();
    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) {
      }
    }
    collectionType=jotArrayList;
  }
 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) {
      }
    }
  }
  if (areEquals(collectionType,Collection.class) || areEquals(collectionType,List.class)) {
    collectionType=jotArrayList;
  }
 else   if (areEquals(collectionType,Set.class)) {
    collectionType=jotHashSet;
  }
  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.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;
}