Program: 67057
Project: 67057
Buggy source:
public XMLCompositeDirectCollectionMapping generateDirectCollectionMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  XMLCompositeDirectCollectionMapping mapping=new XMLCompositeDirectCollectionMapping();
  mapping.setAttributeName(property.getPropertyName());
  mapping.setReuseContainer(true);
  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()) {
    if (collectionType.getComponentType().isPrimitive()) {
      JAXBPrimitiveArrayAttributeAccessor accessor=new JAXBPrimitiveArrayAttributeAccessor(mapping.getAttributeAccessor(),mapping.getContainerPolicy());
      String componentClassName=collectionType.getComponentType().getRawName();
      Class primitiveClass=XMLConversionManager.getDefaultManager().convertClassNameToClass(componentClassName);
      accessor.setComponentClass(primitiveClass);
      mapping.setAttributeAccessor(accessor);
      Class declaredClass=XMLConversionManager.getDefaultManager().getObjectClass(primitiveClass);
      mapping.setAttributeElementClass(declaredClass);
    }
 else {
      JAXBObjectArrayAttributeAccessor accessor=new JAXBObjectArrayAttributeAccessor(mapping.getAttributeAccessor(),mapping.getContainerPolicy());
      String componentClassName=collectionType.getComponentType().getRawName();
      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 (collectionType != null && 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.getActualType() == null || property.getActualType().getRawName().equals("String_Node_Str")) {
    mapping.getNullPolicy().setNullRepresentedByEmptyNode(false);
  }
  if (property.isXmlElementType() && property.getGenericType() != null) {
    Class theClass=helper.getClassForJavaClass(property.getGenericType());
    mapping.setAttributeElementClass(theClass);
  }
  if (xmlField.getXPathFragment().isAttribute()) {
    mapping.setUsesSingleNode(true);
  }
  if (helper.isAnnotationPresent(property.getElement(),XmlList.class)) {
    mapping.setUsesSingleNode(true);
  }
  descriptor.addMapping(mapping);
  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.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()) {
    if (collectionType.getComponentType().isPrimitive()) {
      JAXBPrimitiveArrayAttributeAccessor accessor=new JAXBPrimitiveArrayAttributeAccessor(mapping.getAttributeAccessor(),mapping.getContainerPolicy());
      String componentClassName=collectionType.getComponentType().getRawName();
      Class primitiveClass=XMLConversionManager.getDefaultManager().convertClassNameToClass(componentClassName);
      accessor.setComponentClass(primitiveClass);
      mapping.setAttributeAccessor(accessor);
      Class declaredClass=XMLConversionManager.getDefaultManager().getObjectClass(primitiveClass);
      mapping.setAttributeElementClass(declaredClass);
    }
 else {
      JAXBObjectArrayAttributeAccessor accessor=new JAXBObjectArrayAttributeAccessor(mapping.getAttributeAccessor(),mapping.getContainerPolicy());
      String componentClassName=collectionType.getComponentType().getRawName();
      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 (collectionType != null && 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.getActualType() == null || property.getActualType().getRawName().equals("String_Node_Str")) {
    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 (helper.isAnnotationPresent(property.getElement(),XmlList.class)) {
    mapping.setUsesSingleNode(true);
  }
  descriptor.addMapping(mapping);
  return mapping;
}