Program: 67435
Project: 67435
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() != 0)) {
      setOrAddAttributeValueForKeepAsElement(builder,xmlAnyObjectMapping,xmlAnyObjectMapping.getConverter(),unmarshalRecord,false,null);
    }
 else {
      endElementProcessText(unmarshalRecord,xmlAnyObjectMapping.getConverter(),xPathFragment,null);
    }
  }
}

Fixed version (ground truth):
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();
      }
    }
  }
}