Program: 64714
Project: 64714
Buggy source:
/** 
 * Build a reference property.
 * @param property
 * @param info
 * @param javaHasAnnotations
 * @return
 */
private Property processReferenceProperty(Property property,TypeInfo info,JavaClass cls){
  String propertyName=property.getPropertyName();
  validateElementIsInPropOrder(info,propertyName);
  for (  org.eclipse.persistence.jaxb.xmlmodel.XmlElementRef nextRef : property.getXmlElementRefs()) {
    JavaClass type=property.getType();
    String typeName=type.getQualifiedName();
    if (isCollectionType(property)) {
      if (type.hasActualTypeArguments()) {
        type=property.getGenericType();
        typeName=type.getQualifiedName();
      }
    }
    if (!(nextRef.getType().equals("String_Node_Str") || nextRef.getType().equals("String_Node_Str"))) {
      typeName=nextRef.getType();
      type=helper.getJavaClass(typeName);
    }
    boolean missingReference=true;
    for (    Entry<String,ElementDeclaration> entry : xmlRootElements.entrySet()) {
      ElementDeclaration entryValue=entry.getValue();
      if (!(areEquals(type,Object.class)) && type.isAssignableFrom(entryValue.getJavaType())) {
        addReferencedElement(property,entryValue);
        missingReference=false;
      }
    }
    if (missingReference) {
      String name=nextRef.getName();
      String namespace=nextRef.getNamespace();
      if (namespace.equals(XMLProcessor.DEFAULT)) {
        namespace=EMPTY_STRING;
      }
      QName qname=new QName(namespace,name);
      JavaClass scopeClass=cls;
      ElementDeclaration referencedElement=null;
      while (!(scopeClass.getName().equals(JAVA_LANG_OBJECT))) {
        HashMap<QName,ElementDeclaration> elements=getElementDeclarationsForScope(scopeClass.getName());
        if (elements != null) {
          referencedElement=elements.get(qname);
        }
        if (referencedElement != null) {
          break;
        }
        scopeClass=scopeClass.getSuperclass();
      }
      if (referencedElement == null) {
        referencedElement=this.getGlobalElements().get(qname);
      }
      if (referencedElement != null) {
        addReferencedElement(property,referencedElement);
      }
 else {
        throw org.eclipse.persistence.exceptions.JAXBException.invalidElementRef(property.getPropertyName(),cls.getName());
      }
    }
  }
  return property;
}

Fixed version (ground truth):
/** 
 * Build a reference property.
 * @param property
 * @param info
 * @param javaHasAnnotations
 * @return
 */
private Property processReferenceProperty(Property property,TypeInfo info,JavaClass cls){
  for (  org.eclipse.persistence.jaxb.xmlmodel.XmlElementRef nextRef : property.getXmlElementRefs()) {
    JavaClass type=property.getType();
    String typeName=type.getQualifiedName();
    if (isCollectionType(property)) {
      if (type.hasActualTypeArguments()) {
        type=property.getGenericType();
        typeName=type.getQualifiedName();
      }
    }
    if (!(nextRef.getType().equals("String_Node_Str") || nextRef.getType().equals("String_Node_Str"))) {
      typeName=nextRef.getType();
      type=helper.getJavaClass(typeName);
    }
    boolean missingReference=true;
    for (    Entry<String,ElementDeclaration> entry : xmlRootElements.entrySet()) {
      ElementDeclaration entryValue=entry.getValue();
      if (!(areEquals(type,Object.class)) && type.isAssignableFrom(entryValue.getJavaType())) {
        addReferencedElement(property,entryValue);
        missingReference=false;
      }
    }
    if (missingReference) {
      String name=nextRef.getName();
      String namespace=nextRef.getNamespace();
      if (namespace.equals(XMLProcessor.DEFAULT)) {
        namespace=EMPTY_STRING;
      }
      QName qname=new QName(namespace,name);
      JavaClass scopeClass=cls;
      ElementDeclaration referencedElement=null;
      while (!(scopeClass.getName().equals(JAVA_LANG_OBJECT))) {
        HashMap<QName,ElementDeclaration> elements=getElementDeclarationsForScope(scopeClass.getName());
        if (elements != null) {
          referencedElement=elements.get(qname);
        }
        if (referencedElement != null) {
          break;
        }
        scopeClass=scopeClass.getSuperclass();
      }
      if (referencedElement == null) {
        referencedElement=this.getGlobalElements().get(qname);
      }
      if (referencedElement != null) {
        addReferencedElement(property,referencedElement);
      }
 else {
        throw org.eclipse.persistence.exceptions.JAXBException.invalidElementRef(property.getPropertyName(),cls.getName());
      }
    }
  }
  return property;
}