Program: 66139
Project: 66139
Buggy source:
public XMLCompositeCollectionMapping generateCompositeCollectionMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo,String referenceClassName){
  XMLCompositeCollectionMapping mapping=new XMLCompositeCollectionMapping();
  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());
    }
  }
  if (property.isSetNullPolicy()) {
    mapping.setNullPolicy(getNullPolicyFromProperty(property,namespaceInfo.getNamespaceResolverForDescriptor()));
  }
 else   if (property.isNillable()) {
    mapping.getNullPolicy().setNullRepresentedByXsiNil(true);
  }
  JavaClass collectionType=property.getType();
  if (collectionType.isArray()) {
    JAXBArrayAttributeAccessor accessor=new JAXBArrayAttributeAccessor(mapping.getAttributeAccessor(),mapping.getContainerPolicy(),helper.getClassLoader());
    JavaClass componentType=collectionType.getComponentType();
    if (componentType.isArray()) {
      Class adaptedClass=classToGeneratedClasses.get(componentType.getName());
      referenceClassName=adaptedClass.getName();
      accessor.setAdaptedClassName(referenceClassName);
      JavaClass baseComponentType=getBaseComponentType(componentType);
      if (baseComponentType.isPrimitive()) {
        Class primitiveClass=XMLConversionManager.getDefaultManager().convertClassNameToClass(baseComponentType.getRawName());
        accessor.setComponentClass(primitiveClass);
      }
 else {
        accessor.setComponentClassName(baseComponentType.getName());
      }
    }
 else {
      accessor.setComponentClassName(componentType.getName());
    }
    mapping.setAttributeAccessor(accessor);
    collectionType=jotArrayList;
  }
 else   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;
  if (property.getXmlPath() != null) {
    xmlField=new XMLField(property.getXmlPath());
  }
 else {
    xmlField=getXPathForField(property,namespaceInfo,false);
  }
  mapping.setXPath(xmlField.getXPath());
  if (referenceClassName == null) {
    ((XMLField)mapping.getField()).setIsTypedTextField(true);
    ((XMLField)mapping.getField()).setSchemaType(XMLConstants.ANY_TYPE_QNAME);
  }
 else {
    mapping.setReferenceClassName(referenceClassName);
  }
  if (property.isRequired()) {
    ((XMLField)mapping.getField()).setRequired(true);
  }
  if (property.getInverseReferencePropertyName() != null) {
    mapping.setContainerAttributeName(property.getInverseReferencePropertyName());
    JavaClass backPointerPropertyType=null;
    JavaClass referenceClass=property.getActualType();
    if (property.getInverseReferencePropertyGetMethodName() != null && property.getInverseReferencePropertySetMethodName() != null && !property.getInverseReferencePropertyGetMethodName().equals("String_Node_Str") && !property.getInverseReferencePropertySetMethodName().equals("String_Node_Str")) {
      mapping.setContainerGetMethodName(property.getInverseReferencePropertySetMethodName());
      mapping.setContainerSetMethodName(property.getInverseReferencePropertySetMethodName());
      JavaMethod getMethod=referenceClass.getDeclaredMethod(mapping.getContainerGetMethodName(),new JavaClass[]{});
      if (getMethod != null) {
        backPointerPropertyType=getMethod.getReturnType();
      }
    }
 else {
      JavaField backpointerField=referenceClass.getDeclaredField(property.getInverseReferencePropertyName());
      if (backpointerField != null) {
        backPointerPropertyType=backpointerField.getResolvedType();
      }
    }
    if (isCollectionType(backPointerPropertyType)) {
      mapping.getInverseReferenceMapping().setContainerPolicy(ContainerPolicy.buildDefaultPolicy());
    }
  }
  return mapping;
}

Fixed version (ground truth):
public XMLCompositeCollectionMapping generateCompositeCollectionMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo,String referenceClassName){
  XMLCompositeCollectionMapping mapping=new XMLCompositeCollectionMapping();
  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());
    }
  }
  if (property.isSetNullPolicy()) {
    mapping.setNullPolicy(getNullPolicyFromProperty(property,namespaceInfo.getNamespaceResolverForDescriptor()));
  }
 else   if (property.isNillable()) {
    mapping.getNullPolicy().setNullRepresentedByXsiNil(true);
    mapping.getNullPolicy().setMarshalNullRepresentation(XMLNullRepresentationType.XSI_NIL);
  }
  JavaClass collectionType=property.getType();
  if (collectionType.isArray()) {
    JAXBArrayAttributeAccessor accessor=new JAXBArrayAttributeAccessor(mapping.getAttributeAccessor(),mapping.getContainerPolicy(),helper.getClassLoader());
    JavaClass componentType=collectionType.getComponentType();
    if (componentType.isArray()) {
      Class adaptedClass=classToGeneratedClasses.get(componentType.getName());
      referenceClassName=adaptedClass.getName();
      accessor.setAdaptedClassName(referenceClassName);
      JavaClass baseComponentType=getBaseComponentType(componentType);
      if (baseComponentType.isPrimitive()) {
        Class primitiveClass=XMLConversionManager.getDefaultManager().convertClassNameToClass(baseComponentType.getRawName());
        accessor.setComponentClass(primitiveClass);
      }
 else {
        accessor.setComponentClassName(baseComponentType.getName());
      }
    }
 else {
      accessor.setComponentClassName(componentType.getName());
    }
    mapping.setAttributeAccessor(accessor);
    collectionType=jotArrayList;
  }
 else   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;
  if (property.getXmlPath() != null) {
    xmlField=new XMLField(property.getXmlPath());
  }
 else {
    xmlField=getXPathForField(property,namespaceInfo,false);
  }
  mapping.setXPath(xmlField.getXPath());
  if (referenceClassName == null) {
    ((XMLField)mapping.getField()).setIsTypedTextField(true);
    ((XMLField)mapping.getField()).setSchemaType(XMLConstants.ANY_TYPE_QNAME);
  }
 else {
    mapping.setReferenceClassName(referenceClassName);
  }
  if (property.isRequired()) {
    ((XMLField)mapping.getField()).setRequired(true);
  }
  if (property.getInverseReferencePropertyName() != null) {
    mapping.setContainerAttributeName(property.getInverseReferencePropertyName());
    JavaClass backPointerPropertyType=null;
    JavaClass referenceClass=property.getActualType();
    if (property.getInverseReferencePropertyGetMethodName() != null && property.getInverseReferencePropertySetMethodName() != null && !property.getInverseReferencePropertyGetMethodName().equals("String_Node_Str") && !property.getInverseReferencePropertySetMethodName().equals("String_Node_Str")) {
      mapping.setContainerGetMethodName(property.getInverseReferencePropertySetMethodName());
      mapping.setContainerSetMethodName(property.getInverseReferencePropertySetMethodName());
      JavaMethod getMethod=referenceClass.getDeclaredMethod(mapping.getContainerGetMethodName(),new JavaClass[]{});
      if (getMethod != null) {
        backPointerPropertyType=getMethod.getReturnType();
      }
    }
 else {
      JavaField backpointerField=referenceClass.getDeclaredField(property.getInverseReferencePropertyName());
      if (backpointerField != null) {
        backPointerPropertyType=backpointerField.getResolvedType();
      }
    }
    if (isCollectionType(backPointerPropertyType)) {
      mapping.getInverseReferenceMapping().setContainerPolicy(ContainerPolicy.buildDefaultPolicy());
    }
  }
  return mapping;
}