Program: 64821
Project: 64821
Buggy source:
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord){
  if (null == unmarshalRecord.getChildRecord()) {
    SAXFragmentBuilder builder=unmarshalRecord.getFragmentBuilder();
    UnmarshalKeepAsElementPolicy keepAsElementPolicy=xmlCompositeObjectMapping.getKeepAsElementPolicy();
    if ((((keepAsElementPolicy == UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT) || (keepAsElementPolicy == UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT))) && (builder.getNodes().size() != 0)) {
      if (unmarshalRecord.getTypeQName() != null) {
        Class theClass=(Class)((XMLConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager()).getDefaultXMLTypes().get(unmarshalRecord.getTypeQName());
        if (theClass != null) {
          endElementProcessText(unmarshalRecord,xmlCompositeObjectMapping.getConverter(),xPathFragment,null);
          return;
        }
      }
      if (builder.getDocument() != null) {
        setOrAddAttributeValueForKeepAsElement(builder,(XMLMapping)xmlCompositeObjectMapping,(XMLConverter)xmlCompositeObjectMapping.getConverter(),unmarshalRecord,false,null);
        return;
      }
    }
 else {
      endElementProcessText(unmarshalRecord,xmlCompositeObjectMapping.getConverter(),xPathFragment,null);
      return;
    }
  }
 else {
    Object object=unmarshalRecord.getChildRecord().getCurrentObject();
    setAttributeValue(object,unmarshalRecord);
    unmarshalRecord.setChildRecord(null);
  }
}

Fixed version (ground truth):
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord){
  if (unmarshalRecord.isNil() && xmlCompositeObjectMapping.getNullPolicy().isNullRepresentedByXsiNil()) {
    unmarshalRecord.resetStringBuffer();
    return;
  }
  if (null == unmarshalRecord.getChildRecord()) {
    SAXFragmentBuilder builder=unmarshalRecord.getFragmentBuilder();
    UnmarshalKeepAsElementPolicy keepAsElementPolicy=xmlCompositeObjectMapping.getKeepAsElementPolicy();
    if ((((keepAsElementPolicy == UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT) || (keepAsElementPolicy == UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT))) && (builder.getNodes().size() != 0)) {
      if (unmarshalRecord.getTypeQName() != null) {
        Class theClass=(Class)((XMLConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager()).getDefaultXMLTypes().get(unmarshalRecord.getTypeQName());
        if (theClass != null) {
          endElementProcessText(unmarshalRecord,xmlCompositeObjectMapping.getConverter(),xPathFragment,null);
          return;
        }
      }
      if (builder.getDocument() != null) {
        setOrAddAttributeValueForKeepAsElement(builder,(XMLMapping)xmlCompositeObjectMapping,(XMLConverter)xmlCompositeObjectMapping.getConverter(),unmarshalRecord,false,null);
        return;
      }
    }
 else {
      endElementProcessText(unmarshalRecord,xmlCompositeObjectMapping.getConverter(),xPathFragment,null);
      return;
    }
  }
 else {
    Object object=unmarshalRecord.getChildRecord().getCurrentObject();
    setAttributeValue(object,unmarshalRecord);
    unmarshalRecord.setChildRecord(null);
  }
}