Program: 64247
Project: 64247
Buggy source:
/** 
 * Create a JAXB property for a particular mapping. This will only create JAXBProperties for mappings that are virtual - either because their parent object is a dynamic class, or because the owning static class has virtual properties
 * @param mapping
 * @param objectFactory
 * @param owningType
 * @param isDynamic
 * @return
 */
private JAXBElement<XmlElement> createJAXBProperty(DatabaseMapping mapping,ObjectFactory objectFactory,JavaType owningType,boolean isDynamic){
  if (!mapping.getAttributeAccessor().isVirtualAttributeAccessor() && !isDynamic) {
    return null;
  }
  XmlElement xmlElement=new XmlElement();
  xmlElement.setJavaAttribute(mapping.getAttributeName());
  if (mapping.isObjectReferenceMapping()) {
    xmlElement.setType(((ObjectReferenceMapping)mapping).getReferenceClassName());
  }
 else   if (mapping.isCollectionMapping()) {
    xmlElement.setType(((CollectionMapping)mapping).getReferenceClassName());
    xmlElement.setContainerType(((CollectionMapping)mapping).getContainerPolicy().getContainerClassName());
  }
 else {
    xmlElement.setType(mapping.getAttributeClassification().getName());
  }
  if (mapping.getAttributeAccessor().isVirtualAttributeAccessor()) {
    VirtualAttributeAccessor jpaAccessor=(VirtualAttributeAccessor)mapping.getAttributeAccessor();
    if (owningType.getXmlVirtualAccessMethods() == null) {
      XmlVirtualAccessMethods virtualAccessMethods=new XmlVirtualAccessMethods();
      virtualAccessMethods.setGetMethod(jpaAccessor.getGetMethodName());
      virtualAccessMethods.setSetMethod(jpaAccessor.getSetMethodName());
      owningType.setXmlVirtualAccessMethods(virtualAccessMethods);
    }
 else     if (!owningType.getXmlVirtualAccessMethods().getGetMethod().equals(jpaAccessor.getGetMethodName())) {
      XmlAccessMethods accessMethods=new XmlAccessMethods();
      accessMethods.setGetMethod(jpaAccessor.getGetMethodName());
      accessMethods.setSetMethod(jpaAccessor.getSetMethodName());
      xmlElement.setXmlAccessMethods(accessMethods);
    }
  }
  return objectFactory.createXmlElement(xmlElement);
}

Fixed version (ground truth):
/** 
 * Create a JAXB property for a particular mapping. This will only create JAXBProperties for mappings that are virtual - either because their parent object is a dynamic class, or because the owning static class has virtual properties
 * @param mapping
 * @param objectFactory
 * @param owningType
 * @param isDynamic
 * @return
 */
private JAXBElement<XmlElement> createJAXBProperty(DatabaseMapping mapping,ObjectFactory objectFactory,JavaType owningType,boolean isDynamic){
  if (!mapping.getAttributeAccessor().isVirtualAttributeAccessor() && !isDynamic) {
    return null;
  }
  XmlElement xmlElement=new XmlElement();
  xmlElement.setJavaAttribute(mapping.getAttributeName());
  if (mapping.isObjectReferenceMapping()) {
    xmlElement.setType(((ObjectReferenceMapping)mapping).getReferenceClassName());
  }
 else   if (mapping.isCollectionMapping()) {
    if (mapping.isEISMapping()) {
      xmlElement.setContainerType(((AbstractCompositeDirectCollectionMapping)mapping).getContainerPolicy().getContainerClassName());
    }
 else {
      xmlElement.setType(((CollectionMapping)mapping).getReferenceClassName());
      xmlElement.setContainerType(((CollectionMapping)mapping).getContainerPolicy().getContainerClassName());
    }
  }
 else {
    xmlElement.setType(mapping.getAttributeClassification().getName());
  }
  if (mapping.getAttributeAccessor().isVirtualAttributeAccessor()) {
    VirtualAttributeAccessor jpaAccessor=(VirtualAttributeAccessor)mapping.getAttributeAccessor();
    if (owningType.getXmlVirtualAccessMethods() == null) {
      XmlVirtualAccessMethods virtualAccessMethods=new XmlVirtualAccessMethods();
      virtualAccessMethods.setGetMethod(jpaAccessor.getGetMethodName());
      virtualAccessMethods.setSetMethod(jpaAccessor.getSetMethodName());
      owningType.setXmlVirtualAccessMethods(virtualAccessMethods);
    }
 else     if (!owningType.getXmlVirtualAccessMethods().getGetMethod().equals(jpaAccessor.getGetMethodName())) {
      XmlAccessMethods accessMethods=new XmlAccessMethods();
      accessMethods.setGetMethod(jpaAccessor.getGetMethodName());
      accessMethods.setSetMethod(jpaAccessor.getSetMethodName());
      xmlElement.setXmlAccessMethods(accessMethods);
    }
  }
  return objectFactory.createXmlElement(xmlElement);
}