Program: 65884
Project: 65884
Buggy source:
/** 
 * Create an XMLCollectionReferenceMapping and add it to the descriptor.
 * @param property
 * @param descriptor
 * @param namespaceInfo
 * @param referenceClass
 */
public XMLCollectionReferenceMapping generateXMLCollectionReferenceMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo,JavaClass referenceClass){
  XMLCollectionReferenceMapping mapping=new XMLCollectionReferenceMapping();
  mapping.setAttributeName(property.getPropertyName());
  mapping.setReuseContainer(true);
  mapping.setUsesSingleNode(property.isXmlList() || property.isAttribute());
  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());
    }
  }
  mapping.setReferenceClassName(referenceClass.getQualifiedName());
  JavaClass collectionType=property.getType();
  if (collectionType.isArray() || areEquals(collectionType,Collection.class) || areEquals(collectionType,List.class)) {
    collectionType=jotArrayList;
  }
 else   if (areEquals(collectionType,Set.class)) {
    collectionType=jotHashSet;
  }
  mapping.useCollectionClassName(collectionType.getRawName());
  if (property.isSetXmlJoinNodes()) {
    for (    XmlJoinNode xmlJoinNode : property.getXmlJoinNodes().getXmlJoinNode()) {
      mapping.addSourceToTargetKeyFieldAssociation(xmlJoinNode.getXmlPath(),xmlJoinNode.getReferencedXmlPath());
    }
  }
 else {
    TypeInfo referenceType=typeInfo.get(referenceClass.getQualifiedName());
    String tgtXPath=null;
    if (null != referenceType && referenceType.isIDSet()) {
      Property prop=referenceType.getIDProperty();
      tgtXPath=getXPathForField(prop,namespaceInfo,!prop.isAttribute()).getXPath();
    }
    XMLField srcXPath;
    if (property.getXmlPath() != null) {
      srcXPath=new XMLField(property.getXmlPath());
    }
 else {
      srcXPath=getXPathForField(property,namespaceInfo,true);
    }
    mapping.addSourceToTargetKeyFieldAssociation(srcXPath.getXPath(),tgtXPath);
  }
  if (property.getInverseReferencePropertyName() != null) {
    mapping.getInverseReferenceMapping().setAttributeName(property.getInverseReferencePropertyName());
    JavaClass backPointerPropertyType=null;
    if (property.getInverseReferencePropertyGetMethodName() != null && property.getInverseReferencePropertySetMethodName() != null && !property.getInverseReferencePropertyGetMethodName().equals("String_Node_Str") && !property.getInverseReferencePropertySetMethodName().equals("String_Node_Str")) {
      mapping.getInverseReferenceMapping().setGetMethodName(property.getInverseReferencePropertySetMethodName());
      mapping.getInverseReferenceMapping().setSetMethodName(property.getInverseReferencePropertySetMethodName());
      JavaMethod getMethod=referenceClass.getDeclaredMethod(mapping.getInverseReferenceMapping().getGetMethodName(),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):
/** 
 * Create an XMLCollectionReferenceMapping and add it to the descriptor.
 * @param property
 * @param descriptor
 * @param namespaceInfo
 * @param referenceClass
 */
public XMLCollectionReferenceMapping generateXMLCollectionReferenceMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo,JavaClass referenceClass){
  XMLCollectionReferenceMapping mapping=new XMLCollectionReferenceMapping();
  mapping.setAttributeName(property.getPropertyName());
  mapping.setReuseContainer(true);
  mapping.setUsesSingleNode(property.isXmlList() || property.isAttribute());
  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());
    }
  }
  mapping.setReferenceClassName(referenceClass.getQualifiedName());
  JavaClass collectionType=property.getType();
  if (collectionType.isArray() || areEquals(collectionType,Collection.class) || areEquals(collectionType,List.class)) {
    collectionType=jotArrayList;
  }
 else   if (areEquals(collectionType,Set.class)) {
    collectionType=jotHashSet;
  }
  mapping.useCollectionClassName(collectionType.getRawName());
  if (property.isSetXmlJoinNodes()) {
    for (    XmlJoinNode xmlJoinNode : property.getXmlJoinNodes().getXmlJoinNode()) {
      validateJoinNode(descriptor.getJavaClassName(),property,xmlJoinNode.getReferencedXmlPath(),referenceClass);
      mapping.addSourceToTargetKeyFieldAssociation(xmlJoinNode.getXmlPath(),xmlJoinNode.getReferencedXmlPath());
    }
  }
 else {
    TypeInfo referenceType=typeInfo.get(referenceClass.getQualifiedName());
    String tgtXPath=null;
    if (null != referenceType && referenceType.isIDSet()) {
      Property prop=referenceType.getIDProperty();
      tgtXPath=getXPathForField(prop,namespaceInfo,!prop.isAttribute()).getXPath();
    }
    XMLField srcXPath;
    if (property.getXmlPath() != null) {
      srcXPath=new XMLField(property.getXmlPath());
    }
 else {
      srcXPath=getXPathForField(property,namespaceInfo,true);
    }
    mapping.addSourceToTargetKeyFieldAssociation(srcXPath.getXPath(),tgtXPath);
  }
  if (property.getInverseReferencePropertyName() != null) {
    mapping.getInverseReferenceMapping().setAttributeName(property.getInverseReferencePropertyName());
    JavaClass backPointerPropertyType=null;
    if (property.getInverseReferencePropertyGetMethodName() != null && property.getInverseReferencePropertySetMethodName() != null && !property.getInverseReferencePropertyGetMethodName().equals("String_Node_Str") && !property.getInverseReferencePropertySetMethodName().equals("String_Node_Str")) {
      mapping.getInverseReferenceMapping().setGetMethodName(property.getInverseReferencePropertySetMethodName());
      mapping.getInverseReferenceMapping().setSetMethodName(property.getInverseReferencePropertySetMethodName());
      JavaMethod getMethod=referenceClass.getDeclaredMethod(mapping.getInverseReferenceMapping().getGetMethodName(),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;
}