Program: 67350
Project: 67350
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 (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();
    if (xmlCompositeObjectMapping.getConverter() != null) {
      Converter converter=xmlCompositeObjectMapping.getConverter();
      if (converter instanceof XMLConverter) {
        object=((XMLConverter)converter).convertDataValueToObjectValue(object,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
      }
 else {
        object=converter.convertDataValueToObjectValue(object,unmarshalRecord.getSession());
      }
    }
    unmarshalRecord.setAttributeValue(object,xmlCompositeObjectMapping);
    if (xmlCompositeObjectMapping.getContainerAccessor() != null) {
      xmlCompositeObjectMapping.getContainerAccessor().setAttributeValueInObject(object,unmarshalRecord.getCurrentObject());
    }
    unmarshalRecord.setChildRecord(null);
  }
}

Fixed version (ground truth):
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();
    if (xmlCompositeObjectMapping.getConverter() != null) {
      Converter converter=xmlCompositeObjectMapping.getConverter();
      if (converter instanceof XMLConverter) {
        object=((XMLConverter)converter).convertDataValueToObjectValue(object,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
      }
 else {
        object=converter.convertDataValueToObjectValue(object,unmarshalRecord.getSession());
      }
    }
    unmarshalRecord.setAttributeValue(object,xmlCompositeObjectMapping);
    if (xmlCompositeObjectMapping.getContainerAccessor() != null) {
      xmlCompositeObjectMapping.getContainerAccessor().setAttributeValueInObject(object,unmarshalRecord.getCurrentObject());
    }
    unmarshalRecord.setChildRecord(null);
  }
}