Program: 66833
Project: 66833
Buggy source:
/** 
 * Create an XMLObjectReferenceMapping and add it to the descriptor.
 * @param property
 * @param descriptor
 * @param namespaceInfo
 * @param referenceClass
 */
public void generateXMLObjectReferenceMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo,JavaClass referenceClass){
  XMLField srcXPath=getXPathForField(property,namespaceInfo,true);
  XMLObjectReferenceMapping mapping=new XMLObjectReferenceMapping();
  mapping.setAttributeName(property.getPropertyName());
  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());
  TypeInfo referenceType=typeInfo.get(referenceClass.getQualifiedName());
  if (referenceType.isIDSet()) {
    Property prop=referenceType.getIDProperty();
    XMLField tgtXPath=getXPathForField(prop,namespaceInfo,!(helper.isAnnotationPresent(prop.getElement(),XmlAttribute.class)));
    mapping.addSourceToTargetKeyFieldAssociation(srcXPath.getXPath(),tgtXPath.getXPath());
  }
  if (property.getBackpointerPropertyName() != null) {
    mapping.setBidirectionalTargetAttributeName(property.getBackpointerPropertyName());
    JavaClass backPointerPropertyType=null;
    if (property.getBackpointerGetMethodName() != null && property.getBackpointerSetMethodName() != null && !property.getBackpointerGetMethodName().equals("String_Node_Str") && !property.getBackpointerSetMethodName().equals("String_Node_Str")) {
      mapping.setBidirectionalTargetGetMethodName(property.getBackpointerSetMethodName());
      mapping.setBidirectionalTargetSetMethodName(property.getBackpointerSetMethodName());
      JavaMethod getMethod=referenceClass.getDeclaredMethod(mapping.getBidirectionalTargetGetMethodName(),new JavaClass[]{});
      if (getMethod != null) {
        backPointerPropertyType=getMethod.getReturnType();
      }
    }
 else {
      JavaField backpointerField=referenceClass.getDeclaredField(property.getBackpointerPropertyName());
      if (backpointerField != null) {
        backPointerPropertyType=backpointerField.getResolvedType();
      }
    }
    if (isCollectionType(backPointerPropertyType)) {
      mapping.setBidirectionalTargetContainerPolicy(ContainerPolicy.buildDefaultPolicy());
    }
  }
  descriptor.addMapping(mapping);
}

Fixed version (ground truth):
/** 
 * Create an XMLObjectReferenceMapping and add it to the descriptor.
 * @param property
 * @param descriptor
 * @param namespaceInfo
 * @param referenceClass
 */
public void generateXMLObjectReferenceMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo,JavaClass referenceClass){
  XMLField srcXPath=getXPathForField(property,namespaceInfo,true);
  XMLObjectReferenceMapping mapping=new XMLObjectReferenceMapping();
  mapping.setAttributeName(property.getPropertyName());
  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());
  TypeInfo referenceType=typeInfo.get(referenceClass.getQualifiedName());
  if (referenceType.isIDSet()) {
    Property prop=referenceType.getIDProperty();
    XMLField tgtXPath=getXPathForField(prop,namespaceInfo,!(helper.isAnnotationPresent(prop.getElement(),XmlAttribute.class)));
    mapping.addSourceToTargetKeyFieldAssociation(srcXPath.getXPath(),tgtXPath.getXPath());
  }
  if (property.getBidirectionalPropertyName() != null) {
    mapping.setBidirectionalTargetAttributeName(property.getBidirectionalPropertyName());
    JavaClass backPointerPropertyType=null;
    if (property.getBidirectionalPropertyGetMethodName() != null && property.getBidirectionalPropertySetMethodName() != null && !property.getBidirectionalPropertyGetMethodName().equals("String_Node_Str") && !property.getBidirectionalPropertySetMethodName().equals("String_Node_Str")) {
      mapping.setBidirectionalTargetGetMethodName(property.getBidirectionalPropertySetMethodName());
      mapping.setBidirectionalTargetSetMethodName(property.getBidirectionalPropertySetMethodName());
      JavaMethod getMethod=referenceClass.getDeclaredMethod(mapping.getBidirectionalTargetGetMethodName(),new JavaClass[]{});
      if (getMethod != null) {
        backPointerPropertyType=getMethod.getReturnType();
      }
    }
 else {
      JavaField backpointerField=referenceClass.getDeclaredField(property.getBidirectionalPropertyName());
      if (backpointerField != null) {
        backPointerPropertyType=backpointerField.getResolvedType();
      }
    }
    if (isCollectionType(backPointerPropertyType)) {
      mapping.setBidirectionalTargetContainerPolicy(ContainerPolicy.buildDefaultPolicy());
    }
  }
  descriptor.addMapping(mapping);
}