Program: 67224
Project: 67224
Buggy source:
public void endElement(String namespaceURI,String localName,String qName) throws SAXException {
  try {
    if (null != selfRecords) {
      int selfRecordsSize=selfRecords.size();
      for (int x=0; x < selfRecordsSize; x++) {
        UnmarshalRecord selfRecord=((UnmarshalRecord)selfRecords.get(x));
        if (selfRecord != null) {
          selfRecord.endElement(namespaceURI,localName,qName);
        }
      }
    }
    if (null != xPathNode.getUnmarshalNodeValue()) {
      xPathNode.getUnmarshalNodeValue().endElement(xPathFragment,this);
      if (xPathNode.getParent() != null) {
        xPathNode=xPathNode.getParent();
      }
    }
 else {
      XPathNode textNode=(XPathNode)xPathNode.getTextNode();
      if (null != textNode && textNode.isWhitespaceAware() && stringBuffer.length() == 0) {
        boolean isXsiNil=false;
        if (getAttributes() != null) {
          isXsiNil=getAttributes().getIndex(XMLConstants.SCHEMA_INSTANCE_URL,XMLConstants.SCHEMA_NIL_ATTRIBUTE) >= 0;
        }
        if (!isXsiNil) {
          if (textNode.getUnmarshalNodeValue().isMappingNodeValue()) {
            MappingNodeValue mappingNodeValue=(MappingNodeValue)textNode.getUnmarshalNodeValue();
            mappingNodeValue.endElement(xPathFragment,this);
          }
        }
      }
    }
    if (null != xPathNode.getParent()) {
      if (EMPTY_STRING.equals(namespaceURI)) {
        xPathFragment.setLocalName(qName);
        xPathFragment.setNamespaceURI(null);
      }
 else {
        xPathFragment.setLocalName(localName);
        xPathFragment.setNamespaceURI(namespaceURI);
      }
      if (xPathFragment.qNameEquals(xPathNode.getXPathFragment())) {
        if (xPathNode.getParent() != null) {
          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);
    }
  }
 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) {
      int selfRecordsSize=selfRecords.size();
      for (int x=0; x < selfRecordsSize; x++) {
        UnmarshalRecord selfRecord=((UnmarshalRecord)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);
      if (xPathNode.getParent() != null) {
        xPathNode=xPathNode.getParent();
      }
    }
 else {
      XPathNode textNode=(XPathNode)xPathNode.getTextNode();
      if (null != textNode && textNode.isWhitespaceAware() && stringBuffer.length() == 0) {
        boolean isXsiNil=false;
        if (getAttributes() != null) {
          isXsiNil=getAttributes().getIndex(XMLConstants.SCHEMA_INSTANCE_URL,XMLConstants.SCHEMA_NIL_ATTRIBUTE) >= 0;
        }
        if (!isXsiNil) {
          if (textNode.getUnmarshalNodeValue().isMappingNodeValue()) {
            MappingNodeValue mappingNodeValue=(MappingNodeValue)textNode.getUnmarshalNodeValue();
            mappingNodeValue.endElement(xPathFragment,this);
          }
        }
      }
    }
    if (null != xPathNode.getParent()) {
      if (EMPTY_STRING.equals(namespaceURI)) {
        xPathFragment.setLocalName(qName);
        xPathFragment.setNamespaceURI(null);
      }
 else {
        xPathFragment.setLocalName(localName);
        xPathFragment.setNamespaceURI(namespaceURI);
      }
      if (xPathFragment.qNameEquals(xPathNode.getXPathFragment())) {
        if (xPathNode.getParent() != null) {
          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);
    }
  }
 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);
    }
  }
}