Program: 67207
Project: 67207
Buggy source:
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord){
  unmarshalRecord.removeNullCapableValue(this);
  Object childObject=null;
  if (null != unmarshalRecord.getChildRecord()) {
    childObject=unmarshalRecord.getChildRecord().getCurrentObject();
    if (xmlAnyObjectMapping.getConverter() != null) {
      childObject=xmlAnyObjectMapping.getConverter().convertDataValueToObjectValue(childObject,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
    }
    if (!xmlAnyObjectMapping.usesXMLRoot()) {
      unmarshalRecord.setAttributeValue(childObject,xmlAnyObjectMapping);
    }
 else {
      if (workingDescriptor != null) {
        String prefix=xPathFragment.getPrefix();
        if ((prefix == null) && (xPathFragment.getNamespaceURI() != null)) {
          prefix=unmarshalRecord.resolveNamespaceUri(xPathFragment.getNamespaceURI());
        }
        childObject=workingDescriptor.wrapObjectInXMLRoot(childObject,xPathFragment.getNamespaceURI(),xPathFragment.getLocalName(),prefix,false);
        unmarshalRecord.setAttributeValue(childObject,xmlAnyObjectMapping);
        workingDescriptor=null;
      }
    }
  }
 else {
    SAXFragmentBuilder builder=unmarshalRecord.getFragmentBuilder();
    UnmarshalKeepAsElementPolicy keepAsElementPolicy=xmlAnyObjectMapping.getKeepAsElementPolicy();
    if ((((keepAsElementPolicy == UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT) || (keepAsElementPolicy == UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT))) && (builder.getNodes().size() > 1)) {
      setOrAddAttributeValueForKeepAsElement(builder,xmlAnyObjectMapping,xmlAnyObjectMapping.getConverter(),unmarshalRecord,false,null);
    }
 else {
      if (xmlAnyObjectMapping.isMixedContent()) {
        endElementProcessText(unmarshalRecord,xmlAnyObjectMapping.getConverter(),xPathFragment,null);
      }
 else {
        unmarshalRecord.resetStringBuffer();
      }
    }
  }
}

Fixed version (ground truth):
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord){
  unmarshalRecord.removeNullCapableValue(this);
  UnmarshalRecord childRecord=unmarshalRecord.getChildRecord();
  if (null != childRecord) {
    Object childObject=childRecord.getCurrentObject();
    if (xmlAnyObjectMapping.getConverter() != null) {
      childObject=xmlAnyObjectMapping.getConverter().convertDataValueToObjectValue(childObject,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
    }
    if (xmlAnyObjectMapping.usesXMLRoot()) {
      XMLDescriptor workingDescriptor=childRecord.getDescriptor();
      if (workingDescriptor != null) {
        String prefix=xPathFragment.getPrefix();
        if ((prefix == null) && (xPathFragment.getNamespaceURI() != null)) {
          prefix=unmarshalRecord.resolveNamespaceUri(xPathFragment.getNamespaceURI());
        }
        childObject=workingDescriptor.wrapObjectInXMLRoot(childObject,xPathFragment.getNamespaceURI(),xPathFragment.getLocalName(),prefix,false);
        unmarshalRecord.setAttributeValue(childObject,xmlAnyObjectMapping);
        workingDescriptor=null;
      }
    }
 else {
      unmarshalRecord.setAttributeValue(childObject,xmlAnyObjectMapping);
    }
  }
 else {
    SAXFragmentBuilder builder=unmarshalRecord.getFragmentBuilder();
    UnmarshalKeepAsElementPolicy keepAsElementPolicy=xmlAnyObjectMapping.getKeepAsElementPolicy();
    if ((((keepAsElementPolicy == UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT) || (keepAsElementPolicy == UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT))) && (builder.getNodes().size() > 1)) {
      setOrAddAttributeValueForKeepAsElement(builder,xmlAnyObjectMapping,xmlAnyObjectMapping.getConverter(),unmarshalRecord,false,null);
    }
 else {
      if (xmlAnyObjectMapping.isMixedContent()) {
        endElementProcessText(unmarshalRecord,xmlAnyObjectMapping.getConverter(),xPathFragment,null);
      }
 else {
        unmarshalRecord.resetStringBuffer();
      }
    }
  }
}