Program: 64980
Project: 64980
Buggy source:
public boolean marshalSingleValue(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,Object value,AbstractSession session,NamespaceResolver namespaceResolver,MarshalContext marshalContext){
  Class valueClass=null;
  if (value instanceof XMLRoot) {
    XMLRoot root=(XMLRoot)value;
    for (    DatabaseField next : this.xmlChoiceMapping.getFields()) {
      XPathFragment fragment=((XMLField)next).getXPathFragment();
      while (fragment != null && !fragment.nameIsText) {
        if (fragment.getNextFragment() == null || fragment.getHasText()) {
          if (fragment.getLocalName().equals(root.getLocalName())) {
            String fragUri=fragment.getNamespaceURI();
            String namespaceUri=root.getNamespaceURI();
            if ((namespaceUri == null && fragUri == null) || (namespaceUri != null && fragUri != null && namespaceUri.equals(fragUri))) {
              if (next == this.xmlField) {
                return this.choiceElementNodeValue.marshalSingleValue(xPathFragment,marshalRecord,object,value,session,namespaceResolver,marshalContext);
              }
 else {
                return false;
              }
            }
          }
        }
        fragment=fragment.getNextFragment();
      }
    }
    valueClass=root.getObject().getClass();
  }
  if (value != null) {
    if (valueClass == null) {
      valueClass=value.getClass();
    }
    if (xmlChoiceMapping.getClassToFieldMappings().get(valueClass) == this.xmlField) {
      return this.choiceElementNodeValue.marshalSingleValue(xPathFragment,marshalRecord,object,value,session,namespaceResolver,marshalContext);
    }
    List<XMLField> sourceFields=xmlChoiceMapping.getClassToSourceFieldsMappings().get(valueClass);
    if (sourceFields != null && sourceFields.contains(this.xmlField)) {
      return this.choiceElementNodeValue.marshalSingleValue(xPathFragment,marshalRecord,object,value,session,namespaceResolver,marshalContext);
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean marshalSingleValue(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,Object value,AbstractSession session,NamespaceResolver namespaceResolver,MarshalContext marshalContext){
  Class valueClass=null;
  if (value instanceof XMLRoot) {
    XMLRoot root=(XMLRoot)value;
    for (    DatabaseField next : this.xmlChoiceMapping.getFields()) {
      XPathFragment fragment=((XMLField)next).getXPathFragment();
      while (fragment != null && !fragment.nameIsText) {
        if (fragment.getNextFragment() == null || fragment.getHasText()) {
          if (fragment.getLocalName().equals(root.getLocalName())) {
            String fragUri=fragment.getNamespaceURI();
            String namespaceUri=root.getNamespaceURI();
            if ((namespaceUri == null && fragUri == null) || (namespaceUri != null && fragUri != null && namespaceUri.equals(fragUri))) {
              if (next == this.xmlField) {
                return this.choiceElementNodeValue.marshalSingleValue(xPathFragment,marshalRecord,object,value,session,namespaceResolver,marshalContext);
              }
 else {
                return false;
              }
            }
          }
        }
        fragment=fragment.getNextFragment();
      }
    }
    valueClass=root.getObject().getClass();
  }
  if (value != null) {
    if (valueClass == null) {
      valueClass=value.getClass();
    }
    XMLField fieldForClass=null;
    Class theClass=valueClass;
    while (theClass != null) {
      fieldForClass=xmlChoiceMapping.getClassToFieldMappings().get(valueClass);
      if (fieldForClass != null) {
        break;
      }
      theClass=theClass.getSuperclass();
    }
    if (fieldForClass == this.xmlField) {
      return this.choiceElementNodeValue.marshalSingleValue(xPathFragment,marshalRecord,object,value,session,namespaceResolver,marshalContext);
    }
    List<XMLField> sourceFields=null;
    theClass=valueClass;
    while (theClass != null) {
      sourceFields=xmlChoiceMapping.getClassToSourceFieldsMappings().get(theClass);
      if (sourceFields != null) {
        break;
      }
      theClass=theClass.getSuperclass();
    }
    if (sourceFields != null && sourceFields.contains(this.xmlField)) {
      return this.choiceElementNodeValue.marshalSingleValue(xPathFragment,marshalRecord,object,value,session,namespaceResolver,marshalContext);
    }
  }
  return false;
}