Program: 68651
Project: 68651
Buggy source:
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord){
  Object collection=unmarshalRecord.getContainerInstance(this);
  if (null != unmarshalRecord.getChildRecord()) {
    if (!xmlAnyCollectionMapping.usesXMLRoot()) {
      unmarshalRecord.addAttributeValue(this,unmarshalRecord.getChildRecord().getCurrentObject());
    }
    if (xmlAnyCollectionMapping.usesXMLRoot()) {
      Object childObject=unmarshalRecord.getChildRecord().getCurrentObject();
      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.addAttributeValue(this,childObject);
      }
    }
    unmarshalRecord.setChildRecord(null);
    workingDescriptor=null;
  }
 else {
    SAXFragmentBuilder builder=unmarshalRecord.getFragmentBuilder();
    UnmarshalKeepAsElementPolicy keepAsElementPolicy=xmlAnyCollectionMapping.getKeepAsElementPolicy();
    if ((((keepAsElementPolicy == UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT) || (keepAsElementPolicy == UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT))) && (builder.getNodes().size() != 0)) {
      unmarshalRecord.addAttributeValue(this,builder.getNodes().pop());
    }
 else {
      endElementProcessText(unmarshalRecord,collection,xPathFragment);
    }
  }
}

Fixed version (ground truth):
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord){
  Object collection=unmarshalRecord.getContainerInstance(this);
  if (null != unmarshalRecord.getChildRecord()) {
    if (!xmlAnyCollectionMapping.usesXMLRoot()) {
      Object objectValue=unmarshalRecord.getChildRecord().getCurrentObject();
      if (xmlAnyCollectionMapping.getConverter() != null) {
        objectValue=xmlAnyCollectionMapping.getConverter().convertDataValueToObjectValue(objectValue,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
      }
      unmarshalRecord.addAttributeValue(this,objectValue);
    }
    if (xmlAnyCollectionMapping.usesXMLRoot()) {
      Object childObject=unmarshalRecord.getChildRecord().getCurrentObject();
      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);
        if (xmlAnyCollectionMapping.getConverter() != null) {
          childObject=xmlAnyCollectionMapping.getConverter().convertDataValueToObjectValue(childObject,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
        }
        unmarshalRecord.addAttributeValue(this,childObject);
      }
    }
    unmarshalRecord.setChildRecord(null);
    workingDescriptor=null;
  }
 else {
    SAXFragmentBuilder builder=unmarshalRecord.getFragmentBuilder();
    UnmarshalKeepAsElementPolicy keepAsElementPolicy=xmlAnyCollectionMapping.getKeepAsElementPolicy();
    if ((((keepAsElementPolicy == UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT) || (keepAsElementPolicy == UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT))) && (builder.getNodes().size() != 0)) {
      Object node=builder.getNodes().pop();
      if (xmlAnyCollectionMapping.getConverter() != null) {
        node=xmlAnyCollectionMapping.getConverter().convertDataValueToObjectValue(node,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
      }
      unmarshalRecord.addAttributeValue(this,node);
    }
 else {
      endElementProcessText(unmarshalRecord,collection,xPathFragment);
    }
  }
}