Program: 65676
Project: 65676
Buggy source:
public UnmarshalRecord buildSelfRecord(UnmarshalRecord unmarshalRecord,Attributes atts){
  try {
    XMLDescriptor xmlDescriptor=(XMLDescriptor)xmlCompositeObjectMapping.getReferenceDescriptor();
    if (null == xmlDescriptor) {
      xmlDescriptor=findReferenceDescriptor(null,unmarshalRecord,atts,xmlCompositeObjectMapping,xmlCompositeObjectMapping.getKeepAsElementPolicy());
    }
    if (xmlDescriptor != null) {
      if (xmlDescriptor.hasInheritance()) {
        unmarshalRecord.setAttributes(atts);
        Class clazz=xmlDescriptor.getInheritancePolicy().classFromRow(unmarshalRecord,unmarshalRecord.getSession());
        if (clazz == null) {
          QName leafElementType=unmarshalRecord.getLeafElementType();
          if (leafElementType != null) {
            Object indicator=xmlDescriptor.getInheritancePolicy().getClassIndicatorMapping().get(leafElementType);
            if (indicator != null) {
              clazz=(Class)indicator;
            }
          }
        }
        if (clazz != null) {
          xmlDescriptor=(XMLDescriptor)unmarshalRecord.getSession().getDescriptor(clazz);
        }
 else {
          if (Modifier.isAbstract(xmlDescriptor.getJavaClass().getModifiers())) {
            throw DescriptorException.missingClassIndicatorField(unmarshalRecord,xmlDescriptor.getInheritancePolicy().getDescriptor());
          }
        }
      }
      TreeObjectBuilder stob2=(TreeObjectBuilder)xmlDescriptor.getObjectBuilder();
      UnmarshalRecord childRecord=(UnmarshalRecord)stob2.createRecord(unmarshalRecord.getSession());
      childRecord.setUnmarshaller(unmarshalRecord.getUnmarshaller());
      childRecord.setSelfRecord(true);
      unmarshalRecord.setChildRecord(childRecord);
      childRecord.setXMLReader(unmarshalRecord.getXMLReader());
      childRecord.startDocument();
      childRecord.initializeRecord(this.xmlCompositeObjectMapping);
      return childRecord;
    }
 else {
      return null;
    }
  }
 catch (  SAXException e) {
    throw XMLMarshalException.unmarshalException(e);
  }
}

Fixed version (ground truth):
public UnmarshalRecord buildSelfRecord(UnmarshalRecord unmarshalRecord,Attributes atts){
  try {
    XMLDescriptor xmlDescriptor=(XMLDescriptor)xmlCompositeObjectMapping.getReferenceDescriptor();
    if (null == xmlDescriptor) {
      xmlDescriptor=findReferenceDescriptor(null,unmarshalRecord,atts,xmlCompositeObjectMapping,xmlCompositeObjectMapping.getKeepAsElementPolicy());
    }
    if (xmlDescriptor != null) {
      if (xmlDescriptor.hasInheritance()) {
        unmarshalRecord.setAttributes(atts);
        Class clazz=xmlDescriptor.getInheritancePolicy().classFromRow(unmarshalRecord,unmarshalRecord.getSession());
        if (clazz == null) {
          XPathQName leafElementType=unmarshalRecord.getLeafElementType();
          if (leafElementType != null) {
            Object indicator=xmlDescriptor.getInheritancePolicy().getClassIndicatorMapping().get(leafElementType);
            if (indicator != null) {
              clazz=(Class)indicator;
            }
          }
        }
        if (clazz != null) {
          xmlDescriptor=(XMLDescriptor)unmarshalRecord.getSession().getDescriptor(clazz);
        }
 else {
          if (Modifier.isAbstract(xmlDescriptor.getJavaClass().getModifiers())) {
            throw DescriptorException.missingClassIndicatorField(unmarshalRecord,xmlDescriptor.getInheritancePolicy().getDescriptor());
          }
        }
      }
      TreeObjectBuilder stob2=(TreeObjectBuilder)xmlDescriptor.getObjectBuilder();
      UnmarshalRecord childRecord=(UnmarshalRecord)stob2.createRecord(unmarshalRecord.getSession());
      childRecord.setUnmarshaller(unmarshalRecord.getUnmarshaller());
      childRecord.setSelfRecord(true);
      unmarshalRecord.setChildRecord(childRecord);
      childRecord.setXMLReader(unmarshalRecord.getXMLReader());
      childRecord.startDocument();
      childRecord.initializeRecord(this.xmlCompositeObjectMapping);
      return childRecord;
    }
 else {
      return null;
    }
  }
 catch (  SAXException e) {
    throw XMLMarshalException.unmarshalException(e);
  }
}