Program: 63581
Project: 63581
Buggy source:
public boolean startElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord,Attributes atts){
  try {
    unmarshalRecord.removeNullCapableValue(this);
    Descriptor xmlDescriptor=(Descriptor)xmlCompositeObjectMapping.getReferenceDescriptor();
    if (null == xmlDescriptor) {
      xmlDescriptor=findReferenceDescriptor(xPathFragment,unmarshalRecord,atts,xmlCompositeObjectMapping,xmlCompositeObjectMapping.getKeepAsElementPolicy());
      if (xmlDescriptor == null) {
        if (xmlCompositeObjectMapping.getField() != null) {
          QName leafType=((Field)xmlCompositeObjectMapping.getField()).getLastXPathFragment().getLeafElementType();
          if (leafType != null) {
            XPathFragment frag=new XPathFragment();
            frag.setNamespaceAware(unmarshalRecord.isNamespaceAware());
            String xpath=leafType.getLocalPart();
            String uri=leafType.getNamespaceURI();
            if (uri != null && uri.length() > 0) {
              frag.setNamespaceURI(uri);
              String prefix=((Descriptor)xmlCompositeObjectMapping.getDescriptor()).getNonNullNamespaceResolver().resolveNamespaceURI(uri);
              if (prefix != null && prefix.length() > 0) {
                xpath=prefix + Constants.COLON + xpath;
              }
            }
            frag.setXPath(xpath);
            Context xmlContext=unmarshalRecord.getUnmarshaller().getContext();
            xmlDescriptor=xmlContext.getDescriptorByGlobalType(frag);
          }
        }
      }
      UnmarshalKeepAsElementPolicy policy=xmlCompositeObjectMapping.getKeepAsElementPolicy();
      if (null != policy && ((xmlDescriptor == null && policy.isKeepUnknownAsElement()) || policy.isKeepAllAsElement())) {
        QName schemaType=unmarshalRecord.getTypeQName();
        if (schemaType == null) {
          schemaType=((Field)xmlCompositeObjectMapping.getField()).getSchemaType();
          unmarshalRecord.setTypeQName(schemaType);
        }
        if (schemaType != null) {
          Class theClass=unmarshalRecord.getConversionManager().javaType(schemaType);
          if (theClass == null) {
            setupHandlerForKeepAsElementPolicy(unmarshalRecord,xPathFragment,atts);
            return true;
          }
        }
 else {
          setupHandlerForKeepAsElementPolicy(unmarshalRecord,xPathFragment,atts);
          return true;
        }
      }
    }
    AbstractNullPolicy nullPolicy=xmlCompositeObjectMapping.getNullPolicy();
    if (nullPolicy.isNullRepresentedByEmptyNode()) {
      String qnameString=xPathFragment.getLocalName();
      if (xPathFragment.getPrefix() != null) {
        qnameString=xPathFragment.getPrefix() + Constants.COLON + qnameString;
      }
      if (null != xmlDescriptor) {
        CompositeObjectMappingContentHandler aHandler=new CompositeObjectMappingContentHandler(unmarshalRecord,this,xmlCompositeObjectMapping,atts,xPathFragment,xmlDescriptor);
        aHandler.startElement(xPathFragment.getNamespaceURI(),xPathFragment.getLocalName(),qnameString,atts);
        XMLReader xmlReader=unmarshalRecord.getXMLReader();
        xmlReader.setContentHandler(aHandler);
        xmlReader.setLexicalHandler(aHandler);
      }
    }
 else {
      if (unmarshalRecord.getXMLReader().isNullRepresentedByXsiNil(nullPolicy) && unmarshalRecord.isNil()) {
        xmlCompositeObjectMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(),null);
      }
 else {
        Field xmlFld=(Field)this.xmlCompositeObjectMapping.getField();
        if (xmlFld.hasLastXPathFragment()) {
          unmarshalRecord.setLeafElementType(xmlFld.getLastXPathFragment().getLeafElementType());
        }
        processChild(xPathFragment,unmarshalRecord,atts,xmlDescriptor,xmlCompositeObjectMapping);
      }
    }
  }
 catch (  SAXException e) {
    throw XMLMarshalException.unmarshalException(e);
  }
  return true;
}

Fixed version (ground truth):
public boolean startElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord,Attributes atts){
  try {
    unmarshalRecord.removeNullCapableValue(this);
    Descriptor xmlDescriptor=(Descriptor)xmlCompositeObjectMapping.getReferenceDescriptor();
    if (null == xmlDescriptor) {
      xmlDescriptor=findReferenceDescriptor(xPathFragment,unmarshalRecord,atts,xmlCompositeObjectMapping,xmlCompositeObjectMapping.getKeepAsElementPolicy());
      if (xmlDescriptor == null) {
        if (xmlCompositeObjectMapping.getField() != null) {
          QName leafType=((Field)xmlCompositeObjectMapping.getField()).getLastXPathFragment().getLeafElementType();
          if (leafType != null) {
            XPathFragment frag=new XPathFragment();
            frag.setNamespaceAware(unmarshalRecord.isNamespaceAware());
            String xpath=leafType.getLocalPart();
            String uri=leafType.getNamespaceURI();
            if (uri != null && uri.length() > 0) {
              frag.setNamespaceURI(uri);
              String prefix=((Descriptor)xmlCompositeObjectMapping.getDescriptor()).getNonNullNamespaceResolver().resolveNamespaceURI(uri);
              if (prefix != null && prefix.length() > 0) {
                xpath=prefix + Constants.COLON + xpath;
              }
            }
            frag.setXPath(xpath);
            Context xmlContext=unmarshalRecord.getUnmarshaller().getContext();
            xmlDescriptor=xmlContext.getDescriptorByGlobalType(frag);
          }
        }
      }
      UnmarshalKeepAsElementPolicy policy=xmlCompositeObjectMapping.getKeepAsElementPolicy();
      if (null != policy && ((xmlDescriptor == null && policy.isKeepUnknownAsElement()) || policy.isKeepAllAsElement())) {
        QName schemaType=unmarshalRecord.getTypeQName();
        if (schemaType == null) {
          schemaType=((Field)xmlCompositeObjectMapping.getField()).getSchemaType();
          unmarshalRecord.setTypeQName(schemaType);
        }
        if (schemaType != null) {
          Class theClass=unmarshalRecord.getConversionManager().javaType(schemaType);
          if (theClass == null) {
            setupHandlerForKeepAsElementPolicy(unmarshalRecord,xPathFragment,atts);
            return true;
          }
        }
 else {
          setupHandlerForKeepAsElementPolicy(unmarshalRecord,xPathFragment,atts);
          return true;
        }
      }
    }
    AbstractNullPolicy nullPolicy=xmlCompositeObjectMapping.getNullPolicy();
    if (nullPolicy.isNullRepresentedByEmptyNode()) {
      String qnameString=xPathFragment.getLocalName();
      if (xPathFragment.getPrefix() != null) {
        qnameString=xPathFragment.getPrefix() + Constants.COLON + qnameString;
      }
      if (null != xmlDescriptor) {
        CompositeObjectMappingContentHandler aHandler=new CompositeObjectMappingContentHandler(unmarshalRecord,this,xmlCompositeObjectMapping,atts,xPathFragment,xmlDescriptor);
        aHandler.startElement(xPathFragment.getNamespaceURI(),xPathFragment.getLocalName(),qnameString,atts);
        XMLReader xmlReader=unmarshalRecord.getXMLReader();
        xmlReader.setContentHandler(aHandler);
        xmlReader.setLexicalHandler(aHandler);
      }
    }
 else {
      if (unmarshalRecord.getXMLReader().isNullRecord(nullPolicy,atts,unmarshalRecord)) {
        xmlCompositeObjectMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(),null);
      }
 else {
        Field xmlFld=(Field)this.xmlCompositeObjectMapping.getField();
        if (xmlFld.hasLastXPathFragment()) {
          unmarshalRecord.setLeafElementType(xmlFld.getLastXPathFragment().getLeafElementType());
        }
        processChild(xPathFragment,unmarshalRecord,atts,xmlDescriptor,xmlCompositeObjectMapping);
      }
    }
  }
 catch (  SAXException e) {
    throw XMLMarshalException.unmarshalException(e);
  }
  return true;
}