Program: 66478
Project: 66478
Buggy source:
public void endElement(String namespaceURI,String localName,String qName) throws SAXException {
  try {
    if (null != selfRecords) {
      for (int x=0, selfRecordsSize=selfRecords.size(); x < selfRecordsSize; x++) {
        UnmarshalRecord selfRecord=selfRecords.get(x);
        if (selfRecord != null) {
          selfRecord.endElement(namespaceURI,localName,qName);
        }
 else {
          getFragmentBuilder().endSelfElement(namespaceURI,localName,qName);
        }
      }
    }
    if (null != xPathNode.getUnmarshalNodeValue()) {
      xPathNode.getUnmarshalNodeValue().endElement(xPathFragment,this);
    }
 else {
      XPathNode textNode=xPathNode.getTextNode();
      if (null != textNode && textNode.isWhitespaceAware() && getStringBuffer().length() == 0) {
        if (!isXsiNil) {
          if (textNode.getUnmarshalNodeValue().isMappingNodeValue()) {
            textNode.getUnmarshalNodeValue().endElement(xPathFragment,this);
          }
        }
 else {
          isXsiNil=false;
        }
      }
    }
    XPathFragment xPathFragment=xPathNode.getXPathFragment();
    if (null != xPathFragment && xPathFragment.nameIsText()) {
      xPathNode=xPathNode.getParent();
    }
    if (null != xPathNode.getParent()) {
      xPathNode=xPathNode.getParent();
    }
    unmarshalContext.endElement(this);
    typeQName=null;
    levelIndex--;
    if ((0 == levelIndex) && (null != getParentRecord()) && !isSelfRecord()) {
      endDocument();
      UnmarshalRecord pRec=getParentRecord();
      while (pRec.isSelfRecord()) {
        pRec=pRec.getParentRecord();
      }
      pRec.endElement(namespaceURI,localName,qName);
      xmlReader.setContentHandler(pRec);
      xmlReader.setLexicalHandler(pRec);
    }
  }
 catch (  EclipseLinkException e) {
    if ((null == xmlReader) || (null == xmlReader.getErrorHandler())) {
      throw e;
    }
 else {
      SAXParseException saxParseException=new SAXParseException(null,null,null,0,0,e);
      xmlReader.getErrorHandler().error(saxParseException);
    }
  }
}

Fixed version (ground truth):
public void endElement(String namespaceURI,String localName,String qName) throws SAXException {
  try {
    if (null != selfRecords) {
      for (int x=0, selfRecordsSize=selfRecords.size(); x < selfRecordsSize; x++) {
        UnmarshalRecord selfRecord=selfRecords.get(x);
        if (selfRecord != null) {
          selfRecord.endElement(namespaceURI,localName,qName);
        }
 else {
          getFragmentBuilder().endSelfElement(namespaceURI,localName,qName);
        }
      }
    }
    if (null != xPathNode.getUnmarshalNodeValue()) {
      xPathNode.getUnmarshalNodeValue().endElement(xPathFragment,this);
    }
 else {
      XPathNode textNode=xPathNode.getTextNode();
      if (null != textNode && textNode.isWhitespaceAware() && getStringBuffer().length() == 0) {
        if (!isXsiNil) {
          if (textNode.getUnmarshalNodeValue().isMappingNodeValue()) {
            textNode.getUnmarshalNodeValue().endElement(xPathFragment,this);
          }
        }
 else {
          isXsiNil=false;
        }
      }
    }
    XPathFragment xPathFragment=xPathNode.getXPathFragment();
    if (null != xPathFragment && xPathFragment.nameIsText()) {
      xPathNode=xPathNode.getParent();
    }
    if (null != xPathNode.getParent()) {
      xPathNode=xPathNode.getParent();
    }
    xpathNodeIsMixedContent=false;
    unmarshalContext.endElement(this);
    typeQName=null;
    levelIndex--;
    if ((0 == levelIndex) && (null != getParentRecord()) && !isSelfRecord()) {
      endDocument();
      UnmarshalRecord pRec=getParentRecord();
      while (pRec.isSelfRecord()) {
        pRec=pRec.getParentRecord();
      }
      pRec.endElement(namespaceURI,localName,qName);
      xmlReader.setContentHandler(pRec);
      xmlReader.setLexicalHandler(pRec);
    }
  }
 catch (  EclipseLinkException e) {
    if ((null == xmlReader) || (null == xmlReader.getErrorHandler())) {
      throw e;
    }
 else {
      SAXParseException saxParseException=new SAXParseException(null,null,null,0,0,e);
      xmlReader.getErrorHandler().error(saxParseException);
    }
  }
}